From 51a41adeb6edbddcd75ae6487d8d875ed6109868 Mon Sep 17 00:00:00 2001 From: SONOLET Aymeric Date: Thu, 12 Sep 2024 21:26:42 +0200 Subject: [PATCH] Revert "refactor: add missing includes and remove unused" This reverts commit 5972d7ba5e003a70bee90674cb1775b122caa03b. --- .clang-tidy | 32 - src/ICoCo/ICoCoMEDDoubleField.cxx | 2 +- src/ICoCo/ICoCoMEDDoubleField.hxx | 3 +- src/ICoCo/ICoCoMEDIntField.cxx | 3 +- src/ICoCo/ICoCoMEDIntField.hxx | 3 +- src/INTERP_KERNEL/BBTree.txx | 1 + src/INTERP_KERNEL/BBTreeDst.txx | 29 +- src/INTERP_KERNEL/BBTreePts.txx | 3 +- src/INTERP_KERNEL/BBTreeStandAlone.txx | 2 - .../Barycentric3DIntersectorP1P1.hxx | 3 +- .../Barycentric3DIntersectorP1P1.txx | 12 +- .../Bases/InterpKernelAssert.hxx | 2 + .../Bases/InterpKernelException.cxx | 5 +- .../Bases/InterpKernelException.hxx | 4 +- .../Bases/InterpKernelHashMap.hxx | 115 +- .../Bases/InterpKernelHashTable.hxx | 102 +- .../Bases/InterpKernelStlExt.hxx | 1 + .../Bases/NormalizedUnstructuredMesh.hxx | 1 + src/INTERP_KERNEL/BoundingBox.hxx | 4 +- src/INTERP_KERNEL/BoxSplittingOptions.cxx | 2 - src/INTERP_KERNEL/CellModel.cxx | 34 +- src/INTERP_KERNEL/CellModel.hxx | 2 +- src/INTERP_KERNEL/ConvexIntersector.hxx | 10 +- src/INTERP_KERNEL/ConvexIntersector.txx | 9 +- src/INTERP_KERNEL/CurveIntersector.hxx | 1 - src/INTERP_KERNEL/CurveIntersector.txx | 26 +- src/INTERP_KERNEL/CurveIntersectorP0P0.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP0P0.txx | 4 +- src/INTERP_KERNEL/CurveIntersectorP0P1.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP0P1.txx | 4 +- src/INTERP_KERNEL/CurveIntersectorP1P0.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP1P0.txx | 4 +- src/INTERP_KERNEL/CurveIntersectorP1P1.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP1P1.txx | 4 +- src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx | 6 +- src/INTERP_KERNEL/DiameterCalculator.cxx | 19 +- src/INTERP_KERNEL/DiameterCalculator.hxx | 212 +-- src/INTERP_KERNEL/DirectedBoundingBox.cxx | 23 +- .../ExprEval/InterpKernelAsmX86.cxx | 75 +- .../ExprEval/InterpKernelAsmX86.hxx | 2 + .../ExprEval/InterpKernelExprParser.cxx | 224 ++- .../ExprEval/InterpKernelExprParser.hxx | 56 +- .../ExprEval/InterpKernelFunction.cxx | 210 +-- .../ExprEval/InterpKernelFunction.hxx | 418 +++--- .../ExprEval/InterpKernelUnit.cxx | 46 +- .../ExprEval/InterpKernelUnit.hxx | 3 +- .../ExprEval/InterpKernelValue.cxx | 88 +- .../ExprEval/InterpKernelValue.hxx | 180 +-- .../GaussPoints/InterpKernelGaussCoords.cxx | 63 +- .../GaussPoints/InterpKernelGaussCoords.hxx | 9 +- src/INTERP_KERNEL/GenMathFormulae.hxx | 18 +- .../InterpKernelGeo2DAbstractEdge.cxx | 13 +- .../InterpKernelGeo2DAbstractEdge.hxx | 4 +- .../Geometric2D/InterpKernelGeo2DBounds.cxx | 27 +- .../Geometric2D/InterpKernelGeo2DBounds.hxx | 2 +- .../InterpKernelGeo2DComposedEdge.cxx | 208 ++- .../InterpKernelGeo2DComposedEdge.hxx | 3 +- .../Geometric2D/InterpKernelGeo2DEdge.cxx | 101 +- .../Geometric2D/InterpKernelGeo2DEdge.hxx | 16 +- .../Geometric2D/InterpKernelGeo2DEdge.txx | 2 - .../InterpKernelGeo2DEdgeArcCircle.cxx | 197 ++- .../InterpKernelGeo2DEdgeArcCircle.hxx | 73 +- .../InterpKernelGeo2DEdgeInfLin.cxx | 2 - .../InterpKernelGeo2DEdgeInfLin.hxx | 8 +- .../Geometric2D/InterpKernelGeo2DEdgeLin.cxx | 66 +- .../Geometric2D/InterpKernelGeo2DEdgeLin.hxx | 51 +- .../InterpKernelGeo2DElementaryEdge.cxx | 7 +- .../InterpKernelGeo2DElementaryEdge.hxx | 8 +- .../Geometric2D/InterpKernelGeo2DNode.cxx | 38 +- .../InterpKernelGeo2DQuadraticPolygon.cxx | 294 ++-- .../InterpKernelGeo2DQuadraticPolygon.hxx | 14 +- src/INTERP_KERNEL/Geometric2DIntersector.hxx | 12 +- src/INTERP_KERNEL/Geometric2DIntersector.txx | 8 - .../IntegralUniformIntersector.hxx | 9 +- .../IntegralUniformIntersector.txx | 8 +- .../InterpKernelCellSimplify.cxx | 112 +- .../InterpKernelCellSimplify.hxx | 3 +- src/INTERP_KERNEL/InterpKernelDenseMatrix.txx | 1 - src/INTERP_KERNEL/InterpKernelMatrix.hxx | 14 +- src/INTERP_KERNEL/InterpKernelMatrixTools.cxx | 3 +- src/INTERP_KERNEL/InterpKernelMeshQuality.cxx | 137 +- .../InterpKernelRootsMultiDim.hxx | 11 +- src/INTERP_KERNEL/Interpolation.hxx | 4 +- src/INTERP_KERNEL/Interpolation.txx | 8 +- src/INTERP_KERNEL/Interpolation1D.hxx | 5 +- src/INTERP_KERNEL/Interpolation1D.txx | 2 + src/INTERP_KERNEL/Interpolation1D0D.cxx | 8 +- src/INTERP_KERNEL/Interpolation1D0D.hxx | 4 +- src/INTERP_KERNEL/Interpolation1D0D.txx | 14 +- src/INTERP_KERNEL/Interpolation2D.hxx | 7 +- src/INTERP_KERNEL/Interpolation2D.txx | 2 + src/INTERP_KERNEL/Interpolation2D1D.hxx | 11 +- src/INTERP_KERNEL/Interpolation2D1D.txx | 31 +- src/INTERP_KERNEL/Interpolation2D3D.cxx | 4 +- src/INTERP_KERNEL/Interpolation2D3D.hxx | 9 +- src/INTERP_KERNEL/Interpolation2D3D.txx | 23 +- src/INTERP_KERNEL/Interpolation2DCurve.cxx | 1 - src/INTERP_KERNEL/Interpolation2DCurve.hxx | 3 +- src/INTERP_KERNEL/Interpolation3D.cxx | 5 +- src/INTERP_KERNEL/Interpolation3D.hxx | 4 +- src/INTERP_KERNEL/Interpolation3D.txx | 13 +- src/INTERP_KERNEL/Interpolation3D1D.cxx | 11 +- src/INTERP_KERNEL/Interpolation3D1D.hxx | 3 +- src/INTERP_KERNEL/Interpolation3D1D.txx | 18 +- src/INTERP_KERNEL/Interpolation3DSurf.cxx | 8 +- src/INTERP_KERNEL/Interpolation3DSurf.hxx | 4 +- src/INTERP_KERNEL/InterpolationCC.hxx | 1 - src/INTERP_KERNEL/InterpolationCC.txx | 13 +- src/INTERP_KERNEL/InterpolationCU.hxx | 3 +- src/INTERP_KERNEL/InterpolationCU.txx | 15 +- src/INTERP_KERNEL/InterpolationCurve.hxx | 2 - src/INTERP_KERNEL/InterpolationCurve.txx | 32 +- src/INTERP_KERNEL/InterpolationHelper.txx | 2 - src/INTERP_KERNEL/InterpolationOptions.cxx | 7 +- src/INTERP_KERNEL/InterpolationOptions.hxx | 2 +- src/INTERP_KERNEL/InterpolationPlanar.hxx | 3 +- src/INTERP_KERNEL/InterpolationPlanar.txx | 39 +- src/INTERP_KERNEL/InterpolationUtils.hxx | 143 +- src/INTERP_KERNEL/Intersector3D.hxx | 6 +- src/INTERP_KERNEL/Intersector3D.txx | 6 +- src/INTERP_KERNEL/Intersector3DP0P0.txx | 2 +- src/INTERP_KERNEL/Intersector3DP0P1.txx | 2 +- src/INTERP_KERNEL/Intersector3DP1P0.txx | 2 +- src/INTERP_KERNEL/Intersector3DP1P0Bary.txx | 2 +- src/INTERP_KERNEL/Intersector3DP1P1.txx | 2 +- src/INTERP_KERNEL/IntersectorCU.hxx | 5 +- src/INTERP_KERNEL/IntersectorCU.txx | 8 +- src/INTERP_KERNEL/IntersectorCU1D.hxx | 5 +- src/INTERP_KERNEL/IntersectorCU1D.txx | 9 +- src/INTERP_KERNEL/IntersectorCU2D.hxx | 7 +- src/INTERP_KERNEL/IntersectorCU2D.txx | 5 - src/INTERP_KERNEL/IntersectorCU3D.hxx | 9 +- src/INTERP_KERNEL/IntersectorCU3D.txx | 15 +- .../LinearAlgebra/InterpKernelDenseMatrix.cxx | 1 - .../LinearAlgebra/InterpKernelLUDecomp.cxx | 3 - .../LinearAlgebra/InterpKernelLUDecomp.hxx | 2 - .../LinearAlgebra/InterpKernelQRDecomp.cxx | 4 - .../LinearAlgebra/InterpKernelQRDecomp.hxx | 1 - src/INTERP_KERNEL/MCIdType.hxx | 4 +- .../MappedBarycentric2DIntersectorP1P1.hxx | 4 +- .../MappedBarycentric2DIntersectorP1P1.txx | 8 +- .../MappedBarycentric3DIntersectorP1P1.hxx | 2 +- .../MappedBarycentric3DIntersectorP1P1.txx | 14 +- src/INTERP_KERNEL/MeshElement.cxx | 1 - src/INTERP_KERNEL/MeshElement.hxx | 4 +- src/INTERP_KERNEL/MeshElement.txx | 6 +- src/INTERP_KERNEL/MeshRegion.hxx | 1 + src/INTERP_KERNEL/MeshRegion.txx | 11 +- src/INTERP_KERNEL/MeshUtils.hxx | 3 - src/INTERP_KERNEL/OrientationInverter.cxx | 10 +- src/INTERP_KERNEL/OrientationInverter.hxx | 28 +- .../Planar2D1DIntersectorP0P0.hxx | 2 - .../Planar2D1DIntersectorP0P0.txx | 4 - src/INTERP_KERNEL/PlanarIntersector.hxx | 2 - src/INTERP_KERNEL/PlanarIntersector.txx | 11 +- src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP0P0.txx | 2 - src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx | 5 +- src/INTERP_KERNEL/PlanarIntersectorP0P1.txx | 4 - .../PlanarIntersectorP0P1Bary.hxx | 2 - .../PlanarIntersectorP0P1Bary.txx | 5 - src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx | 2 - src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx | 6 +- src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx | 2 - src/INTERP_KERNEL/PlanarIntersectorP1P0.txx | 5 - .../PlanarIntersectorP1P0Bary.hxx | 4 +- .../PlanarIntersectorP1P0Bary.txx | 5 - src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx | 11 +- src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx | 2 - src/INTERP_KERNEL/PlanarIntersectorP1P1.txx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx | 2 - src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx | 9 +- .../PointLocator2DIntersector.hxx | 8 +- .../PointLocator2DIntersector.txx | 13 +- .../PointLocator3DIntersectorP0P0.hxx | 2 +- .../PointLocator3DIntersectorP0P0.txx | 13 +- .../PointLocator3DIntersectorP0P1.hxx | 2 +- .../PointLocator3DIntersectorP0P1.txx | 13 +- .../PointLocator3DIntersectorP1P0.hxx | 4 +- .../PointLocator3DIntersectorP1P0.txx | 14 +- .../PointLocator3DIntersectorP1P1.hxx | 4 +- .../PointLocator3DIntersectorP1P1.txx | 14 +- src/INTERP_KERNEL/PointLocatorAlgos.txx | 40 +- src/INTERP_KERNEL/PolygonAlgorithms.hxx | 1 - src/INTERP_KERNEL/PolygonAlgorithms.txx | 43 +- .../Polyhedron3D2DIntersectorP0P0.hxx | 8 +- .../Polyhedron3D2DIntersectorP0P0.txx | 17 +- .../PolyhedronIntersectorP0P0.hxx | 3 +- .../PolyhedronIntersectorP0P0.txx | 7 +- .../PolyhedronIntersectorP0P1.hxx | 1 - .../PolyhedronIntersectorP0P1.txx | 12 +- .../PolyhedronIntersectorP1P0.hxx | 3 +- .../PolyhedronIntersectorP1P0.txx | 11 +- .../PolyhedronIntersectorP1P0Bary.hxx | 3 +- .../PolyhedronIntersectorP1P0Bary.txx | 8 +- .../PolyhedronIntersectorP1P1.hxx | 5 +- .../PolyhedronIntersectorP1P1.txx | 22 +- src/INTERP_KERNEL/RegionNode.hxx | 4 +- src/INTERP_KERNEL/SplitterTetra.cxx | 13 +- src/INTERP_KERNEL/SplitterTetra.hxx | 14 +- src/INTERP_KERNEL/SplitterTetra.txx | 83 +- src/INTERP_KERNEL/TargetIntersector.hxx | 6 +- src/INTERP_KERNEL/TargetIntersector.txx | 2 - src/INTERP_KERNEL/TetraAffineTransform.cxx | 2 +- src/INTERP_KERNEL/TransformedTriangle.cxx | 52 +- src/INTERP_KERNEL/TransformedTriangle.hxx | 7 +- .../TransformedTriangleIntersect.cxx | 4 +- src/INTERP_KERNEL/TransformedTriangleMath.cxx | 11 +- .../TranslationRotationMatrix.hxx | 16 +- .../TriangulationIntersector.hxx | 9 +- .../TriangulationIntersector.txx | 11 +- .../UnitTetraIntersectionBary.cxx | 54 +- .../VTKNormalizedUnstructuredMesh.hxx | 1 + .../VTKNormalizedUnstructuredMesh.txx | 1 + src/INTERP_KERNEL/VectorUtils.hxx | 5 +- src/INTERP_KERNEL/VolSurfFormulae.hxx | 139 +- src/INTERP_KERNEL/VolSurfUser.cxx | 42 +- src/INTERP_KERNEL/VolSurfUser.hxx | 3 +- src/INTERP_KERNEL/VolSurfUser.txx | 16 +- src/INTERP_KERNELTest/BBTreeTest.cxx | 29 +- src/INTERP_KERNELTest/BBTreeTest.hxx | 3 +- src/INTERP_KERNELTest/BasicMainTest.hxx | 7 +- src/INTERP_KERNELTest/CppUnitTest.cxx | 1 + src/INTERP_KERNELTest/CppUnitTest.hxx | 6 +- src/INTERP_KERNELTest/ExprEvalInterpTest.cxx | 34 +- src/INTERP_KERNELTest/ExprEvalInterpTest.hxx | 1 - src/INTERP_KERNELTest/HexaTests.hxx | 1 - src/INTERP_KERNELTest/Interpolation3DTest.cxx | 10 +- src/INTERP_KERNELTest/Interpolation3DTest.hxx | 4 +- .../InterpolationOptionsTest.cxx | 18 +- .../InterpolationOptionsTest.hxx | 1 - .../InterpolationPlanarTestSuite.hxx | 24 +- .../InterpolationTestSuite.hxx | 3 +- src/INTERP_KERNELTest/MEDMeshMaker.cxx | 2 - src/INTERP_KERNELTest/MeshTestToolkit.hxx | 13 +- src/INTERP_KERNELTest/MeshTestToolkit.txx | 50 +- src/INTERP_KERNELTest/MultiElement2DTests.hxx | 3 - .../MultiElement3DSurfTests.hxx | 5 +- .../MultiElementTetraTests.hxx | 1 - src/INTERP_KERNELTest/PerfTest.cxx | 8 +- .../QuadraticPlanarInterpTest.cxx | 40 +- .../QuadraticPlanarInterpTest.hxx | 2 - .../QuadraticPlanarInterpTest2.cxx | 58 +- .../QuadraticPlanarInterpTest3.cxx | 68 +- .../QuadraticPlanarInterpTest4.cxx | 87 +- .../QuadraticPlanarInterpTest5.cxx | 18 +- .../SingleElementPlanarTests.cxx | 6 +- .../SingleElementPlanarTests.hxx | 1 - .../SingleElementTetraTests.hxx | 1 - src/INTERP_KERNELTest/TestInterpKernel.cxx | 2 - .../TestInterpKernelUtils.cxx | 9 +- .../ThreeDSurfProjectionTest.cxx | 7 +- .../ThreeDSurfProjectionTest.hxx | 1 - .../TransformedTriangleIntersectTest.cxx | 47 +- .../TransformedTriangleIntersectTest.hxx | 1 - .../TransformedTriangleTest.cxx | 11 +- .../TransformedTriangleTest.hxx | 5 +- .../UnitTetra3D2DIntersectionTest.cxx | 26 +- .../UnitTetra3D2DIntersectionTest.hxx | 1 - .../UnitTetraIntersectionBaryTest.cxx | 88 +- .../UnitTetraIntersectionBaryTest.hxx | 1 - src/MEDCoupling/MCAuto.hxx | 2 +- src/MEDCoupling/MCAuto.txx | 1 - src/MEDCoupling/MCType.hxx | 1 + src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 477 +++---- src/MEDCoupling/MEDCoupling1GTUMesh.hxx | 266 ++-- src/MEDCoupling/MEDCoupling1GTUMesh.txx | 6 +- src/MEDCoupling/MEDCouplingAMRAttribute.cxx | 334 +++-- src/MEDCoupling/MEDCouplingAMRAttribute.hxx | 48 +- src/MEDCoupling/MEDCouplingCMesh.cxx | 137 +- src/MEDCoupling/MEDCouplingCMesh.hxx | 98 +- .../MEDCouplingCartesianAMRMesh.cxx | 330 ++--- .../MEDCouplingCartesianAMRMesh.hxx | 60 +- .../MEDCouplingCurveLinearMesh.cxx | 154 +- .../MEDCouplingCurveLinearMesh.hxx | 100 +- src/MEDCoupling/MEDCouplingDefinitionTime.cxx | 102 +- src/MEDCoupling/MEDCouplingDefinitionTime.hxx | 72 +- src/MEDCoupling/MEDCouplingField.cxx | 28 +- src/MEDCoupling/MEDCouplingField.hxx | 17 +- .../MEDCouplingFieldDiscretization.cxx | 530 ++++--- .../MEDCouplingFieldDiscretization.hxx | 237 ++- ...EDCouplingFieldDiscretizationOnNodesFE.cxx | 52 +- ...EDCouplingFieldDiscretizationOnNodesFE.hxx | 9 - src/MEDCoupling/MEDCouplingFieldDouble.cxx | 252 ++-- src/MEDCoupling/MEDCouplingFieldDouble.hxx | 23 +- src/MEDCoupling/MEDCouplingFieldFloat.cxx | 10 +- src/MEDCoupling/MEDCouplingFieldFloat.hxx | 10 +- src/MEDCoupling/MEDCouplingFieldInt32.cxx | 12 +- src/MEDCoupling/MEDCouplingFieldInt32.hxx | 11 +- src/MEDCoupling/MEDCouplingFieldInt64.cxx | 9 +- src/MEDCoupling/MEDCouplingFieldInt64.hxx | 10 +- src/MEDCoupling/MEDCouplingFieldOverTime.cxx | 29 +- src/MEDCoupling/MEDCouplingFieldOverTime.hxx | 18 +- src/MEDCoupling/MEDCouplingFieldT.hxx | 22 +- src/MEDCoupling/MEDCouplingFieldT.txx | 18 +- src/MEDCoupling/MEDCouplingFieldTemplate.cxx | 22 +- src/MEDCoupling/MEDCouplingFieldTemplate.hxx | 11 +- .../MEDCouplingGaussLocalization.cxx | 50 +- .../MEDCouplingGaussLocalization.hxx | 7 +- src/MEDCoupling/MEDCouplingIMesh.cxx | 161 +-- src/MEDCoupling/MEDCouplingIMesh.hxx | 94 +- src/MEDCoupling/MEDCouplingMap.cxx | 1 - src/MEDCoupling/MEDCouplingMap.hxx | 13 +- src/MEDCoupling/MEDCouplingMap.txx | 5 - .../MEDCouplingMappedExtrudedMesh.cxx | 180 ++- .../MEDCouplingMappedExtrudedMesh.hxx | 128 +- src/MEDCoupling/MEDCouplingMatrix.cxx | 18 +- src/MEDCoupling/MEDCouplingMatrix.hxx | 13 +- src/MEDCoupling/MEDCouplingMemArray.cxx | 494 ++++--- src/MEDCoupling/MEDCouplingMemArray.hxx | 228 ++- src/MEDCoupling/MEDCouplingMemArray.txx | 232 ++- src/MEDCoupling/MEDCouplingMemArrayChar.cxx | 124 +- src/MEDCoupling/MEDCouplingMemArrayFloat.cxx | 21 +- src/MEDCoupling/MEDCouplingMesh.cxx | 32 +- src/MEDCoupling/MEDCouplingMesh.hxx | 10 +- src/MEDCoupling/MEDCouplingMultiFields.cxx | 112 +- src/MEDCoupling/MEDCouplingMultiFields.hxx | 10 +- src/MEDCoupling/MEDCouplingNatureOfField.cxx | 9 +- src/MEDCoupling/MEDCouplingNatureOfField.hxx | 2 +- .../MEDCouplingNormalizedCartesianMesh.hxx | 3 +- .../MEDCouplingNormalizedCartesianMesh.txx | 2 - .../MEDCouplingNormalizedUnstructuredMesh.hxx | 3 +- .../MEDCouplingNormalizedUnstructuredMesh.txx | 23 +- src/MEDCoupling/MEDCouplingPartDefinition.cxx | 46 +- src/MEDCoupling/MEDCouplingPartDefinition.hxx | 64 +- src/MEDCoupling/MEDCouplingPointSet.cxx | 169 +-- src/MEDCoupling/MEDCouplingPointSet.hxx | 63 +- src/MEDCoupling/MEDCouplingRefCountObject.cxx | 103 +- src/MEDCoupling/MEDCouplingRefCountObject.hxx | 2 +- src/MEDCoupling/MEDCouplingRemapper.cxx | 89 +- src/MEDCoupling/MEDCouplingRemapper.hxx | 8 +- src/MEDCoupling/MEDCouplingSkyLineArray.cxx | 120 +- src/MEDCoupling/MEDCouplingSkyLineArray.hxx | 18 +- src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 239 ++-- src/MEDCoupling/MEDCouplingStructuredMesh.hxx | 55 +- .../MEDCouplingTimeDiscretization.cxx | 705 +++++---- .../MEDCouplingTimeDiscretization.hxx | 506 ++++--- .../MEDCouplingTimeDiscretization.txx | 56 +- src/MEDCoupling/MEDCouplingTimeLabel.cxx | 7 +- src/MEDCoupling/MEDCouplingTraits.cxx | 1 - src/MEDCoupling/MEDCouplingTraits.hxx | 1 + src/MEDCoupling/MEDCouplingUMesh.cxx | 1110 +++++++-------- src/MEDCoupling/MEDCouplingUMesh.hxx | 167 +-- src/MEDCoupling/MEDCouplingUMesh.txx | 4 +- src/MEDCoupling/MEDCouplingUMesh_internal.cxx | 344 ++--- src/MEDCoupling/MEDCouplingUMesh_internal.hxx | 20 +- .../MEDCouplingUMesh_intersection.cxx | 476 +++---- src/MEDCoupling/MEDCouplingVoronoi.cxx | 82 +- src/MEDCoupling/MEDCouplingVoronoi.hxx | 15 +- .../Test/MEDCouplingBasicsTest.hxx | 2 +- .../Test/MEDCouplingBasicsTest0.cxx | 53 +- .../Test/MEDCouplingBasicsTest1.cxx | 99 +- .../Test/MEDCouplingBasicsTest1.hxx | 3 +- .../Test/MEDCouplingBasicsTest2.cxx | 142 +- .../Test/MEDCouplingBasicsTest2.hxx | 3 +- .../Test/MEDCouplingBasicsTest3.cxx | 75 +- .../Test/MEDCouplingBasicsTest3.hxx | 3 +- .../Test/MEDCouplingBasicsTest4.cxx | 129 +- .../Test/MEDCouplingBasicsTest4.hxx | 3 +- .../Test/MEDCouplingBasicsTest5.cxx | 108 +- .../Test/MEDCouplingBasicsTest5.hxx | 3 +- .../Test/MEDCouplingBasicsTestData1.hxx | 2 - .../Test/MEDCouplingBasicsTestInterp.cxx | 128 +- .../Test/MEDCouplingBasicsTestInterp.hxx | 3 +- .../Test/MEDCouplingExamplesTest.cxx | 59 +- .../Test/MEDCouplingRemapperTest.cxx | 27 +- .../Test/MEDCouplingRemapperTest.hxx | 3 +- src/MEDCoupling/Test/TestMEDCoupling.cxx | 1 - .../Test/TestMEDCouplingRemapper.cxx | 1 - src/MEDCoupling_Swig/MEDCouplingCommon.i | 1 - .../MEDCouplingDataArrayTraits.hxx | 23 +- src/MEDLoader/MEDFileBasis.cxx | 2 - src/MEDLoader/MEDFileBasis.hxx | 5 +- src/MEDLoader/MEDFileBlowStrEltUp.cxx | 191 ++- src/MEDLoader/MEDFileBlowStrEltUp.hxx | 9 +- src/MEDLoader/MEDFileData.cxx | 46 +- src/MEDLoader/MEDFileData.hxx | 15 +- src/MEDLoader/MEDFileEntities.cxx | 10 +- src/MEDLoader/MEDFileEntities.hxx | 22 +- src/MEDLoader/MEDFileEquivalence.cxx | 113 +- src/MEDLoader/MEDFileEquivalence.hxx | 46 +- src/MEDLoader/MEDFileField.cxx | 324 ++--- src/MEDLoader/MEDFileField.hxx | 36 +- src/MEDLoader/MEDFileField.txx | 65 +- src/MEDLoader/MEDFileField1TS.cxx | 376 +++-- src/MEDLoader/MEDFileField1TS.hxx | 123 +- src/MEDLoader/MEDFileFieldGlobs.cxx | 205 ++- src/MEDLoader/MEDFileFieldGlobs.hxx | 16 +- src/MEDLoader/MEDFileFieldInternal.cxx | 786 +++++----- src/MEDLoader/MEDFileFieldInternal.hxx | 69 +- src/MEDLoader/MEDFileFieldMultiTS.cxx | 421 +++--- src/MEDLoader/MEDFileFieldMultiTS.hxx | 115 +- src/MEDLoader/MEDFileFieldOverView.cxx | 404 +++--- src/MEDLoader/MEDFileFieldOverView.hxx | 49 +- src/MEDLoader/MEDFileFieldVisitor.hxx | 3 +- src/MEDLoader/MEDFileJoint.cxx | 99 +- src/MEDLoader/MEDFileJoint.hxx | 33 +- src/MEDLoader/MEDFileMesh.cxx | 1266 ++++++++--------- src/MEDLoader/MEDFileMesh.hxx | 349 +++-- src/MEDLoader/MEDFileMeshElt.cxx | 101 +- src/MEDLoader/MEDFileMeshElt.hxx | 15 +- src/MEDLoader/MEDFileMeshLL.cxx | 444 +++--- src/MEDLoader/MEDFileMeshLL.hxx | 42 +- src/MEDLoader/MEDFileMeshReadSelector.cxx | 6 +- src/MEDLoader/MEDFileMeshReadSelector.hxx | 1 - src/MEDLoader/MEDFileMeshSupport.cxx | 50 +- src/MEDLoader/MEDFileMeshSupport.hxx | 17 +- src/MEDLoader/MEDFileParameter.cxx | 153 +- src/MEDLoader/MEDFileParameter.hxx | 41 +- src/MEDLoader/MEDFileSafeCaller.txx | 3 + src/MEDLoader/MEDFileStructureElement.cxx | 78 +- src/MEDLoader/MEDFileStructureElement.hxx | 36 +- src/MEDLoader/MEDFileUtilities.cxx | 30 +- src/MEDLoader/MEDFileUtilities.hxx | 4 +- src/MEDLoader/MEDFileUtilities.txx | 6 +- src/MEDLoader/MEDFilterEntity.hxx | 16 +- src/MEDLoader/MEDLoader.cxx | 380 +++-- src/MEDLoader/MEDLoader.hxx | 7 +- src/MEDLoader/MEDLoaderBase.cxx | 30 +- src/MEDLoader/MEDLoaderBase.hxx | 2 +- src/MEDLoader/MEDLoaderNS.hxx | 1 - src/MEDLoader/MEDLoaderTraits.hxx | 34 +- src/MEDLoader/MEDMESHConverterUtilities.cxx | 5 +- src/MEDLoader/MEDMESHConverterUtilities.hxx | 1 + src/MEDLoader/MeshFormatReader.cxx | 116 +- src/MEDLoader/MeshFormatReader.hxx | 15 +- src/MEDLoader/MeshFormatWriter.cxx | 217 ++- src/MEDLoader/MeshFormatWriter.hxx | 12 +- src/MEDLoader/SauvMedConvertor.cxx | 312 ++-- src/MEDLoader/SauvMedConvertor.hxx | 101 +- src/MEDLoader/SauvReader.cxx | 136 +- src/MEDLoader/SauvReader.hxx | 10 +- src/MEDLoader/SauvUtilities.hxx | 10 +- src/MEDLoader/SauvWriter.cxx | 176 ++- src/MEDLoader/SauvWriter.hxx | 8 +- src/MEDLoader/Test/MEDLoaderTest.cxx | 94 +- src/MEDLoader/Test/MEDLoaderTest.hxx | 2 - src/MEDLoader/Test/SauvLoaderTest.cxx | 51 +- src/MEDLoader/Test/SauvLoaderTest.hxx | 4 +- src/MEDLoader/Test/TestMEDLoader.cxx | 2 +- src/MEDLoader/Test/TestSauvLoader.cxx | 3 +- src/MEDLoader/libmesh5.hxx | 1 - .../MEDPARTITIONER_ConnectZone.cxx | 69 +- .../MEDPARTITIONER_ConnectZone.hxx | 3 +- src/MEDPartitioner/MEDPARTITIONER_Graph.cxx | 17 +- src/MEDPartitioner/MEDPARTITIONER_Graph.hxx | 8 +- .../MEDPARTITIONER_JointFinder.cxx | 56 +- .../MEDPARTITIONER_JointFinder.hxx | 3 +- .../MEDPARTITIONER_MEDPartitioner.cxx | 26 +- .../MEDPARTITIONER_MEDPartitioner.hxx | 4 +- .../MEDPARTITIONER_MeshCollection.cxx | 246 ++-- .../MEDPARTITIONER_MeshCollection.hxx | 7 +- .../MEDPARTITIONER_MeshCollectionDriver.cxx | 76 +- .../MEDPARTITIONER_MeshCollectionDriver.hxx | 7 +- ...RTITIONER_MeshCollectionMedAsciiDriver.cxx | 31 +- ...RTITIONER_MeshCollectionMedAsciiDriver.hxx | 7 +- ...PARTITIONER_MeshCollectionMedXmlDriver.cxx | 64 +- ...PARTITIONER_MeshCollectionMedXmlDriver.hxx | 7 +- .../MEDPARTITIONER_MetisGraph.cxx | 11 +- .../MEDPARTITIONER_MetisGraph.hxx | 6 +- .../MEDPARTITIONER_PTScotchGraph.cxx | 20 +- .../MEDPARTITIONER_PTScotchGraph.hxx | 8 +- .../MEDPARTITIONER_ParMetisGraph.cxx | 20 +- .../MEDPARTITIONER_ParMetisGraph.hxx | 6 +- .../MEDPARTITIONER_ParaDomainSelector.cxx | 60 +- .../MEDPARTITIONER_ParaDomainSelector.hxx | 2 +- .../MEDPARTITIONER_ParallelTopology.cxx | 26 +- .../MEDPARTITIONER_ParallelTopology.hxx | 80 +- .../MEDPARTITIONER_ScotchGraph.cxx | 13 +- .../MEDPARTITIONER_ScotchGraph.hxx | 6 +- .../MEDPARTITIONER_Topology.hxx | 8 +- .../MEDPARTITIONER_UserGraph.cxx | 9 +- .../MEDPARTITIONER_UserGraph.hxx | 5 +- src/MEDPartitioner/MEDPARTITIONER_Utils.cxx | 196 ++- src/MEDPartitioner/MEDPARTITIONER_Utils.hxx | 6 - .../MEDPARTITIONER_UtilsPara.cxx | 77 +- .../Test/MEDPARTITIONERTest.cxx | 84 +- .../Test/MEDPARTITIONERTest.hxx | 7 +- .../Test/MEDPARTITIONERTestPara.cxx | 26 +- .../Test/TestMEDPARTITIONER.cxx | 1 - src/MEDPartitioner/medpartitioner.cxx | 36 +- src/MEDPartitioner/medpartitioner_para.cxx | 10 +- src/ParaMEDLoader/ParaMEDFileMesh.cxx | 15 +- src/ParaMEDLoader/ParaMEDFileMesh.hxx | 14 +- src/ParaMEDLoader/ParaMEDLoader.cxx | 8 +- src/ParaMEDMEM/BlockTopology.cxx | 29 +- src/ParaMEDMEM/BlockTopology.hxx | 11 +- src/ParaMEDMEM/ByStringMPIProcessorGroup.cxx | 9 +- src/ParaMEDMEM/ByStringMPIProcessorGroup.hxx | 5 +- src/ParaMEDMEM/CommInterface.cxx | 3 - src/ParaMEDMEM/CommInterface.hxx | 11 +- src/ParaMEDMEM/ComponentTopology.cxx | 20 +- src/ParaMEDMEM/DEC.cxx | 13 +- src/ParaMEDMEM/DEC.hxx | 2 + src/ParaMEDMEM/DECOptions.hxx | 15 +- src/ParaMEDMEM/DisjointDEC.cxx | 48 +- src/ParaMEDMEM/DisjointDEC.hxx | 12 +- src/ParaMEDMEM/ElementLocator.cxx | 81 +- src/ParaMEDMEM/ElementLocator.hxx | 29 +- src/ParaMEDMEM/ExplicitCoincidentDEC.cxx | 78 +- src/ParaMEDMEM/ExplicitCoincidentDEC.hxx | 13 +- src/ParaMEDMEM/ExplicitMapping.cxx | 42 +- src/ParaMEDMEM/ExplicitMapping.hxx | 2 +- src/ParaMEDMEM/ExplicitTopology.cxx | 14 +- src/ParaMEDMEM/ExplicitTopology.hxx | 6 +- src/ParaMEDMEM/InterpKernelDEC.cxx | 46 +- src/ParaMEDMEM/InterpKernelDEC.hxx | 15 +- src/ParaMEDMEM/InterpolationMatrix.cxx | 47 +- src/ParaMEDMEM/InterpolationMatrix.hxx | 8 - src/ParaMEDMEM/LinearTimeInterpolator.cxx | 8 +- src/ParaMEDMEM/LinearTimeInterpolator.hxx | 8 +- src/ParaMEDMEM/MPIAccess/MPIAccess.cxx | 33 +- src/ParaMEDMEM/MPIAccess/MPIAccess.hxx | 12 +- src/ParaMEDMEM/MPIAccess/MPIAccessDEC.cxx | 38 +- src/ParaMEDMEM/MPIAccess/MPIAccessDEC.hxx | 8 +- src/ParaMEDMEM/MPIProcessorGroup.cxx | 11 +- src/ParaMEDMEM/MPIProcessorGroup.hxx | 20 +- src/ParaMEDMEM/MxN_Mapping.cxx | 40 +- src/ParaMEDMEM/MxN_Mapping.hxx | 4 +- src/ParaMEDMEM/NonCoincidentDEC.cxx | 15 +- src/ParaMEDMEM/NonCoincidentDEC.hxx | 5 +- src/ParaMEDMEM/OverlapDEC.cxx | 28 +- src/ParaMEDMEM/OverlapDEC.hxx | 9 +- src/ParaMEDMEM/OverlapElementLocator.cxx | 65 +- src/ParaMEDMEM/OverlapElementLocator.hxx | 17 +- src/ParaMEDMEM/OverlapInterpolationMatrix.cxx | 28 +- src/ParaMEDMEM/OverlapInterpolationMatrix.hxx | 4 +- src/ParaMEDMEM/OverlapMapping.cxx | 59 +- src/ParaMEDMEM/OverlapMapping.hxx | 4 +- src/ParaMEDMEM/ParaDataArray.cxx | 2 - src/ParaMEDMEM/ParaDataArray.hxx | 7 - src/ParaMEDMEM/ParaDataArray.txx | 8 +- src/ParaMEDMEM/ParaFIELD.cxx | 48 +- src/ParaMEDMEM/ParaGRID.cxx | 6 +- src/ParaMEDMEM/ParaGRID.hxx | 1 + src/ParaMEDMEM/ParaMESH.cxx | 13 +- src/ParaMEDMEM/ParaMESH.hxx | 4 +- src/ParaMEDMEM/ParaSkyLineArray.cxx | 13 +- src/ParaMEDMEM/ParaSkyLineArray.hxx | 8 +- src/ParaMEDMEM/ParaUMesh.cxx | 35 +- src/ParaMEDMEM/ParaUMesh.hxx | 16 +- src/ParaMEDMEM/ProcessorGroup.cxx | 2 +- src/ParaMEDMEM/ProcessorGroup.hxx | 4 +- src/ParaMEDMEM/StructuredCoincidentDEC.cxx | 48 +- src/ParaMEDMEM/StructuredCoincidentDEC.hxx | 12 +- src/ParaMEDMEM/TimeInterpolator.cxx | 3 +- src/ParaMEDMEM/TimeInterpolator.hxx | 3 + src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx | 9 +- src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx | 4 +- src/RENUMBER/RENUMBER_METISRenumbering.cxx | 6 +- src/RENUMBER/RENUMBER_METISRenumbering.hxx | 4 +- src/RENUMBER/RENUMBER_Renumbering.hxx | 4 +- src/RENUMBER/RenumberingFactory.cxx | 5 +- src/RENUMBER/RenumberingFactory.hxx | 1 - src/RENUMBER/renumbering.cxx | 29 +- 557 files changed, 12652 insertions(+), 14588 deletions(-) delete mode 100644 .clang-tidy mode change 100644 => 100755 src/INTERP_KERNEL/BBTreeDst.txx mode change 100644 => 100755 src/INTERP_KERNEL/IntegralUniformIntersector.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation1D0D.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation2D1D.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation2D3D.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation3D.hxx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation3D.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation3D1D.hxx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation3D1D.txx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationCurve.hxx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationCurve.txx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationHelper.txx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationPlanar.hxx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationPlanar.txx mode change 100644 => 100755 src/INTERP_KERNEL/MeshElement.txx mode change 100644 => 100755 src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx mode change 100644 => 100755 src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx mode change 100644 => 100755 src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx mode change 100644 => 100755 src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingAMRAttribute.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingCMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingFieldDiscretization.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingFieldDiscretizationOnNodesFE.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingFieldDouble.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingIMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMatrix.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMemArray.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMemArray.hxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMemArray.txx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMemArrayChar.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingPointSet.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingRemapper.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingSkyLineArray.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingStructuredMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingUMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingUMesh_internal.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingVoronoi.cxx diff --git a/.clang-tidy b/.clang-tidy deleted file mode 100644 index a42aee021..000000000 --- a/.clang-tidy +++ /dev/null @@ -1,32 +0,0 @@ ---- -Checks: -*,clang-diagnostic-*,-clang-diagnostic-sign-conversion,clang-analyzer-*,modernize-use-override,modernize-use-nullptr,modernize-use-default-member-init,modernize-loop-convert,modernize-use-auto,modernize-redundant-void-arg,modernize-type-traits,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,misc-const-correctness,misc-unused-parameters,misc-definitions-in-headers,misc-header-include-cycle,misc-redundant-expression,misc-static-assert -WarningsAsErrors: '' -HeaderFileExtensions: - - '' - - h - - hh - - hpp - - hxx - - txx -ImplementationFileExtensions: - - c - - cc - - cpp - - cxx -HeaderFilterRegex: '' -FormatStyle: none -CheckOptions: - cert-dcl16-c.NewSuffixes: L;LL;LU;LLU - cert-err33-c.AllowCastToVoid: 'true' - cert-err33-c.CheckedFunctions: ::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s; - cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false' - cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false' - cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true' - google-readability-braces-around-statements.ShortStatementLines: '1' - google-readability-function-size.StatementThreshold: '800' - google-readability-namespace-comments.ShortNamespaceLines: '10' - google-readability-namespace-comments.SpacesBeforeComments: '2' - llvm-else-after-return.WarnOnConditionVariables: 'false' - llvm-else-after-return.WarnOnUnfixable: 'false' - llvm-qualified-auto.AddConstToQualified: 'false' -SystemHeaders: false diff --git a/src/ICoCo/ICoCoMEDDoubleField.cxx b/src/ICoCo/ICoCoMEDDoubleField.cxx index 913240c5f..d408e30bb 100644 --- a/src/ICoCo/ICoCoMEDDoubleField.cxx +++ b/src/ICoCo/ICoCoMEDDoubleField.cxx @@ -22,7 +22,7 @@ namespace ICoCo { - MEDDoubleField::MEDDoubleField() : _field(nullptr) {} + MEDDoubleField::MEDDoubleField() : _field(0) {} MEDDoubleField::MEDDoubleField(MEDCoupling::MEDCouplingFieldDouble *field):_field(field) { diff --git a/src/ICoCo/ICoCoMEDDoubleField.hxx b/src/ICoCo/ICoCoMEDDoubleField.hxx index ee0e3d19b..d316e9dfe 100644 --- a/src/ICoCo/ICoCoMEDDoubleField.hxx +++ b/src/ICoCo/ICoCoMEDDoubleField.hxx @@ -26,7 +26,6 @@ #define ICoCoMEDDoubleField_included #include "ICoCoField.hxx" -#include "ICoCo_DeclSpec.hxx" namespace MEDCoupling { @@ -73,7 +72,7 @@ namespace ICoCo /*! @brief Destructor. */ - ~MEDDoubleField() override; + virtual ~MEDDoubleField(); /*! @brief Get the internal MEDCoupling field object. * @return a pointer to the MEDCouplingField object detained by this instance. Note that the corresponding diff --git a/src/ICoCo/ICoCoMEDIntField.cxx b/src/ICoCo/ICoCoMEDIntField.cxx index 472b23e27..32dfc2d47 100644 --- a/src/ICoCo/ICoCoMEDIntField.cxx +++ b/src/ICoCo/ICoCoMEDIntField.cxx @@ -18,13 +18,12 @@ // #include "ICoCoMEDIntField.h" -#include "ICoCoMEDIntField.hxx" #include "MEDCouplingFieldInt32.hxx" namespace ICoCo { - MEDIntField::MEDIntField() : _field(nullptr) {} + MEDIntField::MEDIntField() : _field(0) {} /*! Constructor directly attaching a MEDCouplingFieldInt the object does not take the control the objects pointed by diff --git a/src/ICoCo/ICoCoMEDIntField.hxx b/src/ICoCo/ICoCoMEDIntField.hxx index ff76d3293..d0ab9f8c4 100644 --- a/src/ICoCo/ICoCoMEDIntField.hxx +++ b/src/ICoCo/ICoCoMEDIntField.hxx @@ -26,7 +26,6 @@ #define ICoCoMEDIntField_included #include "ICoCoField.hxx" -#include "ICoCo_DeclSpec.hxx" namespace MEDCoupling { @@ -73,7 +72,7 @@ namespace ICoCo /*! @brief Destructor. */ - ~MEDIntField() override; + virtual ~MEDIntField(); /*! @brief Get the internal MEDCoupling field object. * @return a pointer to the MEDCouplingField object detained by this instance. Note that the corresponding diff --git a/src/INTERP_KERNEL/BBTree.txx b/src/INTERP_KERNEL/BBTree.txx index 27163c7c8..f837e2a48 100644 --- a/src/INTERP_KERNEL/BBTree.txx +++ b/src/INTERP_KERNEL/BBTree.txx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/src/INTERP_KERNEL/BBTreeDst.txx b/src/INTERP_KERNEL/BBTreeDst.txx old mode 100644 new mode 100755 index 0e656d4bb..c09cdf9c2 --- a/src/INTERP_KERNEL/BBTreeDst.txx +++ b/src/INTERP_KERNEL/BBTreeDst.txx @@ -21,14 +21,13 @@ #ifndef __BBTREEDST_TXX__ #define __BBTREEDST_TXX__ -#include #include +#include +#include #include #include -#include "MCIdType.hxx" - template class BBTreeDst { @@ -40,14 +39,14 @@ private: double _min_right; const double *_bb; std::vector _elems; - double *_terminal{nullptr}; + double *_terminal; mcIdType _nbelems; static const int MIN_NB_ELEMS=15; static const int MAX_LEVEL=20; public: BBTreeDst(const double* bbs, mcIdType* elems, int level, mcIdType nbelems): - _left(0),_right(0),_level(level),_bb(bbs),_nbelems(nbelems) + _left(0),_right(0),_level(level),_bb(bbs),_terminal(0),_nbelems(nbelems) { if((nbelems < MIN_NB_ELEMS || level> MAX_LEVEL)) _terminal=new double[2*dim]; @@ -59,11 +58,11 @@ public: fillBBoxTerminal(bbs); return ; } - auto *nodes=new double[nbelems]; + double *nodes=new double[nbelems]; for (mcIdType i=0; i(nodes, nodes+nbelems/2, nodes+nbelems); - double const median = *(nodes+nbelems/2); + double median = *(nodes+nbelems/2); delete [] nodes; std::vector new_elems_left; std::vector new_elems_right; @@ -75,7 +74,7 @@ public: for(mcIdType i=0; iminOfMaxDsts) { _left->getElemsWhoseMinDistanceToPtSmallerThan(pt,minOfMaxDstsSq,elems); return ; } if(pt[_level%dim]-_max_left>minOfMaxDsts) @@ -152,7 +151,7 @@ public: } else { - double const minOfMaxDsts=sqrt(minOfMaxDstsSq); + double minOfMaxDsts=sqrt(minOfMaxDstsSq); if(_min_right-pt[_level%dim]>minOfMaxDsts) { _left->getMinDistanceOfMax(pt,minOfMaxDstsSq); return ; } if(pt[_level%dim]-_max_left>minOfMaxDsts) @@ -187,7 +186,7 @@ public: for (int idim=0; idim((( (0.((( (0. #include +#include #include #include @@ -65,7 +66,7 @@ public: BBTreePts(const double *pts, const ConnType *elems, int level, ConnType nbelems, double epsilon=1e-12): _left(0),_right(0),_level(level),_pts(pts),_terminal(nbelems < MIN_NB_ELEMS || level> MAX_LEVEL),_nbelems(nbelems),_epsilon(std::abs(epsilon)) { - auto *nodes=new double[nbelems]; + double *nodes=new double[nbelems]; _elems.resize(nbelems); for (ConnType i=0;i -#include -#include /*! * Wrapper over BBTree to deal with ownership of bbox double array. diff --git a/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.hxx b/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.hxx index e945ffb3d..93dc670b4 100644 --- a/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.hxx @@ -23,7 +23,6 @@ #include "Intersector3DP1P1.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +32,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: Barycentric3DIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, double precision); diff --git a/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx b/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx index 4019faeff..b58a279ae 100644 --- a/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx @@ -23,14 +23,7 @@ #include "Barycentric3DIntersectorP1P1.hxx" #include "Intersector3DP1P1.txx" -#include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" -#include -#include -#include "NormalizedGeometricTypes" -#include -#include "CellModel.hxx" -#include "PointLocatorAlgos.txx" +#include "MeshUtils.hxx" namespace INTERP_KERNEL { @@ -49,7 +42,8 @@ namespace INTERP_KERNEL template Barycentric3DIntersectorP1P1::~Barycentric3DIntersectorP1P1() - = default; + { + } /** * @param targetCell in C mode. diff --git a/src/INTERP_KERNEL/Bases/InterpKernelAssert.hxx b/src/INTERP_KERNEL/Bases/InterpKernelAssert.hxx index a3b31d42b..e59519ce7 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelAssert.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelAssert.hxx @@ -21,7 +21,9 @@ #ifndef __INTERPKERNELASSERT_HXX__ #define __INTERPKERNELASSERT_HXX__ +#include "InterpKernelException.hxx" +#include #define IKAssert(a) { bool verdict(a); \ if(!verdict) { std::ostringstream osszz; osszz << "Assertion \"" << #a << "\" failed into " << __FILE__ << " at line " << __LINE__ << " !"; throw INTERP_KERNEL::Exception(osszz.str()); } } diff --git a/src/INTERP_KERNEL/Bases/InterpKernelException.cxx b/src/INTERP_KERNEL/Bases/InterpKernelException.cxx index 836190715..0d6d7adca 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelException.cxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelException.cxx @@ -28,12 +28,13 @@ INTERP_KERNEL::Exception::Exception(const std::string& reason):_reason(reason) { } -INTERP_KERNEL::Exception::Exception(const char *reason, const char * /*file*/, int /*line*/):_reason(reason) +INTERP_KERNEL::Exception::Exception(const char *reason, const char *file, int line):_reason(reason) { } INTERP_KERNEL::Exception::~Exception() noexcept(true) -= default; +{ +} const char *INTERP_KERNEL::Exception::what() const noexcept(true) { diff --git a/src/INTERP_KERNEL/Bases/InterpKernelException.hxx b/src/INTERP_KERNEL/Bases/InterpKernelException.hxx index 3eeab812d..1d6ce7d7c 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelException.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelException.hxx @@ -35,8 +35,8 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT Exception(const char *reason); INTERPKERNEL_EXPORT Exception(const std::string& reason); INTERPKERNEL_EXPORT Exception(const char *reason, const char *file, int line); - INTERPKERNEL_EXPORT ~Exception() noexcept(true) override; - INTERPKERNEL_EXPORT const char *what() const noexcept(true) override; + INTERPKERNEL_EXPORT ~Exception() noexcept(true); + INTERPKERNEL_EXPORT const char *what() const noexcept(true); protected: std::string _reason; }; diff --git a/src/INTERP_KERNEL/Bases/InterpKernelHashMap.hxx b/src/INTERP_KERNEL/Bases/InterpKernelHashMap.hxx index 212e701a1..e4fc93c81 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelHashMap.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelHashMap.hxx @@ -48,13 +48,8 @@ #ifndef __INTERPKERNELHASHMAP__ #define __INTERPKERNELHASHMAP__ -#include "InterpKernelHashFun.hxx" #include "InterpKernelStlExt.hxx" #include "InterpKernelHashTable.hxx" -#include -#include -#include -#include namespace INTERP_KERNEL { @@ -63,29 +58,31 @@ namespace INTERP_KERNEL class HashMap { private: - using _Ht = hashtable, _Key, _HashFn, STLEXT::Select1st>, _EqualKey, _Alloc>; + typedef hashtable,_Key, _HashFn, + STLEXT::Select1st >, + _EqualKey, _Alloc> _Ht; _Ht _M_ht; public: - using key_type = typename _Ht::key_type; - using data_type = _Tp; - using mapped_type = _Tp; - using value_type = typename _Ht::value_type; - using hasher = typename _Ht::hasher; - using key_equal = typename _Ht::key_equal; - - using size_type = typename _Ht::size_type; - using difference_type = typename _Ht::difference_type; - using pointer = typename _Ht::pointer; - using const_pointer = typename _Ht::const_pointer; - using reference = typename _Ht::reference; - using const_reference = typename _Ht::const_reference; - - using iterator = typename _Ht::iterator; - using const_iterator = typename _Ht::const_iterator; - - using allocator_type = typename _Ht::allocator_type; + typedef typename _Ht::key_type key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } @@ -200,27 +197,29 @@ namespace INTERP_KERNEL class HashMultiMap { private: - using _Ht = hashtable, _Key, _HashFn, STLEXT::Select1st>, _EqualKey, _Alloc>; + typedef hashtable, _Key, _HashFn, + STLEXT::Select1st >, _EqualKey, _Alloc> + _Ht; _Ht _M_ht; public: - using key_type = typename _Ht::key_type; - using data_type = _Tp; - using mapped_type = _Tp; - using value_type = typename _Ht::value_type; - using hasher = typename _Ht::hasher; - using key_equal = typename _Ht::key_equal; - - using size_type = typename _Ht::size_type; - using difference_type = typename _Ht::difference_type; - using pointer = typename _Ht::pointer; - using const_pointer = typename _Ht::const_pointer; - using reference = typename _Ht::reference; - using const_reference = typename _Ht::const_reference; - - using iterator = typename _Ht::iterator; - using const_iterator = typename _Ht::const_iterator; - - using allocator_type = typename _Ht::allocator_type; + typedef typename _Ht::key_type key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } @@ -337,15 +336,16 @@ namespace std _EqKey, _Alloc> > { protected: - using _Container = INTERP_KERNEL::HashMap<_Key, _Tp, _HashFn, _EqKey, _Alloc>; + typedef INTERP_KERNEL::HashMap<_Key, _Tp, _HashFn, _EqKey, _Alloc> + _Container; _Container* container; public: - using container_type = _Container; - using iterator_category = output_iterator_tag; - using value_type = void; - using difference_type = void; - using pointer = void; - using reference = void; + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} @@ -369,17 +369,18 @@ namespace std _EqKey, _Alloc> > { protected: - using _Container = INTERP_KERNEL::HashMultiMap<_Key, _Tp, _HashFn, _EqKey, _Alloc>; + typedef INTERP_KERNEL::HashMultiMap<_Key, _Tp, _HashFn, _EqKey, _Alloc> + _Container; _Container* container; typename _Container::iterator iter; public: - using container_type = _Container; - using iterator_category = output_iterator_tag; - using value_type = void; - using difference_type = void; - using pointer = void; - using reference = void; + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} diff --git a/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx b/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx index 2238fd98d..5659e8e7c 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx @@ -49,13 +49,13 @@ #ifndef __INTERPKERNELHASHTABLE_HXX__ #define __INTERPKERNELHASHTABLE_HXX__ +#include "InterpKernelStlExt.hxx" +#include "InterpKernelHashFun.hxx" -#include -#include -#include #include #include #include +#include namespace INTERP_KERNEL { @@ -82,16 +82,21 @@ namespace INTERP_KERNEL class _ExtractKey, class _EqualKey, class _Alloc> struct _Hashtable_iterator { - using _Hashtable = hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; - using iterator = _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; - using const_iterator = _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; - using _Node = _Hashtable_node<_Val>; - using iterator_category = std::forward_iterator_tag; - using value_type = _Val; - using difference_type = std::ptrdiff_t; - using size_type = std::size_t; - using reference = _Val &; - using pointer = _Val *; + typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> + _Hashtable; + typedef _Hashtable_iterator<_Val, _Key, _HashFcn, + _ExtractKey, _EqualKey, _Alloc> + iterator; + typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, + _ExtractKey, _EqualKey, _Alloc> + const_iterator; + typedef _Hashtable_node<_Val> _Node; + typedef std::forward_iterator_tag iterator_category; + typedef _Val value_type; + typedef std::ptrdiff_t difference_type; + typedef std::size_t size_type; + typedef _Val& reference; + typedef _Val* pointer; _Node* _M_cur; _Hashtable* _M_ht; @@ -99,7 +104,7 @@ namespace INTERP_KERNEL _Hashtable_iterator(_Node* __n, _Hashtable* __tab) : _M_cur(__n), _M_ht(__tab) { } - _Hashtable_iterator() = default; + _Hashtable_iterator() { } reference operator*() const @@ -128,17 +133,22 @@ namespace INTERP_KERNEL class _ExtractKey, class _EqualKey, class _Alloc> struct _Hashtable_const_iterator { - using _Hashtable = hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; - using iterator = _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; - using const_iterator = _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; - using _Node = _Hashtable_node<_Val>; - - using iterator_category = std::forward_iterator_tag; - using value_type = _Val; - using difference_type = std::ptrdiff_t; - using size_type = std::size_t; - using reference = const _Val &; - using pointer = const _Val *; + typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> + _Hashtable; + typedef _Hashtable_iterator<_Val,_Key,_HashFcn, + _ExtractKey,_EqualKey,_Alloc> + iterator; + typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, + _ExtractKey, _EqualKey, _Alloc> + const_iterator; + typedef _Hashtable_node<_Val> _Node; + + typedef std::forward_iterator_tag iterator_category; + typedef _Val value_type; + typedef std::ptrdiff_t difference_type; + typedef std::size_t size_type; + typedef const _Val& reference; + typedef const _Val* pointer; const _Node* _M_cur; const _Hashtable* _M_ht; @@ -146,7 +156,7 @@ namespace INTERP_KERNEL _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab) : _M_cur(__n), _M_ht(__tab) { } - _Hashtable_const_iterator() = default; + _Hashtable_const_iterator() { } _Hashtable_const_iterator(const iterator& __it) : _M_cur(__it._M_cur), _M_ht(__it._M_ht) { } @@ -209,33 +219,33 @@ namespace INTERP_KERNEL class hashtable { public: - using key_type = _Key; - using value_type = _Val; - using hasher = _HashFcn; - using key_equal = _EqualKey; - - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - using pointer = value_type *; - using const_pointer = const value_type *; - using reference = value_type &; - using const_reference = const value_type &; + typedef _Key key_type; + typedef _Val value_type; + typedef _HashFcn hasher; + typedef _EqualKey key_equal; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; hasher hash_funct() const { return _M_hash; } key_equal key_eq() const { return _M_equals; } private: - using _Node = _Hashtable_node<_Val>; + typedef _Hashtable_node<_Val> _Node; public: - using allocator_type = typename _Alloc::template rebind::other; + typedef typename _Alloc::template rebind::other allocator_type; allocator_type get_allocator() const { return _M_node_allocator; } private: - using _Node_Alloc = typename _Alloc::template rebind<_Node>::other; - using _Nodeptr_Alloc = typename _Alloc::template rebind<_Node *>::other; - using _Vector_type = std::vector<_Node *, _Nodeptr_Alloc>; + typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc; + typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc; + typedef std::vector<_Node*, _Nodeptr_Alloc> _Vector_type; _Node_Alloc _M_node_allocator; @@ -251,8 +261,12 @@ namespace INTERP_KERNEL size_type _M_num_elements; public: - using iterator = _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; - using const_iterator = _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; + typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, + _EqualKey, _Alloc> + iterator; + typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, + _EqualKey, _Alloc> + const_iterator; friend struct _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; diff --git a/src/INTERP_KERNEL/Bases/InterpKernelStlExt.hxx b/src/INTERP_KERNEL/Bases/InterpKernelStlExt.hxx index b790907cf..cf4d3b019 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelStlExt.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelStlExt.hxx @@ -20,6 +20,7 @@ #ifndef __INTERPKERNELSTLEXT_HXX__ #define __INTERPKERNELSTLEXT_HXX__ +#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/Bases/NormalizedUnstructuredMesh.hxx b/src/INTERP_KERNEL/Bases/NormalizedUnstructuredMesh.hxx index 0ee8dcc02..91bee1d18 100644 --- a/src/INTERP_KERNEL/Bases/NormalizedUnstructuredMesh.hxx +++ b/src/INTERP_KERNEL/Bases/NormalizedUnstructuredMesh.hxx @@ -21,6 +21,7 @@ #ifndef __NORMALIZEDUNSTRUCTUREDMESH_HXX__ #define __NORMALIZEDUNSTRUCTUREDMESH_HXX__ +#include "NormalizedGeometricTypes" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/BoundingBox.hxx b/src/INTERP_KERNEL/BoundingBox.hxx index 63685fe9b..b3c9f0d9f 100644 --- a/src/INTERP_KERNEL/BoundingBox.hxx +++ b/src/INTERP_KERNEL/BoundingBox.hxx @@ -36,13 +36,13 @@ namespace INTERP_KERNEL /// Enumeration representing the six coordinates that define the bounding box enum BoxCoord { XMIN = 0, YMIN = 1, ZMIN = 2, XMAX = 3, YMAX = 4, ZMAX = 5 }; - BoundingBox() = default; + BoundingBox() { } BoundingBox(const double** pts, const unsigned numPts); BoundingBox(const BoundingBox& box1, const BoundingBox& box2); - ~BoundingBox() = default; + ~BoundingBox() { } void fillInXMinXmaxYminYmaxZminZmaxFormat(double data[6]) const; diff --git a/src/INTERP_KERNEL/BoxSplittingOptions.cxx b/src/INTERP_KERNEL/BoxSplittingOptions.cxx index e5929de94..e3337f4a1 100644 --- a/src/INTERP_KERNEL/BoxSplittingOptions.cxx +++ b/src/INTERP_KERNEL/BoxSplittingOptions.cxx @@ -20,9 +20,7 @@ #include "BoxSplittingOptions.hxx" -#include #include -#include const double INTERP_KERNEL::BoxSplittingOptions::DFT_EFFICIENCY_GOAL=0.5; diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index cdd0708ef..6fb951a09 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -22,16 +22,10 @@ #include "InterpKernelException.hxx" #include "DiameterCalculator.hxx" -#include "NormalizedGeometricTypes" -#include "MCIdType.hxx" #include "OrientationInverter.hxx" #include -#include -#include -#include #include -#include #include #include @@ -492,7 +486,7 @@ namespace INTERP_KERNEL */ unsigned CellModel::getNumberOfMicroEdges() const { - unsigned const mul(isQuadratic()?2:1); + unsigned mul(isQuadratic()?2:1); if(!isDynamic()) { switch(getDimension()) @@ -564,7 +558,7 @@ namespace INTERP_KERNEL */ unsigned CellModel::fillSonCellNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn) const { - unsigned const nbOfTurnLoop=_nb_of_sons_con[sonId]; + unsigned nbOfTurnLoop=_nb_of_sons_con[sonId]; const unsigned *sonConn=_sons_con[sonId]; for(unsigned i=0;i tmp0(sz2-1),tmp1(sz2); std::copy(nodalConn+1,nodalConn+sz2,tmp0.rbegin()); std::copy(nodalConn+sz2,nodalConn+sz,tmp1.rbegin()); @@ -785,14 +779,14 @@ namespace INTERP_KERNEL if(!_quadratic) { std::vector tmp(2*lgth); - auto it=std::copy(conn1,conn1+lgth,tmp.begin()); + std::vector::iterator it=std::copy(conn1,conn1+lgth,tmp.begin()); std::copy(conn1,conn1+lgth,it); it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth); if(it==tmp.begin()) return true; if(it!=tmp.end()) return _dim!=1; - auto const it2=std::search(tmp.rbegin(),tmp.rend(),conn2,conn2+lgth); + std::vector::reverse_iterator it2=std::search(tmp.rbegin(),tmp.rend(),conn2,conn2+lgth); if(it2!=tmp.rend()) return false; throw INTERP_KERNEL::Exception("CellModel::getOrientationStatus : Request of orientation status of non equal connectively cells !"); @@ -802,10 +796,10 @@ namespace INTERP_KERNEL if(_dim!=1) { std::vector tmp(lgth); - auto it=std::copy(conn1,conn1+lgth/2,tmp.begin()); + std::vector::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin()); std::copy(conn1,conn1+lgth/2,it); it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth/2); - std::size_t const d=std::distance(tmp.begin(),it); + std::size_t d=std::distance(tmp.begin(),it); if(it==tmp.end()) return false; it=std::copy(conn1+lgth/2,conn1+lgth,tmp.begin()); @@ -813,17 +807,17 @@ namespace INTERP_KERNEL it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth); if(it==tmp.end()) return false; - std::size_t const d2=std::distance(tmp.begin(),it); + std::size_t d2=std::distance(tmp.begin(),it); return d==d2; } else { - mcIdType const p=(lgth+1)/2; + mcIdType p=(lgth+1)/2; std::vector tmp(2*p); - auto it=std::copy(conn1,conn1+p,tmp.begin()); + std::vector::iterator it=std::copy(conn1,conn1+p,tmp.begin()); std::copy(conn1,conn1+p,it); it=std::search(tmp.begin(),tmp.end(),conn2,conn2+p); - std::size_t const d=std::distance(tmp.begin(),it); + std::size_t d=std::distance(tmp.begin(),it); if(it==tmp.end()) return false; tmp.resize(2*p-2); @@ -832,7 +826,7 @@ namespace INTERP_KERNEL it=std::search(tmp.begin(),tmp.end(),conn2+p,conn2+lgth); if(it==tmp.end()) return false; - std::size_t const d2=std::distance(tmp.begin(),it); + std::size_t d2=std::distance(tmp.begin(),it); return d==d2; } } diff --git a/src/INTERP_KERNEL/CellModel.hxx b/src/INTERP_KERNEL/CellModel.hxx index 6d54e575f..584783cc2 100644 --- a/src/INTERP_KERNEL/CellModel.hxx +++ b/src/INTERP_KERNEL/CellModel.hxx @@ -23,7 +23,7 @@ #include "INTERPKERNELDefines.hxx" -#include "NormalizedGeometricTypes" +#include "NormalizedUnstructuredMesh.hxx" #include "MCIdType.hxx" #include diff --git a/src/INTERP_KERNEL/ConvexIntersector.hxx b/src/INTERP_KERNEL/ConvexIntersector.hxx index 1e1b230f7..18459c5f2 100644 --- a/src/INTERP_KERNEL/ConvexIntersector.hxx +++ b/src/INTERP_KERNEL/ConvexIntersector.hxx @@ -21,8 +21,12 @@ #ifndef __CONVEXINTERSECTOR_HXX__ #define __CONVEXINTERSECTOR_HXX__ -#include "NormalizedUnstructuredMesh.hxx" -#include +#include "PlanarIntersectorP0P0.hxx" +#include "PlanarIntersectorP0P1.hxx" +#include "PlanarIntersectorP1P0.hxx" +#include "PlanarIntersectorP1P1.hxx" +#include "PlanarIntersectorP1P0Bary.hxx" +#include "PlanarIntersectorP0P1Bary.hxx" namespace INTERP_KERNEL { @@ -32,7 +36,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: ConvexIntersector(const MyMeshType& meshT, const MyMeshType& meshS, diff --git a/src/INTERP_KERNEL/ConvexIntersector.txx b/src/INTERP_KERNEL/ConvexIntersector.txx index fdc98317a..46031c4f3 100644 --- a/src/INTERP_KERNEL/ConvexIntersector.txx +++ b/src/INTERP_KERNEL/ConvexIntersector.txx @@ -21,7 +21,6 @@ #define __CONVEXINTERSECTOR_TXX__ #include "ConvexIntersector.hxx" -#include "PlanarIntersector.txx" #include "PlanarIntersectorP0P0.txx" #include "PlanarIntersectorP0P1.txx" #include "PlanarIntersectorP1P0.txx" @@ -30,12 +29,8 @@ #include "PlanarIntersectorP0P1Bary.txx" #include "PolygonAlgorithms.txx" -#include "InterpolationUtils.hxx" -#include #include -#include -#include #define CONVINTERSECTOR_TEMPLATE template class InterpType> #define CONVEX_INTERSECTOR_ ConvexIntersector @@ -97,7 +92,7 @@ namespace INTERP_KERNEL CONVINTERSECTOR_TEMPLATE double CONVEX_INTERSECTOR_::intersectGeometryWithQuadrangle(const double * quadrangle, const std::vector& sourceCoords, - bool /*isSourceQuad*/) + bool isSourceQuad) { double result = 0; int nbOfNodesS=int(sourceCoords.size())/SPACEDIM; @@ -159,7 +154,7 @@ namespace INTERP_KERNEL CONVINTERSECTOR_TEMPLATE double CONVEX_INTERSECTOR_::intersectGeoBary(const std::vector& targetCell, - bool /*targetCellQuadratic*/, + bool targetCellQuadratic, const double * sourceTria, std::vector& res) { diff --git a/src/INTERP_KERNEL/CurveIntersector.hxx b/src/INTERP_KERNEL/CurveIntersector.hxx index ff81860d6..83cf97a1d 100644 --- a/src/INTERP_KERNEL/CurveIntersector.hxx +++ b/src/INTERP_KERNEL/CurveIntersector.hxx @@ -23,7 +23,6 @@ #include "TargetIntersector.txx" #include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/CurveIntersector.txx b/src/INTERP_KERNEL/CurveIntersector.txx index a2965ffff..2864e7f8f 100644 --- a/src/INTERP_KERNEL/CurveIntersector.txx +++ b/src/INTERP_KERNEL/CurveIntersector.txx @@ -22,16 +22,9 @@ #include "CurveIntersector.hxx" #include "InterpolationUtils.hxx" -#include "MCIdType.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "NormalizedGeometricTypes" #include "PointLocatorAlgos.txx" -#include -#include #include -#include -#include namespace INTERP_KERNEL { @@ -61,7 +54,8 @@ namespace INTERP_KERNEL template CurveIntersector::~CurveIntersector() - = default; + { + } //================================================================================ /*! @@ -99,7 +93,7 @@ namespace INTERP_KERNEL ::coo2C(conn[OTT::conn2C(conn_index[icell]+j)]); for(int idim=0; idim::coo2C(conn[OTT::conn2C(conn_index[OTT::ind2C(iP)]+i)])); for(int idim=0; idimbb[2*idim+1]) ? x : bb[2*idim+1]; } @@ -151,7 +145,7 @@ namespace INTERP_KERNEL template void CurveIntersector::ComputeBaryCoordsOf(double startOfSeg, double endOfSeg, double pt, double& startPos, double& endPos) { - double const deno(endOfSeg-startOfSeg); + double deno(endOfSeg-startOfSeg); startPos = (endOfSeg-pt)/deno; startPos = std::max(startPos,0.); startPos = std::min(startPos,1.); endPos=1.-startPos; @@ -362,8 +356,8 @@ namespace INTERP_KERNEL double t0s1[2] = { s1[X]-t0[X], s1[Y]-t0[Y] }; double nt01_x_t0s0 = t0s0[X] * t01[Y] - t0s0[Y] * t01[X]; // t0s0 dot norm of t01 double nt01_x_t0s1 = t0s1[X] * t01[Y] - t0s1[Y] * t01[X]; // t0s1 dot norm of t01 - double const dist_ts0 = fabs( nt01_x_t0s0 ); // dist from tgt seg to s0 - double const dist_ts1 = fabs( nt01_x_t0s1 ); // dist from tgt seg to s1 + double dist_ts0 = fabs( nt01_x_t0s0 ); // dist from tgt seg to s0 + double dist_ts1 = fabs( nt01_x_t0s1 ); // dist from tgt seg to s1 bool s0_out_of_tol = ( dist_ts0 > _tolerance ); bool s1_out_of_tol = ( dist_ts1 > _tolerance ); if ( nt01_x_t0s0 * nt01_x_t0s1 > 0 && ( s0_out_of_tol || s1_out_of_tol )) @@ -429,8 +423,8 @@ namespace INTERP_KERNEL if ( xt0 > xt1 ) std::swap( xt0, xt1 ); if ( xs0 > xs1 ) std::swap( xs0, xs1 ); - double const x0 = std::max( xt0, xs0 ); - double const x1 = std::min( xt1, xs1 ); + double x0 = std::max( xt0, xs0 ); + double x1 = std::min( xt1, xs1 ); return ( x0 < x1 ) ? ( x1 - x0 ) : 0.; } @@ -440,7 +434,7 @@ namespace INTERP_KERNEL public: static const int MY_SPACEDIM=1; static const int MY_MESHDIM=8; - using MyConnType = mcIdType; + typedef mcIdType MyConnType; static const INTERP_KERNEL::NumberingPolicy My_numPol=MyMeshType::My_numPol; // begin // useless, but for windows compilation ... diff --git a/src/INTERP_KERNEL/CurveIntersectorP0P0.hxx b/src/INTERP_KERNEL/CurveIntersectorP0P0.hxx index 052d2af34..6d02dfea7 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP0P0.hxx +++ b/src/INTERP_KERNEL/CurveIntersectorP0P0.hxx @@ -22,8 +22,6 @@ #define __CURVEINTERSECTORP0P0_HXX__ #include "CurveIntersector.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; CurveIntersectorP0P0(const MyMeshType& meshT, const MyMeshType& meshS, diff --git a/src/INTERP_KERNEL/CurveIntersectorP0P0.txx b/src/INTERP_KERNEL/CurveIntersectorP0P0.txx index 3475f7b8f..e29648f5a 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP0P0.txx @@ -20,10 +20,8 @@ #ifndef __CURVEINTERSECTORP0P0_TXX__ #define __CURVEINTERSECTORP0P0_TXX__ -#include "CurveIntersector.hxx" #include "CurveIntersectorP0P0.hxx" -#include -#include "InterpolationUtils.hxx" +#include "CurveIntersector.txx" #define BASE_INTERSECTOR CurveIntersector diff --git a/src/INTERP_KERNEL/CurveIntersectorP0P1.hxx b/src/INTERP_KERNEL/CurveIntersectorP0P1.hxx index eb0244220..01f895550 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP0P1.hxx +++ b/src/INTERP_KERNEL/CurveIntersectorP0P1.hxx @@ -22,8 +22,6 @@ #define __CURVEINTERSECTORP0P1_HXX__ #include "CurveIntersector.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; CurveIntersectorP0P1(const MyMeshType& meshT, const MyMeshType& meshS, diff --git a/src/INTERP_KERNEL/CurveIntersectorP0P1.txx b/src/INTERP_KERNEL/CurveIntersectorP0P1.txx index 3aac3c26e..474a8c2c1 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP0P1.txx @@ -20,10 +20,8 @@ #ifndef __CurveIntersectorP0P1_TXX__ #define __CurveIntersectorP0P1_TXX__ -#include "CurveIntersector.hxx" #include "CurveIntersectorP0P1.hxx" -#include -#include "InterpolationUtils.hxx" +#include "CurveIntersector.txx" #define BASE_INTERSECTOR CurveIntersector diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P0.hxx b/src/INTERP_KERNEL/CurveIntersectorP1P0.hxx index 00c02bfdc..824ca46cc 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P0.hxx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P0.hxx @@ -22,8 +22,6 @@ #define __CURVEINTERSECTORP1P0_HXX__ #include "CurveIntersector.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; CurveIntersectorP1P0(const MyMeshType& meshT, const MyMeshType& meshS, diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P0.txx b/src/INTERP_KERNEL/CurveIntersectorP1P0.txx index 149c84c2e..acfa0330d 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P0.txx @@ -20,10 +20,8 @@ #ifndef __CurveIntersectorP1P0_TXX__ #define __CurveIntersectorP1P0_TXX__ -#include "CurveIntersector.hxx" #include "CurveIntersectorP1P0.hxx" -#include -#include "InterpolationUtils.hxx" +#include "CurveIntersector.txx" #define BASE_INTERSECTOR CurveIntersector diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P1.hxx b/src/INTERP_KERNEL/CurveIntersectorP1P1.hxx index a0c35d6b5..3052d263d 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P1.hxx @@ -22,8 +22,6 @@ #define __CURVEINTERSECTORP1P1_HXX__ #include "CurveIntersector.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; CurveIntersectorP1P1(const MyMeshType& meshT, const MyMeshType& meshS, diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P1.txx b/src/INTERP_KERNEL/CurveIntersectorP1P1.txx index 8ea554760..17d7c8bd2 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P1.txx @@ -20,10 +20,8 @@ #ifndef __CurveIntersectorP1P1_TXX__ #define __CurveIntersectorP1P1_TXX__ -#include "CurveIntersector.hxx" #include "CurveIntersectorP1P1.hxx" -#include -#include "InterpolationUtils.hxx" +#include "CurveIntersector.txx" #define BASE_INTERSECTOR CurveIntersector diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx b/src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx index d9ef537a7..891b9fcad 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx @@ -22,8 +22,6 @@ #define __CURVEINTERSECTORP1P1PL_HXX__ #include "CurveIntersector.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; CurveIntersectorP1P1PL(const MyMeshType& meshT, const MyMeshType& meshS, diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx b/src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx index 7a45d51a4..4fac5779a 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx @@ -20,14 +20,10 @@ #pragma once -#include "CurveIntersector.hxx" #include "CurveIntersectorP1P1PL.hxx" -#include "InterpolationUtils.hxx" -#include "MCIdType.hxx" +#include "CurveIntersector.txx" #include -#include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/DiameterCalculator.cxx b/src/INTERP_KERNEL/DiameterCalculator.cxx index d6ea869c8..a168bc702 100644 --- a/src/INTERP_KERNEL/DiameterCalculator.cxx +++ b/src/INTERP_KERNEL/DiameterCalculator.cxx @@ -21,11 +21,8 @@ #include "DiameterCalculator.hxx" #include "InterpKernelException.hxx" #include "CellModel.hxx" -#include "NormalizedGeometricTypes" -#include "MCIdType.hxx" #include -#include #include #include @@ -100,11 +97,11 @@ template void ComputeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) { Evaluator evtor; - NormalizedCellType const ct(Evaluator::TYPE); - int const cti((int) ct); + NormalizedCellType ct(Evaluator::TYPE); + int cti((int) ct); for(const mcIdType *it=bgIds;it!=endIds;it++) { - mcIdType const offset(indPtr[*it]); + mcIdType offset(indPtr[*it]); if(connPtr[offset]==cti) resPtr[*it]=evtor.ComputeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[(*it)+1],coordsPtr); else @@ -119,11 +116,11 @@ template void ComputeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) { Evaluator evtor; - NormalizedCellType const ct(Evaluator::TYPE); - int const cti((int) ct); + NormalizedCellType ct(Evaluator::TYPE); + int cti((int) ct); for(mcIdType it=bgId;it void ComputeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) { Evaluator evtor; - NormalizedCellType const ct(Evaluator::TYPE); + NormalizedCellType ct(Evaluator::TYPE); const CellModel& cm(CellModel::GetCellModel(ct)); - unsigned const nbNodes(cm.getNumberOfNodes()); + unsigned nbNodes(cm.getNumberOfNodes()); const mcIdType *ptr(connPtr); for(mcIdType i=0;i -#include -#include -#include -#include #define __TENSOR(i,j) tensor[(i)*_dim+(j)] #define __AXIS(i) (&_axes[(i)*_dim]) @@ -125,7 +120,7 @@ namespace // Rotate to make __TENSOR(k,l) == 0 - double const diff = __TENSOR(l,l) - __TENSOR(k,k); + double diff = __TENSOR(l,l) - __TENSOR(k,k); double t; // tangent of rotation angle if ( fabs(__TENSOR(k,l)) < abs(diff)*1.0e-36) { @@ -133,13 +128,13 @@ namespace } else { - double const phi = diff/(2.0*__TENSOR(k,l)); + double phi = diff/(2.0*__TENSOR(k,l)); t = 1.0/(abs(phi) + sqrt(phi*phi + 1.0)); if ( phi < 0.0) t = -t; } - double const c = 1.0/sqrt(t*t + 1.0); // cosine of rotation angle - double const s = t*c; // sine of rotation angle - double const tau = s/(1.0 + c); + double c = 1.0/sqrt(t*t + 1.0); // cosine of rotation angle + double s = t*c; // sine of rotation angle + double tau = s/(1.0 + c); __TENSOR(k,k) -= t*__TENSOR(k,l); __TENSOR(l,l) += t*__TENSOR(k,l); __TENSOR(k,l) = 0.0; @@ -614,7 +609,7 @@ namespace INTERP_KERNEL // find minmax of cornerBox in the CS of axisBox - DirectedBoundingBox mmBox((double*)nullptr,0,_dim); //!< empty box with CS == axisBox->_axes + DirectedBoundingBox mmBox((double*)0,0,_dim); //!< empty box with CS == axisBox->_axes mmBox._axes = axisBox->_axes; vector corners; @@ -651,7 +646,7 @@ namespace INTERP_KERNEL { vector cornersOther; getCorners( cornersOther, box ); - DirectedBoundingBox mmBox((double*)nullptr,0,_dim); //!< empty box with CS == this->_axes + DirectedBoundingBox mmBox((double*)0,0,_dim); //!< empty box with CS == this->_axes mmBox._axes = this->_axes; for ( std::size_t iC = 0, nC = cornersOther.size()/_dim; iC < nC; ++iC) mmBox.addPointToBox( &cornersOther[iC*_dim] ); @@ -664,7 +659,7 @@ namespace INTERP_KERNEL { vector cornersThis; getCorners( cornersThis, &_minmax[0] ); - DirectedBoundingBox mmBox((double*)nullptr,0,_dim); //!< initailized _minmax + DirectedBoundingBox mmBox((double*)0,0,_dim); //!< initailized _minmax double globCorner[3]; for ( std::size_t iC = 0, nC = cornersThis.size()/_dim; iC < nC; ++iC) { @@ -693,7 +688,7 @@ namespace INTERP_KERNEL double pLoc[3]; toLocalCS( point, pLoc ); - bool const out = isLocalOut( pLoc ); + bool out = isLocalOut( pLoc ); #ifdef _DEBUG_ switch (_dim) { diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.cxx index 4d1e625d0..492f88356 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.cxx @@ -19,13 +19,10 @@ // Author : Anthony Geay (CEA/DEN) #include "InterpKernelAsmX86.hxx" -#include "InterpKernelException.hxx"//" #include #include #include -#include -#include #ifdef _POSIX_MAPPED_FILES #include @@ -40,20 +37,20 @@ const char *INTERP_KERNEL::AsmX86::OPS[NB_OF_OPS]={"mov","push","pop","fld","fad std::vector INTERP_KERNEL::AsmX86::convertIntoMachineLangage(const std::vector& asmb) const { std::vector ret; - for(const auto & iter : asmb) - convertOneInstructionInML(iter,ret); + for(std::vector::const_iterator iter=asmb.begin();iter!=asmb.end();iter++) + convertOneInstructionInML(*iter,ret); return ret; } -char *INTERP_KERNEL::AsmX86::copyToExecMemZone(const std::vector& ml, unsigned& /*offset*/) const +char *INTERP_KERNEL::AsmX86::copyToExecMemZone(const std::vector& ml, unsigned& offset) const { - char *ret=nullptr; - std::size_t const lgth=ml.size(); + char *ret=0; + std::size_t lgth=ml.size(); #ifdef _POSIX_MAPPED_FILES # ifdef __APPLE__ ret=(char *)mmap(0,lgth,PROT_EXEC | PROT_WRITE,MAP_ANON | MAP_PRIVATE,-1,0); # else - ret=(char *)mmap(nullptr,lgth,PROT_EXEC | PROT_WRITE,MAP_ANONYMOUS | MAP_PRIVATE,-1,0); + ret=(char *)mmap(0,lgth,PROT_EXEC | PROT_WRITE,MAP_ANONYMOUS | MAP_PRIVATE,-1,0); # endif #else #ifdef WIN32 @@ -68,7 +65,7 @@ char *INTERP_KERNEL::AsmX86::copyToExecMemZone(const std::vector& ml, unsi void INTERP_KERNEL::AsmX86::convertOneInstructionInML(const std::string& inst, std::vector& ml) const { - std::string::size_type const pos=inst.find_first_of(' '); + std::string::size_type pos=inst.find_first_of(' '); std::string op; std::string param; if(pos!=std::string::npos) @@ -81,7 +78,7 @@ void INTERP_KERNEL::AsmX86::convertOneInstructionInML(const std::string& inst, s int id=0; for(const char **it=OPS;it!=OPS+NB_OF_OPS;it++,id++) { - std::string const tmp(*it); + std::string tmp(*it); if(op==tmp) break; } @@ -176,15 +173,15 @@ void INTERP_KERNEL::AsmX86::convertMov(const std::string& inst, std::vector& ml) { - std::string::size_type const pos=inst.find_first_of(' '); - std::string const inst2=inst.substr(pos+1); + std::string::size_type pos=inst.find_first_of(' '); + std::string inst2=inst.substr(pos+1); const char ASM1[]="ebp"; const unsigned char ML1[1]={0x55}; if(inst2==ASM1) @@ -272,8 +269,8 @@ void INTERP_KERNEL::AsmX86::convertPush(const std::string& inst, std::vector& ml) { - std::string::size_type const pos=inst.find_first_of(' '); - std::string const inst2=inst.substr(pos+1); + std::string::size_type pos=inst.find_first_of(' '); + std::string inst2=inst.substr(pos+1); const char ASM1[]="ebp"; const unsigned char ML1[1]={0x5d}; if(inst2==ASM1) @@ -294,8 +291,8 @@ void INTERP_KERNEL::AsmX86::convertPop(const std::string& inst, std::vector& ml) { std::string::size_type pos=inst.find_first_of(' '); - std::string const params=inst.substr(pos+1); - std::string const params2=params.substr(1,params.length()-2); + std::string params=inst.substr(pos+1); + std::string params2=params.substr(1,params.length()-2); if(params2.substr(0,3)=="esp") { const unsigned char ML1[3]={0xdd,0x04,0x24}; @@ -308,7 +305,7 @@ void INTERP_KERNEL::AsmX86::convertFld(const std::string& inst, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertFaddp(const std::string& inst, std::vector& ml) { const unsigned char ML1[2]={0xde,0xc1}; ml.insert(ml.end(),ML1,ML1+sizeof(ML1)); } -void INTERP_KERNEL::AsmX86::convertFsubp(const std::string& /*inst*/, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertFsubp(const std::string& inst, std::vector& ml) { const unsigned char ML1[2]={0xde,0xe9}; ml.insert(ml.end(),ML1,ML1+sizeof(ML1)); } -void INTERP_KERNEL::AsmX86::convertFmulp(const std::string& /*inst*/, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertFmulp(const std::string& inst, std::vector& ml) { const unsigned char ML1[2]={0xde,0xc9}; ml.insert(ml.end(),ML1,ML1+sizeof(ML1)); } -void INTERP_KERNEL::AsmX86::convertFdivp(const std::string& /*inst*/, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertFdivp(const std::string& inst, std::vector& ml) { const unsigned char ML1[2]={0xde,0xf9}; ml.insert(ml.end(),ML1,ML1+sizeof(ML1)); } -void INTERP_KERNEL::AsmX86::convertFcos(const std::string& /*inst*/, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertFcos(const std::string& inst, std::vector& ml) { const unsigned char ML[2]={0xd9,0xff}; ml.insert(ml.end(),ML,ML+sizeof(ML)); } -void INTERP_KERNEL::AsmX86::convertFsin(const std::string& /*inst*/, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertFsin(const std::string& inst, std::vector& ml) { const unsigned char ML[2]={0xd9,0xfe}; ml.insert(ml.end(),ML,ML+sizeof(ML)); } -void INTERP_KERNEL::AsmX86::convertFabs(const std::string& /*inst*/, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertFabs(const std::string& inst, std::vector& ml) { const unsigned char ML[2]={0xd9,0xe1}; ml.insert(ml.end(),ML,ML+sizeof(ML)); } -void INTERP_KERNEL::AsmX86::convertFchs(const std::string& /*inst*/, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertFchs(const std::string& inst, std::vector& ml) { const unsigned char ML[2]={0xd9,0xe0}; ml.insert(ml.end(),ML,ML+sizeof(ML)); } -void INTERP_KERNEL::AsmX86::convertFsqrt(const std::string& /*inst*/, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertFsqrt(const std::string& inst, std::vector& ml) { const unsigned char ML[2]={0xd9,0xfa}; ml.insert(ml.end(),ML,ML+sizeof(ML)); @@ -402,7 +399,7 @@ void INTERP_KERNEL::AsmX86::convertSub(const std::string& inst, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertRet(const std::string& inst, std::vector& ml) { const unsigned char ML[1]={0xc3}; ml.insert(ml.end(),ML,ML+sizeof(ML)); } -void INTERP_KERNEL::AsmX86::convertLeave(const std::string& /*inst*/, std::vector& ml) +void INTERP_KERNEL::AsmX86::convertLeave(const std::string& inst, std::vector& ml) { const unsigned char ML[1]={0xc9}; ml.insert(ml.end(),ML,ML+sizeof(ML)); diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.hxx b/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.hxx index 5e4c82847..738de4407 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.hxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.hxx @@ -21,6 +21,8 @@ #ifndef __INTERPKERNELASMX86_HXX__ #define __INTERPKERNELASMX86_HXX__ +#include "INTERPKERNELDefines.hxx" +#include "InterpKernelException.hxx" #include #include diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx index 920c63fc5..3ab05105f 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx @@ -19,20 +19,13 @@ // Author : Anthony Geay (CEA/DEN) #include "InterpKernelExprParser.hxx" -#include "InterpKernelFunction.hxx" -#include "InterpKernelUnit.hxx" #include "InterpKernelValue.hxx" #include "InterpKernelAsmX86.hxx" #include "InterpKernelAutoPtr.hxx" -#include "InterpKernelException.hxx" #include -#include -#include #include #include -#include -#include #include #include #include @@ -67,14 +60,16 @@ LeafExpr *LeafExpr::buildInstanceFrom(const std::string& expr) } LeafExpr::~LeafExpr() -= default; +{ +} LeafExprVal::LeafExprVal(double value):_value(value) { } LeafExprVal::~LeafExprVal() -= default; +{ +} void LeafExprVal::fillValue(Value *val) const { @@ -83,8 +78,8 @@ void LeafExprVal::fillValue(Value *val) const void LeafExprVal::replaceValues(const std::vector& valuesInExpr) { - int const pos=(int)_value; - int const lgth=(int)valuesInExpr.size(); + int pos=(int)_value; + int lgth=(int)valuesInExpr.size(); if(pos>=lgth || pos<0) throw INTERP_KERNEL::Exception("LeafExprVal::replaceValues : Big Problem detected! Send a mail to Salome support with expression."); _value=valuesInExpr[pos]; @@ -95,7 +90,7 @@ LeafExprVal *LeafExprVal::deepCopy() const return new LeafExprVal(*this); } -LeafExprVar::LeafExprVar(const std::string& var):_fast_pos(-1),_var_name(var),_val(nullptr) +LeafExprVar::LeafExprVar(const std::string& var):_fast_pos(-1),_var_name(var),_val(0) { } @@ -110,7 +105,7 @@ void LeafExprVar::fillValue(Value *val) const void LeafExprVar::prepareExprEvaluation(const std::vector& vars, int nbOfCompo, int targetNbOfCompo) const { - auto const iter=std::find(vars.begin(),vars.end(),_var_name); + std::vector::const_iterator iter=std::find(vars.begin(),vars.end(),_var_name); if(iter==vars.end()) { if(!isRecognizedKeyVar(_var_name,_fast_pos)) @@ -121,7 +116,7 @@ void LeafExprVar::prepareExprEvaluation(const std::vector& vars, in } else { - int const relPos=-7-_fast_pos; + int relPos=-7-_fast_pos; if(relPos>=targetNbOfCompo) { std::ostringstream oss; oss << "LeafExprVar::prepareExprEvaluation : Found recognized unitary vector \"" << _var_name << "\" which implies that component #" << relPos; @@ -166,10 +161,10 @@ bool LeafExprVar::isRecognizedKeyVar(const std::string& var, int& pos) { if(var.length()!=sizeof(END_OF_RECOGNIZED_VAR)) return false; - std::string const end=var.substr(1); + std::string end=var.substr(1); if(end!=END_OF_RECOGNIZED_VAR) return false; - char const first=var[0]; + char first=var[0]; if(first<'I' || first>'Z') return false; pos=-7-(first-'I'); @@ -189,35 +184,36 @@ void LeafExprVar::replaceValues(const std::vector& valuesInExpr) } LeafExprVar::~LeafExprVar() -= default; +{ +} void ExprParserOfEval::clearSortedMemory() { delete _leaf; - for(auto & _sub_part : _sub_parts) - _sub_part.clearSortedMemory(); - for(auto & _func : _funcs) - delete _func; + for(std::vector::iterator it=_sub_parts.begin();it!=_sub_parts.end();it++) + (*it).clearSortedMemory(); + for(std::vector::iterator it=_funcs.begin();it!=_funcs.end();it++) + delete *it; } void ExprParserOfEval::sortMemory() { - for(auto & _sub_part : _sub_parts) - _sub_part.sortMemory(); + for(std::vector::iterator it=_sub_parts.begin();it!=_sub_parts.end();it++) + (*it).sortMemory(); if(_leaf) _leaf=_leaf->deepCopy(); - for(auto & _func : _funcs) - if(_func) - _func=_func->deepCopy(); + for(std::vector::iterator it=_funcs.begin();it!=_funcs.end();it++) + if(*it) + *it=(*it)->deepCopy(); } -ExprParser::ExprParser(const std::string& expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(nullptr),_is_parsing_ok(false),_expr(expr) +ExprParser::ExprParser(const std::string& expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false),_expr(expr) { _expr=deleteWhiteSpaces(_expr); } //! For \b NOT null terminated strings coming from FORTRAN. -ExprParser::ExprParser(const char *expr, int lgth, ExprParser *father):_father(father),_is_parsed(false),_leaf(nullptr),_is_parsing_ok(false) +ExprParser::ExprParser(const char *expr, int lgth, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false) { _expr=buildStringFromFortran(expr,lgth); _expr=deleteWhiteSpaces(_expr); @@ -235,7 +231,7 @@ std::size_t ExprParser::FindCorrespondingOpenBracket(const std::string& expr, st int level=0; for(std::size_t iter=0;iter valuesInExpr; fillValuesInExpr(valuesInExpr); checkBracketsParity(); @@ -312,7 +308,7 @@ double ExprParser::evaluate() const DecompositionInUnitBase ExprParser::evaluateUnit() const { Value *gen=new ValueUnit; - ValueUnit *res=nullptr; + ValueUnit *res=0; try { res=(ValueUnit *)evaluateLowLev(gen); @@ -339,13 +335,13 @@ void ExprParser::prepareExprEvaluation(const std::vector& vars, int { if(_leaf) { - auto *leafC=dynamic_cast(_leaf); + LeafExprVar *leafC=dynamic_cast(_leaf); if(leafC) leafC->prepareExprEvaluation(vars,nbOfCompo,targetNbOfCompo); } else - for(const auto & iter : _sub_expr) - iter.prepareExprEvaluation(vars,nbOfCompo,targetNbOfCompo); + for(std::vector::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++) + (*iter).prepareExprEvaluation(vars,nbOfCompo,targetNbOfCompo); } /*! @@ -361,13 +357,13 @@ void ExprParser::prepareExprEvaluationDouble(const std::vector& var throw INTERP_KERNEL::Exception("ExprParser::prepareExprEvaluationDouble : size of input vector must be equal to the input vector !"); if(_leaf) { - auto *leafC=dynamic_cast(_leaf); + LeafExprVar *leafC=dynamic_cast(_leaf); if(leafC) leafC->prepareExprEvaluationDouble(vars,nbOfCompo,targetNbOfCompo,refPos,ptOfInputStart,ptOfInputEnd); } else - for(const auto & iter : _sub_expr) - iter.prepareExprEvaluationDouble(vars,nbOfCompo,targetNbOfCompo,refPos,ptOfInputStart,ptOfInputEnd); + for(std::vector::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++) + (*iter).prepareExprEvaluationDouble(vars,nbOfCompo,targetNbOfCompo,refPos,ptOfInputStart,ptOfInputEnd); } void ExprParser::prepareFastEvaluator() const @@ -414,13 +410,13 @@ void ExprParser::prepareExprEvaluationVecLowLev() const { if(_leaf) { - auto *leafC=dynamic_cast(_leaf); + LeafExprVar *leafC=dynamic_cast(_leaf); if(leafC) leafC->prepareExprEvaluationVec(); } else - for(const auto & iter : _sub_expr) - iter.prepareExprEvaluationVecLowLev(); + for(std::vector::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++) + (*iter).prepareExprEvaluationVecLowLev(); } Value *ExprParser::evaluateLowLev(Value *valGen) const @@ -447,17 +443,17 @@ Value *ExprParser::evaluateLowLev(Value *valGen) const else { stackOfVal.resize(_sub_expr.size()); - auto iter2=stackOfVal.begin(); - for(auto iter=_sub_expr.begin();iter!=_sub_expr.end();iter++,iter2++) + std::vector::iterator iter2=stackOfVal.begin(); + for(std::vector::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++,iter2++) *iter2=(*iter).evaluateLowLev(valGen); } - for(auto iter3 : _func_btw_sub_expr) - iter3->operate(stackOfVal); + for(std::vector::const_iterator iter3=_func_btw_sub_expr.begin();iter3!=_func_btw_sub_expr.end();iter3++) + (*iter3)->operate(stackOfVal); } catch(INTERP_KERNEL::Exception& e) { - for(auto & iter4 : stackOfVal) - delete iter4; + for(std::vector::iterator iter4=stackOfVal.begin();iter4!=stackOfVal.end();iter4++) + delete *iter4; throw e; } return stackOfVal.back(); @@ -465,7 +461,7 @@ Value *ExprParser::evaluateLowLev(Value *valGen) const ExprParser::ExprParser(ExprParser&& other):_father(other._father),_leaf(other._leaf),_is_parsing_ok(std::move(other._is_parsing_ok)),_expr(std::move(other._expr)),_sub_expr(std::move(other._sub_expr)),_func_btw_sub_expr(std::move(other._func_btw_sub_expr)) { - other._leaf=nullptr; + other._leaf=0; } ExprParser& ExprParser::operator=(ExprParser&& other) @@ -477,7 +473,7 @@ ExprParser& ExprParser::operator=(ExprParser&& other) _sub_expr=std::move(other._sub_expr); _func_btw_sub_expr=std::move(other._func_btw_sub_expr); other._leaf=other._leaf; - other._leaf=nullptr; + other._leaf=0; return *this; } @@ -485,17 +481,17 @@ void ExprParser::reverseThis() { if(_leaf) return ; - for(auto & iter : _sub_expr) - iter.reverseThis(); - std::size_t const sz(_sub_expr.size()); - std::size_t const nbOfTurn(sz/2); + for(std::vector::iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++) + (*iter).reverseThis(); + std::size_t sz(_sub_expr.size()); + std::size_t nbOfTurn(sz/2); for(std::size_t i=0;i subExpr(sz); for(std::size_t i=0;i& vars) const { if(_leaf) { - auto *leafC=dynamic_cast(_leaf); + LeafExprVar *leafC=dynamic_cast(_leaf); if(leafC) vars.insert(leafC->getVar()); } else - for(const auto & iter : _sub_expr) - iter.getSetOfVars(vars); + for(std::vector::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++) + (*iter).getSetOfVars(vars); } void ExprParser::getTrueSetOfVars(std::set& trueVars) const @@ -520,19 +516,19 @@ void ExprParser::getTrueSetOfVars(std::set& trueVars) const std::set vars; getSetOfVars(vars); trueVars.clear(); - for(const auto & var : vars) + for(std::set::const_iterator iter=vars.begin();iter!=vars.end();iter++) { int tmp; - if(!LeafExprVar::isRecognizedKeyVar(var,tmp)) - trueVars.insert(var); + if(!LeafExprVar::isRecognizedKeyVar(*iter,tmp)) + trueVars.insert(*iter); } } void ExprParser::parseDeeper() { - for(auto & iter : _sub_expr) - if(!iter.simplify()) - iter.parseDeeper(); + for(std::vector::iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++) + if(!(*iter).simplify()) + (*iter).parseDeeper(); } /*! @@ -545,22 +541,22 @@ void ExprParser::parseUnaryFunc() if(_expr[_expr.length()-1]!=')') return ; //at this level of code _expr - std::size_t const pos1=_expr.find_first_of('('); - std::size_t const pos4=FindCorrespondingOpenBracket(_expr,_expr.length()-1); + std::size_t pos1=_expr.find_first_of('('); + std::size_t pos4=FindCorrespondingOpenBracket(_expr,_expr.length()-1); if(pos4!=pos1) return ; std::string funcName=_expr.substr(0,pos1); - std::size_t const pos2=funcName.find_first_of("+-*/^><",0,7); - std::size_t const pos3=funcName.find_first_not_of("+-*/^><",0,7); + std::size_t pos2=funcName.find_first_of("+-*/^><",0,7); + std::size_t pos3=funcName.find_first_not_of("+-*/^><",0,7); if(pos2!=std::string::npos && pos3!=std::string::npos) return ;//Bracket group is not alone, can't conclude not recursively. std::string newExp2=_expr.substr(pos1+1,_expr.length()-pos1-2); - std::size_t const nbOfParamsInFunc=std::count(newExp2.begin(),newExp2.end(),',')+1; + std::size_t nbOfParamsInFunc=std::count(newExp2.begin(),newExp2.end(),',')+1; if(pos3!=std::string::npos) _func_btw_sub_expr.push_back(FunctionsFactory::buildFuncFromString(funcName.c_str(),(int)nbOfParamsInFunc)); else { - std::size_t const lgth=funcName.length(); + std::size_t lgth=funcName.length(); char tmp[2]; tmp[1]='\0'; for(std::size_t i=0;i",0,9); + std::size_t pos=_expr.find_first_not_of("+-",0,2); + std::string minimizedExpr=_expr.substr(pos); + std::size_t pos2=minimizedExpr.find_first_of("+-*/^()<>",0,9); if(pos2!=std::string::npos) return false; delete _leaf; @@ -631,7 +627,7 @@ void ExprParser::parseForCmp() std::ostringstream errMsg; char MSGTYP1[]="Error non unary function for '"; errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1 << *iter << "'"; - std::string const tmp=_expr.substr(iter-_expr.begin()); + std::string tmp=_expr.substr(iter-_expr.begin()); LocateError(errMsg,tmp,0); throw INTERP_KERNEL::Exception(errMsg.str().c_str()); } @@ -684,7 +680,7 @@ void ExprParser::parseForAddMin() { if(!curPart.empty()) { - std::string::reverse_iterator const accessor=curPart.rbegin(); + std::string::reverse_iterator accessor=curPart.rbegin(); if(*accessor!='*' && *accessor!='/' && *accessor!='^') { isParsingSucceed=true; @@ -756,7 +752,7 @@ void ExprParser::parseForMulDiv() std::ostringstream errMsg; char MSGTYP1[]="Error non unary function for '"; errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1 << *iter << "'"; - std::string const tmp=_expr.substr(iter-_expr.begin()); + std::string tmp=_expr.substr(iter-_expr.begin()); LocateError(errMsg,tmp,0); throw INTERP_KERNEL::Exception(errMsg.str().c_str()); } @@ -817,7 +813,7 @@ void ExprParser::parseForPow() std::ostringstream errMsg; char MSGTYP1[]="Error non unary function for '"; errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1 << *iter << "'"; - std::string const tmp=_expr.substr(iter-_expr.begin()); + std::string tmp=_expr.substr(iter-_expr.begin()); LocateError(errMsg,tmp,0);curPart+=*iter; throw INTERP_KERNEL::Exception(errMsg.str().c_str()); } @@ -853,8 +849,8 @@ void ExprParser::parseForPow() void ExprParser::releaseFunctions() { - for(auto & iter : _func_btw_sub_expr) - delete iter; + for(std::vector::iterator iter=_func_btw_sub_expr.begin();iter!=_func_btw_sub_expr.end();iter++) + delete *iter; _func_btw_sub_expr.clear(); } @@ -933,8 +929,8 @@ double ExprParser::ReplaceAndTraduce(std::string& expr, int id, std::size_t bg, static const char MSG[]="Internal error : A string expected to be a float is not one ! Bug to signal !"; std::istringstream stream; std::ostringstream oss; - std::size_t const end2=end!=std::string::npos?end-bg:end; - std::string const tmp=expr.substr(bg,end2); + std::size_t end2=end!=std::string::npos?end-bg:end; + std::string tmp=expr.substr(bg,end2); stream.str(tmp); double ret=std::numeric_limits::max(); stream >> ret; @@ -943,8 +939,8 @@ double ExprParser::ReplaceAndTraduce(std::string& expr, int id, std::size_t bg, if(!stream.eof()) throw INTERP_KERNEL::Exception(MSG); oss << id; - std::string const tmp2(oss.str()); - std::size_t const l1=tmp.length(); + std::string tmp2(oss.str()); + std::size_t l1=tmp.length(); delta=(int)tmp2.length()-(int)l1; expr.replace(bg,l1,tmp2); return ret; @@ -959,11 +955,11 @@ void ExprParser::fillValuesInExpr(std::vector& valuesInExpr) { const char FIGURES[]="0123456789"; const std::string other("+-*^/(<>,"); - std::size_t const lgth=_expr.length(); + std::size_t lgth=_expr.length(); int id=0,delta; for(std::size_t pos=0;pos!=std::string::npos;id++) { - std::size_t const pos2=_expr.find_first_of(FIGURES,pos,10); + std::size_t pos2=_expr.find_first_of(FIGURES,pos,10); if(pos2==std::string::npos) break; if(pos2>0) @@ -1017,7 +1013,7 @@ void ExprParser::fillValuesInExpr(std::vector& valuesInExpr) std::ostringstream oss; oss << "Invalid expr : float number at the end of expr is invalid lacking number after exponential and sign ! -> \"" << _expr.substr(pos2) << "\""; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::size_t const pos5=_expr.find_first_not_of(FIGURES,pos4,10); + std::size_t pos5=_expr.find_first_not_of(FIGURES,pos4,10); if(pos4==pos5) {//"x+1223334.223e+x" or "1223334.223E-y" std::ostringstream oss; oss << "Invalid expr : float number in expr is invalid lacking number after exponential ! -> \"" << _expr.substr(pos2,pos4-pos2) << "\""; @@ -1050,8 +1046,8 @@ void ExprParser::replaceValues(const std::vector& valuesInExpr) _leaf->replaceValues(valuesInExpr); else { - for(auto & iter : _sub_expr) - iter.replaceValues(valuesInExpr); + for(std::vector::iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++) + (*iter).replaceValues(valuesInExpr); } } @@ -1070,12 +1066,12 @@ char *ExprParser::compileX86() const ass.push_back("pop ebp"); ass.push_back("ret"); std::cout << std::endl; - for(const auto & as : ass) - std::cout << " " << as << std::endl; - AsmX86 const asmb; - std::vector const output=asmb.convertIntoMachineLangage(ass); - for(char const iter : output) - std::cout << std::hex << (int)((unsigned char)iter) << " "; + for(std::vector::const_iterator iter=ass.begin();iter!=ass.end();iter++) + std::cout << " " << *iter << std::endl; + AsmX86 asmb; + std::vector output=asmb.convertIntoMachineLangage(ass); + for(std::vector::const_iterator iter=output.begin();iter!=output.end();iter++) + std::cout << std::hex << (int)((unsigned char)(*iter)) << " "; std::cout << std::endl; unsigned offset; return asmb.copyToExecMemZone(output,offset); @@ -1095,12 +1091,12 @@ char *ExprParser::compileX86_64() const ass.push_back("leave"); ass.push_back("ret"); std::cout << std::endl; - for(const auto & as : ass) - std::cout << " " << as << std::endl; - AsmX86 const asmb; - std::vector const output=asmb.convertIntoMachineLangage(ass); - for(char const iter : output) - std::cout << std::hex << (int)((unsigned char)iter) << " "; + for(std::vector::const_iterator iter=ass.begin();iter!=ass.end();iter++) + std::cout << " " << *iter << std::endl; + AsmX86 asmb; + std::vector output=asmb.convertIntoMachineLangage(ass); + for(std::vector::const_iterator iter=output.begin();iter!=output.end();iter++) + std::cout << std::hex << (int)((unsigned char)(*iter)) << " "; std::cout << std::endl; unsigned offset; return asmb.copyToExecMemZone(output,offset); @@ -1112,11 +1108,11 @@ void ExprParser::compileX86LowLev(std::vector& ass) const _leaf->compileX86(ass); else { - for(const auto & iter : _sub_expr) - iter.compileX86LowLev(ass); + for(std::vector::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++) + (*iter).compileX86LowLev(ass); } - for(auto iter2 : _func_btw_sub_expr) - iter2->operateX86(ass); + for(std::vector::const_iterator iter2=_func_btw_sub_expr.begin();iter2!=_func_btw_sub_expr.end();iter2++) + (*iter2)->operateX86(ass); } void ExprParser::compileX86_64LowLev(std::vector& ass) const @@ -1125,11 +1121,11 @@ void ExprParser::compileX86_64LowLev(std::vector& ass) const _leaf->compileX86_64(ass); else { - for(const auto & iter : _sub_expr) - iter.compileX86_64LowLev(ass); + for(std::vector::const_iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++) + (*iter).compileX86_64LowLev(ass); } - for(auto iter2 : _func_btw_sub_expr) - iter2->operateX86(ass); + for(std::vector::const_iterator iter2=_func_btw_sub_expr.begin();iter2!=_func_btw_sub_expr.end();iter2++) + (*iter2)->operateX86(ass); } double LeafExprVal::getDoubleValue() const @@ -1175,7 +1171,7 @@ double LeafExprVar::getDoubleValue() const return _val[_fast_pos]; else { - int const pos(-7-_fast_pos); + int pos(-7-_fast_pos); return pos==_ref_pos?1.:0.; } } @@ -1197,9 +1193,9 @@ int ExprParser::getStackSizeToPlayX86(const ExprParser *asker) const { if(asker) { - int const sz=_father->getStackSizeToPlayX86(this); + int sz=_father->getStackSizeToPlayX86(this); int i=0; - for(auto iter=_sub_expr.rbegin();iter!=_sub_expr.rend();iter++,i++) + for(std::vector::const_reverse_iterator iter=_sub_expr.rbegin();iter!=_sub_expr.rend();iter++,i++) { const ExprParser& obj=(*iter); const ExprParser *pt=&obj; diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx index e154c52e9..8d6099c72 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx @@ -23,13 +23,13 @@ #include "INTERPKERNELDefines.hxx" #include "InterpKernelUnit.hxx" +#include "InterpKernelException.hxx" #include "InterpKernelFunction.hxx" -#include -#include #include +#include +#include #include -#include namespace INTERP_KERNEL { @@ -52,13 +52,13 @@ namespace INTERP_KERNEL { public: INTERPKERNEL_EXPORT LeafExprVal(double value); - INTERPKERNEL_EXPORT ~LeafExprVal() override; - INTERPKERNEL_EXPORT double getDoubleValue() const override; - INTERPKERNEL_EXPORT void compileX86(std::vector& ass) const override; - INTERPKERNEL_EXPORT void compileX86_64(std::vector& ass) const override; - INTERPKERNEL_EXPORT void fillValue(Value *val) const override; - INTERPKERNEL_EXPORT void replaceValues(const std::vector& valuesInExpr) override; - INTERPKERNEL_EXPORT LeafExprVal *deepCopy() const override; + INTERPKERNEL_EXPORT ~LeafExprVal(); + INTERPKERNEL_EXPORT double getDoubleValue() const; + INTERPKERNEL_EXPORT void compileX86(std::vector& ass) const; + INTERPKERNEL_EXPORT void compileX86_64(std::vector& ass) const; + INTERPKERNEL_EXPORT void fillValue(Value *val) const; + INTERPKERNEL_EXPORT void replaceValues(const std::vector& valuesInExpr); + INTERPKERNEL_EXPORT LeafExprVal *deepCopy() const; private: double _value; }; @@ -68,18 +68,18 @@ namespace INTERP_KERNEL public: INTERPKERNEL_EXPORT LeafExprVar(const LeafExprVar& other):_fast_pos(other._fast_pos),_ref_pos(other._ref_pos),_var_name(other._var_name),_val(other._val) { } INTERPKERNEL_EXPORT LeafExprVar(const std::string& var); - INTERPKERNEL_EXPORT ~LeafExprVar() override; - INTERPKERNEL_EXPORT double getDoubleValue() const override; - INTERPKERNEL_EXPORT void compileX86(std::vector& ass) const override; - INTERPKERNEL_EXPORT void compileX86_64(std::vector& ass) const override; - INTERPKERNEL_EXPORT void fillValue(Value *val) const override; + INTERPKERNEL_EXPORT ~LeafExprVar(); + INTERPKERNEL_EXPORT double getDoubleValue() const; + INTERPKERNEL_EXPORT void compileX86(std::vector& ass) const; + INTERPKERNEL_EXPORT void compileX86_64(std::vector& ass) const; + INTERPKERNEL_EXPORT void fillValue(Value *val) const; INTERPKERNEL_EXPORT std::string getVar() const { return _var_name; } INTERPKERNEL_EXPORT void prepareExprEvaluation(const std::vector& vars, int nbOfCompo, int targetNbOfCompo) const; INTERPKERNEL_EXPORT void prepareExprEvaluationDouble(const std::vector& vars, int nbOfCompo, int targetNbOfCompo, int refPos, const double *ptOfInputStart, const double *ptOfInputEnd) const; INTERPKERNEL_EXPORT void prepareExprEvaluationVec() const; - INTERPKERNEL_EXPORT void replaceValues(const std::vector& valuesInExpr) override; + INTERPKERNEL_EXPORT void replaceValues(const std::vector& valuesInExpr); INTERPKERNEL_EXPORT static bool isRecognizedKeyVar(const std::string& var, int& pos); - INTERPKERNEL_EXPORT LeafExprVar *deepCopy() const override; + INTERPKERNEL_EXPORT LeafExprVar *deepCopy() const; public: static const char END_OF_RECOGNIZED_VAR[]; private: @@ -92,27 +92,27 @@ namespace INTERP_KERNEL class ExprParserOfEval { public: - ExprParserOfEval():_leaf(nullptr) { } + ExprParserOfEval():_leaf(0) { } ExprParserOfEval(LeafExpr *leaf, const std::vector& subParts, const std::vector& funcs):_leaf(leaf),_sub_parts(subParts),_funcs(funcs) { } void evaluateDoubleInternal(std::vector& stck) const { if(_leaf) stck.push_back(_leaf->getDoubleValue()); else - for(const auto & _sub_part : _sub_parts) - _sub_part.evaluateDoubleInternal(stck); - for(auto _func : _funcs) - _func->operateStackOfDouble(stck); + for(std::vector::const_iterator iter=_sub_parts.begin();iter!=_sub_parts.end();iter++) + (*iter).evaluateDoubleInternal(stck); + for(std::vector::const_iterator iter3=_funcs.begin();iter3!=_funcs.end();iter3++) + (*iter3)->operateStackOfDouble(stck); } void evaluateDoubleInternalSafe(std::vector& stck) const { if(_leaf) stck.push_back(_leaf->getDoubleValue()); else - for(const auto & _sub_part : _sub_parts) - _sub_part.evaluateDoubleInternalSafe(stck); - for(auto _func : _funcs) - _func->operateStackOfDoubleSafe(stck); + for(std::vector::const_iterator iter=_sub_parts.begin();iter!=_sub_parts.end();iter++) + (*iter).evaluateDoubleInternalSafe(stck); + for(std::vector::const_iterator iter3=_funcs.begin();iter3!=_funcs.end();iter3++) + (*iter3)->operateStackOfDoubleSafe(stck); } void clearSortedMemory(); void sortMemory(); @@ -127,8 +127,8 @@ namespace INTERP_KERNEL public: INTERPKERNEL_EXPORT ExprParser(ExprParser&& other); INTERPKERNEL_EXPORT ExprParser& operator=(ExprParser&& other); - INTERPKERNEL_EXPORT ExprParser(const std::string& expr, ExprParser *father=nullptr); - INTERPKERNEL_EXPORT ExprParser(const char *expr, int lgth, ExprParser *father=nullptr); + INTERPKERNEL_EXPORT ExprParser(const std::string& expr, ExprParser *father=0); + INTERPKERNEL_EXPORT ExprParser(const char *expr, int lgth, ExprParser *father=0); INTERPKERNEL_EXPORT ~ExprParser(); INTERPKERNEL_EXPORT void parse(); INTERPKERNEL_EXPORT bool isParsingSuccessfull() const { return _is_parsing_ok; } diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.cxx index 0c66c265f..041283f95 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.cxx @@ -20,13 +20,10 @@ #include "InterpKernelFunction.hxx" #include "InterpKernelValue.hxx" -#include "InterpKernelException.hxx" #include #include #include -#include -#include using namespace INTERP_KERNEL; @@ -103,7 +100,7 @@ Function *FunctionsFactory::buildFuncFromString(const char *type, int nbOfParams Function *FunctionsFactory::buildUnaryFuncFromString(const char *type) { - std::string const tmp(type); + std::string tmp(type); if(tmp.empty()) return new IdentityFunction; if(tmp==CosFunction::REPR) @@ -148,7 +145,7 @@ Function *FunctionsFactory::buildUnaryFuncFromString(const char *type) Function *FunctionsFactory::buildBinaryFuncFromString(const char *type) { - std::string const tmp(type); + std::string tmp(type); if(tmp==PositiveFunction::REPR) return new PlusFunction; if(tmp==NegateFunction::REPR) @@ -174,7 +171,7 @@ Function *FunctionsFactory::buildBinaryFuncFromString(const char *type) Function *FunctionsFactory::buildTernaryFuncFromString(const char *type) { - std::string const tmp(type); + std::string tmp(type); if(tmp==IfFunction::REPR) return new IfFunction(); std::string msg("Invalid ternary function detected : \""); @@ -189,10 +186,12 @@ Function *FunctionsFactory::buildBinaryFuncFromString(char type) } Function::~Function() -= default; +{ +} IdentityFunction::~IdentityFunction() -= default; +{ +} void IdentityFunction::operate(std::vector& stck) const { @@ -217,7 +216,8 @@ bool IdentityFunction::isACall() const } PositiveFunction::~PositiveFunction() -= default; +{ +} int UnaryFunction::getNbInputParams() const { @@ -247,7 +247,8 @@ bool PositiveFunction::isACall() const } NegateFunction::~NegateFunction() -= default; +{ +} void NegateFunction::operate(std::vector& stck) const { @@ -262,7 +263,7 @@ void NegateFunction::operateX86(std::vector& asmb) const void NegateFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=-v; } @@ -277,7 +278,8 @@ bool NegateFunction::isACall() const } CosFunction::~CosFunction() -= default; +{ +} void CosFunction::operate(std::vector& stck) const { @@ -292,7 +294,7 @@ void CosFunction::operateX86(std::vector& asmb) const void CosFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=cos(v); } @@ -307,7 +309,8 @@ bool CosFunction::isACall() const } SinFunction::~SinFunction() -= default; +{ +} void SinFunction::operate(std::vector& stck) const { @@ -322,7 +325,7 @@ void SinFunction::operateX86(std::vector& asmb) const void SinFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=sin(v); } @@ -337,7 +340,8 @@ bool SinFunction::isACall() const } TanFunction::~TanFunction() -= default; +{ +} void TanFunction::operate(std::vector& stck) const { @@ -345,14 +349,14 @@ void TanFunction::operate(std::vector& stck) const val->tan(); } -void TanFunction::operateX86(std::vector& /*asmb*/) const +void TanFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void TanFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=tan(v); } @@ -367,7 +371,8 @@ bool TanFunction::isACall() const } ACosFunction::~ACosFunction() -= default; +{ +} void ACosFunction::operate(std::vector& stck) const { @@ -375,20 +380,20 @@ void ACosFunction::operate(std::vector& stck) const val->acos(); } -void ACosFunction::operateX86(std::vector& /*asmb*/) const +void ACosFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void ACosFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=acos(v); } void ACosFunction::operateStackOfDoubleSafe(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); if(fabs(v)>1.) throw INTERP_KERNEL::Exception("acos on a value which absolute is > 1 !"); stck.back()=acos(v); @@ -405,7 +410,8 @@ bool ACosFunction::isACall() const } ASinFunction::~ASinFunction() -= default; +{ +} void ASinFunction::operate(std::vector& stck) const { @@ -413,20 +419,20 @@ void ASinFunction::operate(std::vector& stck) const val->asin(); } -void ASinFunction::operateX86(std::vector& /*asmb*/) const +void ASinFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void ASinFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=asin(v); } void ASinFunction::operateStackOfDoubleSafe(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); if(fabs(v)>1.) throw INTERP_KERNEL::Exception("asin on a value which absolute is > 1 !"); stck.back()=asin(v); @@ -443,7 +449,8 @@ bool ASinFunction::isACall() const } ATanFunction::~ATanFunction() -= default; +{ +} void ATanFunction::operate(std::vector& stck) const { @@ -451,14 +458,14 @@ void ATanFunction::operate(std::vector& stck) const val->atan(); } -void ATanFunction::operateX86(std::vector& /*asmb*/) const +void ATanFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void ATanFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=atan(v); } @@ -473,7 +480,8 @@ bool ATanFunction::isACall() const } CoshFunction::~CoshFunction() -= default; +{ +} void CoshFunction::operate(std::vector& stck) const { @@ -481,14 +489,14 @@ void CoshFunction::operate(std::vector& stck) const val->cosh(); } -void CoshFunction::operateX86(std::vector& /*asmb*/) const +void CoshFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void CoshFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=cosh(v); } @@ -503,7 +511,8 @@ bool CoshFunction::isACall() const } SinhFunction::~SinhFunction() -= default; +{ +} void SinhFunction::operate(std::vector& stck) const { @@ -511,14 +520,14 @@ void SinhFunction::operate(std::vector& stck) const val->sinh(); } -void SinhFunction::operateX86(std::vector& /*asmb*/) const +void SinhFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void SinhFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=sinh(v); } @@ -533,7 +542,8 @@ bool SinhFunction::isACall() const } TanhFunction::~TanhFunction() -= default; +{ +} void TanhFunction::operate(std::vector& stck) const { @@ -541,14 +551,14 @@ void TanhFunction::operate(std::vector& stck) const val->tanh(); } -void TanhFunction::operateX86(std::vector& /*asmb*/) const +void TanhFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void TanhFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=tanh(v); } @@ -563,7 +573,8 @@ bool TanhFunction::isACall() const } SqrtFunction::~SqrtFunction() -= default; +{ +} void SqrtFunction::operate(std::vector& stck) const { @@ -578,13 +589,13 @@ void SqrtFunction::operateX86(std::vector& asmb) const void SqrtFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=sqrt(v); } void SqrtFunction::operateStackOfDoubleSafe(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); if(v<0.) throw INTERP_KERNEL::Exception("sqrt on a value < 0. !"); stck.back()=sqrt(v); @@ -601,7 +612,8 @@ bool SqrtFunction::isACall() const } AbsFunction::~AbsFunction() -= default; +{ +} void AbsFunction::operate(std::vector& stck) const { @@ -616,7 +628,7 @@ void AbsFunction::operateX86(std::vector& asmb) const void AbsFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=fabs(v); } @@ -636,14 +648,14 @@ void ExpFunction::operate(std::vector& stck) const val->exp(); } -void ExpFunction::operateX86(std::vector& /*asmb*/) const +void ExpFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void ExpFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=std::exp(v); } @@ -658,7 +670,8 @@ bool ExpFunction::isACall() const } LnFunction::~LnFunction() -= default; +{ +} void LnFunction::operate(std::vector& stck) const { @@ -666,20 +679,20 @@ void LnFunction::operate(std::vector& stck) const val->ln(); } -void LnFunction::operateX86(std::vector& /*asmb*/) const +void LnFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void LnFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=std::log(v); } void LnFunction::operateStackOfDoubleSafe(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); if(v<0.) throw INTERP_KERNEL::Exception("ln on a value < 0. !"); stck.back()=std::log(v); @@ -696,7 +709,8 @@ bool LnFunction::isACall() const } LogFunction::~LogFunction() -= default; +{ +} void LogFunction::operate(std::vector& stck) const { @@ -704,20 +718,20 @@ void LogFunction::operate(std::vector& stck) const val->ln(); } -void LogFunction::operateX86(std::vector& /*asmb*/) const +void LogFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !"); } void LogFunction::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=std::log(v); } void LogFunction::operateStackOfDoubleSafe(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); if(v<0.) throw INTERP_KERNEL::Exception("log on a value < 0. !"); stck.back()=std::log(v); @@ -734,7 +748,8 @@ bool LogFunction::isACall() const } Log10Function::~Log10Function() -= default; +{ +} void Log10Function::operate(std::vector& stck) const { @@ -742,20 +757,20 @@ void Log10Function::operate(std::vector& stck) const val->log10(); } -void Log10Function::operateX86(std::vector& /*asmb*/) const +void Log10Function::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !"); } void Log10Function::operateStackOfDouble(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); stck.back()=std::log10(v); } void Log10Function::operateStackOfDoubleSafe(std::vector& stck) const { - double const v(stck.back()); + double v(stck.back()); if(v<0.) throw INTERP_KERNEL::Exception("log10 on a value < 0. !"); stck.back()=std::log10(v); @@ -777,7 +792,8 @@ int BinaryFunction::getNbInputParams() const } PlusFunction::~PlusFunction() -= default; +{ +} void PlusFunction::operate(std::vector& stck) const { @@ -806,7 +822,7 @@ void PlusFunction::operateX86(std::vector& asmb) const void PlusFunction::operateStackOfDouble(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); stck.back()=a+stck.back(); } @@ -822,7 +838,8 @@ bool PlusFunction::isACall() const } MinusFunction::~MinusFunction() -= default; +{ +} void MinusFunction::operate(std::vector& stck) const { @@ -851,7 +868,7 @@ void MinusFunction::operateX86(std::vector& asmb) const void MinusFunction::operateStackOfDouble(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); stck.back()=a-stck.back(); } @@ -867,7 +884,8 @@ bool MinusFunction::isACall() const } MultFunction::~MultFunction() -= default; +{ +} void MultFunction::operate(std::vector& stck) const { @@ -887,7 +905,7 @@ void MultFunction::operateX86(std::vector& asmb) const void MultFunction::operateStackOfDouble(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); stck.back()=a*stck.back(); } @@ -903,7 +921,8 @@ bool MultFunction::isACall() const } DivFunction::~DivFunction() -= default; +{ +} void DivFunction::operate(std::vector& stck) const { @@ -932,14 +951,14 @@ void DivFunction::operateX86(std::vector& asmb) const void DivFunction::operateStackOfDouble(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); stck.back()=a/stck.back(); } void DivFunction::operateStackOfDoubleSafe(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); if(stck.back()==0.) throw INTERP_KERNEL::Exception("division by 0. !"); @@ -957,7 +976,8 @@ bool DivFunction::isACall() const } PowFunction::~PowFunction() -= default; +{ +} void PowFunction::operate(std::vector& stck) const { @@ -979,23 +999,23 @@ void PowFunction::operate(std::vector& stck) const val2=val3; } -void PowFunction::operateX86(std::vector& /*asmb*/) const +void PowFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void PowFunction::operateStackOfDouble(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); stck.back()=std::pow(a,stck.back()); } void PowFunction::operateStackOfDoubleSafe(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); - double const b(stck.back()); + double b(stck.back()); if(a<0.) throw INTERP_KERNEL::Exception("pow with val < 0. !"); stck.back()=std::pow(a,b); @@ -1012,10 +1032,12 @@ bool PowFunction::isACall() const } ExpFunction::~ExpFunction() -= default; +{ +} MaxFunction::~MaxFunction() -= default; +{ +} void MaxFunction::operate(std::vector& stck) const { @@ -1037,14 +1059,14 @@ void MaxFunction::operate(std::vector& stck) const val2=val3; } -void MaxFunction::operateX86(std::vector& /*asmb*/) const +void MaxFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void MaxFunction::operateStackOfDouble(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); stck.back()=std::max(stck.back(),a); } @@ -1060,7 +1082,8 @@ bool MaxFunction::isACall() const } MinFunction::~MinFunction() -= default; +{ +} void MinFunction::operate(std::vector& stck) const { @@ -1082,14 +1105,14 @@ void MinFunction::operate(std::vector& stck) const val2=val3; } -void MinFunction::operateX86(std::vector& /*asmb*/) const +void MinFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void MinFunction::operateStackOfDouble(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); stck.back()=std::min(stck.back(),a); } @@ -1105,7 +1128,8 @@ bool MinFunction::isACall() const } GreaterThanFunction::~GreaterThanFunction() -= default; +{ +} void GreaterThanFunction::operate(std::vector& stck) const { @@ -1127,16 +1151,16 @@ void GreaterThanFunction::operate(std::vector& stck) const val2=val3; } -void GreaterThanFunction::operateX86(std::vector& /*asmb*/) const +void GreaterThanFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void GreaterThanFunction::operateStackOfDouble(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); - double const b(stck.back()); + double b(stck.back()); stck.back()=a>b?std::numeric_limits::max():-std::numeric_limits::max(); } @@ -1151,7 +1175,8 @@ bool GreaterThanFunction::isACall() const } LowerThanFunction::~LowerThanFunction() -= default; +{ +} void LowerThanFunction::operate(std::vector& stck) const { @@ -1173,16 +1198,16 @@ void LowerThanFunction::operate(std::vector& stck) const val2=val3; } -void LowerThanFunction::operateX86(std::vector& /*asmb*/) const +void LowerThanFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void LowerThanFunction::operateStackOfDouble(std::vector& stck) const { - double const a(stck.back()); + double a(stck.back()); stck.pop_back(); - double const b(stck.back()); + double b(stck.back()); stck.back()=a::max():-std::numeric_limits::max(); } @@ -1202,7 +1227,8 @@ int TernaryFunction::getNbInputParams() const } IfFunction::~IfFunction() -= default; +{ +} void IfFunction::operate(std::vector& stck) const { @@ -1228,16 +1254,16 @@ void IfFunction::operate(std::vector& stck) const val3=val4; } -void IfFunction::operateX86(std::vector& /*asmb*/) const +void IfFunction::operateX86(std::vector& asmb) const { throw INTERP_KERNEL::Exception("Assembly Not implemented yet !"); } void IfFunction::operateStackOfDouble(std::vector& stck) const { - double const cond(stck.back()); + double cond(stck.back()); stck.pop_back(); - double const the(stck.back()); + double the(stck.back()); stck.pop_back(); if(cond==std::numeric_limits::max()) stck.back()=the; @@ -1245,9 +1271,9 @@ void IfFunction::operateStackOfDouble(std::vector& stck) const void IfFunction::operateStackOfDoubleSafe(std::vector& stck) const { - double const cond(stck.back()); + double cond(stck.back()); stck.pop_back(); - double const the(stck.back()); + double the(stck.back()); stck.pop_back(); if(cond!=std::numeric_limits::max() && cond!=-std::numeric_limits::max()) throw INTERP_KERNEL::Exception("ifFunc : first parameter of ternary func is NOT a consequence of a boolean op !"); diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.hxx b/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.hxx index 5b0240141..c55fbc921 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.hxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.hxx @@ -22,8 +22,8 @@ #define __INTERPKERNELFUNCTION_HXX__ #include "INTERPKERNELDefines.hxx" +#include "InterpKernelException.hxx" -#include #include namespace INTERP_KERNEL @@ -59,19 +59,19 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT UnaryFunction : public Function { public: - int getNbInputParams() const override; + int getNbInputParams() const; }; class INTERPKERNEL_EXPORT IdentityFunction : public UnaryFunction { public: - ~IdentityFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - IdentityFunction *deepCopy() const override { return new IdentityFunction; } + ~IdentityFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + IdentityFunction *deepCopy() const { return new IdentityFunction; } public: static const char REPR[]; }; @@ -79,13 +79,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT PositiveFunction : public UnaryFunction { public: - ~PositiveFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - PositiveFunction *deepCopy() const override { return new PositiveFunction; } + ~PositiveFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + PositiveFunction *deepCopy() const { return new PositiveFunction; } public: static const char REPR[]; }; @@ -93,13 +93,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT NegateFunction : public UnaryFunction { public: - ~NegateFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - NegateFunction *deepCopy() const override { return new NegateFunction; } + ~NegateFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + NegateFunction *deepCopy() const { return new NegateFunction; } public: static const char REPR[]; }; @@ -107,13 +107,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT CosFunction : public UnaryFunction { public: - ~CosFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - CosFunction *deepCopy() const override { return new CosFunction; } + ~CosFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + CosFunction *deepCopy() const { return new CosFunction; } public: static const char REPR[]; }; @@ -121,13 +121,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT SinFunction : public UnaryFunction { public: - ~SinFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - SinFunction *deepCopy() const override { return new SinFunction; } + ~SinFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + SinFunction *deepCopy() const { return new SinFunction; } public: static const char REPR[]; }; @@ -135,13 +135,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT TanFunction : public UnaryFunction { public: - ~TanFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - TanFunction *deepCopy() const override { return new TanFunction; } + ~TanFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + TanFunction *deepCopy() const { return new TanFunction; } public: static const char REPR[]; }; @@ -149,14 +149,14 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT ACosFunction : public UnaryFunction { public: - ~ACosFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - void operateStackOfDoubleSafe(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - ACosFunction *deepCopy() const override { return new ACosFunction; } + ~ACosFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + void operateStackOfDoubleSafe(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + ACosFunction *deepCopy() const { return new ACosFunction; } public: static const char REPR[]; }; @@ -164,14 +164,14 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT ASinFunction : public UnaryFunction { public: - ~ASinFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - void operateStackOfDoubleSafe(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - ASinFunction *deepCopy() const override { return new ASinFunction; } + ~ASinFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + void operateStackOfDoubleSafe(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + ASinFunction *deepCopy() const { return new ASinFunction; } public: static const char REPR[]; }; @@ -179,13 +179,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT ATanFunction : public UnaryFunction { public: - ~ATanFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - ATanFunction *deepCopy() const override { return new ATanFunction; } + ~ATanFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + ATanFunction *deepCopy() const { return new ATanFunction; } public: static const char REPR[]; }; @@ -193,13 +193,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT CoshFunction : public UnaryFunction { public: - ~CoshFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - CoshFunction *deepCopy() const override { return new CoshFunction; } + ~CoshFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + CoshFunction *deepCopy() const { return new CoshFunction; } public: static const char REPR[]; }; @@ -207,13 +207,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT SinhFunction : public UnaryFunction { public: - ~SinhFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - SinhFunction *deepCopy() const override { return new SinhFunction; } + ~SinhFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + SinhFunction *deepCopy() const { return new SinhFunction; } public: static const char REPR[]; }; @@ -221,13 +221,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT TanhFunction : public UnaryFunction { public: - ~TanhFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - TanhFunction *deepCopy() const override { return new TanhFunction; } + ~TanhFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + TanhFunction *deepCopy() const { return new TanhFunction; } public: static const char REPR[]; }; @@ -235,14 +235,14 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT SqrtFunction : public UnaryFunction { public: - ~SqrtFunction() override; - void operateX86(std::vector& asmb) const override; - void operate(std::vector& stck) const override; - void operateStackOfDouble(std::vector& stck) const override; - void operateStackOfDoubleSafe(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - SqrtFunction *deepCopy() const override { return new SqrtFunction; } + ~SqrtFunction(); + void operateX86(std::vector& asmb) const; + void operate(std::vector& stck) const; + void operateStackOfDouble(std::vector& stck) const; + void operateStackOfDoubleSafe(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + SqrtFunction *deepCopy() const { return new SqrtFunction; } public: static const char REPR[]; }; @@ -250,13 +250,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT AbsFunction : public UnaryFunction { public: - ~AbsFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - AbsFunction *deepCopy() const override { return new AbsFunction; } + ~AbsFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + AbsFunction *deepCopy() const { return new AbsFunction; } public: static const char REPR[]; }; @@ -264,13 +264,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT ExpFunction : public UnaryFunction { public: - ~ExpFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - ExpFunction *deepCopy() const override { return new ExpFunction; } + ~ExpFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + ExpFunction *deepCopy() const { return new ExpFunction; } public: static const char REPR[]; }; @@ -278,14 +278,14 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT LnFunction : public UnaryFunction { public: - ~LnFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - void operateStackOfDoubleSafe(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - LnFunction *deepCopy() const override { return new LnFunction; } + ~LnFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + void operateStackOfDoubleSafe(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + LnFunction *deepCopy() const { return new LnFunction; } public: static const char REPR[]; }; @@ -293,14 +293,14 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT LogFunction : public UnaryFunction { public: - ~LogFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - void operateStackOfDoubleSafe(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - LogFunction *deepCopy() const override { return new LogFunction; } + ~LogFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + void operateStackOfDoubleSafe(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + LogFunction *deepCopy() const { return new LogFunction; } public: static const char REPR[]; }; @@ -308,14 +308,14 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT Log10Function : public UnaryFunction { public: - ~Log10Function() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - void operateStackOfDoubleSafe(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - Log10Function *deepCopy() const override { return new Log10Function; } + ~Log10Function(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + void operateStackOfDoubleSafe(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + Log10Function *deepCopy() const { return new Log10Function; } public: static const char REPR[]; }; @@ -323,19 +323,19 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT BinaryFunction : public Function { public: - int getNbInputParams() const override; + int getNbInputParams() const; }; class PlusFunction : public BinaryFunction { public: - ~PlusFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - PlusFunction *deepCopy() const override { return new PlusFunction; } + ~PlusFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + PlusFunction *deepCopy() const { return new PlusFunction; } public: static const char REPR[]; }; @@ -343,13 +343,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT MinusFunction : public BinaryFunction { public: - ~MinusFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - MinusFunction *deepCopy() const override { return new MinusFunction; } + ~MinusFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + MinusFunction *deepCopy() const { return new MinusFunction; } public: static const char REPR[]; }; @@ -357,13 +357,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT MultFunction : public BinaryFunction { public: - ~MultFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - MultFunction *deepCopy() const override { return new MultFunction; } + ~MultFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + MultFunction *deepCopy() const { return new MultFunction; } public: static const char REPR[]; }; @@ -371,14 +371,14 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT DivFunction : public BinaryFunction { public: - ~DivFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - void operateStackOfDoubleSafe(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - DivFunction *deepCopy() const override { return new DivFunction; } + ~DivFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + void operateStackOfDoubleSafe(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + DivFunction *deepCopy() const { return new DivFunction; } public: static const char REPR[]; }; @@ -386,14 +386,14 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT PowFunction : public BinaryFunction { public: - ~PowFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - void operateStackOfDoubleSafe(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - PowFunction *deepCopy() const override { return new PowFunction; } + ~PowFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + void operateStackOfDoubleSafe(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + PowFunction *deepCopy() const { return new PowFunction; } public: static const char REPR[]; }; @@ -401,13 +401,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT MaxFunction : public BinaryFunction { public: - ~MaxFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - MaxFunction *deepCopy() const override { return new MaxFunction; } + ~MaxFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + MaxFunction *deepCopy() const { return new MaxFunction; } public: static const char REPR[]; }; @@ -415,13 +415,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT MinFunction : public BinaryFunction { public: - ~MinFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - MinFunction *deepCopy() const override { return new MinFunction; } + ~MinFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + MinFunction *deepCopy() const { return new MinFunction; } public: static const char REPR[]; }; @@ -429,13 +429,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT GreaterThanFunction : public BinaryFunction { public: - ~GreaterThanFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - GreaterThanFunction *deepCopy() const override { return new GreaterThanFunction; } + ~GreaterThanFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + GreaterThanFunction *deepCopy() const { return new GreaterThanFunction; } public: static const char REPR[]; }; @@ -443,13 +443,13 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT LowerThanFunction : public BinaryFunction { public: - ~LowerThanFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - LowerThanFunction *deepCopy() const override { return new LowerThanFunction; } + ~LowerThanFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + LowerThanFunction *deepCopy() const { return new LowerThanFunction; } public: static const char REPR[]; }; @@ -457,20 +457,20 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT TernaryFunction : public Function { public: - int getNbInputParams() const override; + int getNbInputParams() const; }; class INTERPKERNEL_EXPORT IfFunction : public TernaryFunction { public: - ~IfFunction() override; - void operate(std::vector& stck) const override; - void operateX86(std::vector& asmb) const override; - void operateStackOfDouble(std::vector& stck) const override; - void operateStackOfDoubleSafe(std::vector& stck) const override; - const char *getRepr() const override; - bool isACall() const override; - IfFunction *deepCopy() const override { return new IfFunction; } + ~IfFunction(); + void operate(std::vector& stck) const; + void operateX86(std::vector& asmb) const; + void operateStackOfDouble(std::vector& stck) const; + void operateStackOfDoubleSafe(std::vector& stck) const; + const char *getRepr() const; + bool isACall() const; + IfFunction *deepCopy() const { return new IfFunction; } public: static const char REPR[]; }; diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx index b337123bb..f02596139 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx @@ -20,22 +20,18 @@ #include "InterpKernelUnit.hxx" #include "InterpKernelExprParser.hxx" -#include "InterpKernelException.hxx" #include #include -#include -#include #include #include #include -#include using namespace INTERP_KERNEL; const UnitDataBase& UnitDataBase::GetUniqueMapForExpr() { - static UnitDataBase const db; + static UnitDataBase db; return db; } @@ -116,19 +112,19 @@ UnitDataBase::UnitDataBase() const short *UnitDataBase::getInfoForUnit(const std::string& unit, double& addFact, double& mFact) const { - std::size_t const lgth=unit.length(); + std::size_t lgth=unit.length(); std::string work,work2; - const short *ret=nullptr; + const short *ret=0; for(std::size_t i=0;i::const_iterator iter=_units_semantic.find(work); if(iter!=_units_semantic.end()) { ret=(*iter).second; - auto const iter2=_units_add.find(work); + std::map::const_iterator iter2=_units_add.find(work); addFact=(*iter2).second; - auto const iter3=_units_mul.find(work); + std::map::const_iterator iter3=_units_mul.find(work); mFact=(*iter3).second; work2=unit.substr(0,i); } @@ -141,7 +137,7 @@ const short *UnitDataBase::getInfoForUnit(const std::string& unit, double& addFa } if(!work2.empty()) { - auto const iter4=_prefix_pow_10.find(work2); + std::map::const_iterator iter4=_prefix_pow_10.find(work2); if(iter4==_prefix_pow_10.end()) { std::ostringstream os; @@ -196,13 +192,13 @@ void DecompositionInUnitBase::getTranslationParams(const DecompositionInUnitBase bool DecompositionInUnitBase::isEqual(short mass, short lgth, short time, short intensity, short temp, double add, double mult) { - bool const ret1=mass==_value[0]; - bool const ret2=lgth==_value[1]; - bool const ret3=time==_value[2]; - bool const ret4=intensity==_value[3]; - bool const ret5=temp==_value[4]; - bool const ret6=areDoubleEquals(add,_add_to_base); - bool const ret7=areDoubleEquals(mult,_mult_fact_to_base); + bool ret1=mass==_value[0]; + bool ret2=lgth==_value[1]; + bool ret3=time==_value[2]; + bool ret4=intensity==_value[3]; + bool ret5=temp==_value[4]; + bool ret6=areDoubleEquals(add,_add_to_base); + bool ret7=areDoubleEquals(mult,_mult_fact_to_base); return ret1 && ret2 && ret3 && ret4 && ret5 && ret6 && ret7; } @@ -223,7 +219,7 @@ bool DecompositionInUnitBase::isUnitary() const void DecompositionInUnitBase::tryToConvertInUnit(double val) { - int const valI=(int)val; + int valI=(int)val; if((val-(double)valI)!=0.) { std::ostringstream os; @@ -261,7 +257,7 @@ DecompositionInUnitBase &DecompositionInUnitBase::operator^(const DecompositionI { if(!other.isAdimensional()) throw INTERP_KERNEL::Exception("Trying to execute operator ^ with a second member not adimensionnal"); - int const exp=couldItBeConsideredAsInt(other._mult_fact_to_base); + int exp=couldItBeConsideredAsInt(other._mult_fact_to_base); // *= causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]' _value[0]=(short)(_value[0]*exp); _value[1]=(short)(_value[1]*exp); _value[2]=(short)(_value[2]*exp); _value[3]=(short)(_value[3]*exp); _value[4]=(short)(_value[4]*exp); _mult_fact_to_base=powInt(_mult_fact_to_base,exp); @@ -292,7 +288,7 @@ double DecompositionInUnitBase::powInt(double val, int exp) work*=val; else { - int const tmp=-exp; + int tmp=-exp; for(int i=0;i -#include +#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx index 15f542d98..9c6b83ab0 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx @@ -20,14 +20,11 @@ #include "InterpKernelValue.hxx" #include "InterpKernelFunction.hxx" -#include "InterpKernelUnit.hxx" -#include "InterpKernelException.hxx" #include #include #include #include -#include using namespace INTERP_KERNEL; @@ -49,7 +46,7 @@ void ValueDouble::setDouble(double val) _data=val; } -void ValueDouble::setVarname(int /*fastPos*/, const std::string& var) +void ValueDouble::setVarname(int fastPos, const std::string& var) { std::string msg("Error var : "); msg+=var; msg+=" not numeric : use another expression evaluator !"; throw INTERP_KERNEL::Exception(msg.c_str()); @@ -202,14 +199,15 @@ Value *ValueDouble::ifFunc(const Value *the, const Value *els) const const ValueDouble *ValueDouble::checkSameType(const Value *val) { - const auto *valC=dynamic_cast(val); + const ValueDouble *valC=dynamic_cast(val); if(!valC) throw INTERP_KERNEL::Exception("Trying to operate on non homogeneous Values (double with other type) !"); return valC; } ValueUnit::ValueUnit() -= default; +{ +} Value *ValueUnit::newInstance() const { @@ -225,7 +223,7 @@ void ValueUnit::setDouble(double val) _data.tryToConvertInUnit(val); } -void ValueUnit::setVarname(int /*fastPos*/, const std::string& var) +void ValueUnit::setVarname(int fastPos, const std::string& var) { double add,mul; const short *projInBase=UnitDataBase::GetUniqueMapForExpr().getInfoForUnit(var,add,mul); @@ -312,34 +310,34 @@ void ValueUnit::log10() unsupportedOp(Log10Function::REPR); } -Value *ValueUnit::plus(const Value * /*other*/) const +Value *ValueUnit::plus(const Value *other) const { unsupportedOp(PlusFunction::REPR); - return nullptr; + return 0; } -Value *ValueUnit::minus(const Value * /*other*/) const +Value *ValueUnit::minus(const Value *other) const { unsupportedOp(MinusFunction::REPR); - return nullptr; + return 0; } -Value *ValueUnit::greaterThan(const Value * /*other*/) const +Value *ValueUnit::greaterThan(const Value *other) const { unsupportedOp(GreaterThanFunction::REPR); - return nullptr; + return 0; } -Value *ValueUnit::lowerThan(const Value * /*other*/) const +Value *ValueUnit::lowerThan(const Value *other) const { unsupportedOp(LowerThanFunction::REPR); - return nullptr; + return 0; } -Value *ValueUnit::ifFunc(const Value * /*the*/, const Value * /*els*/) const +Value *ValueUnit::ifFunc(const Value *the, const Value *els) const { unsupportedOp(IfFunction::REPR); - return nullptr; + return 0; } Value *ValueUnit::mult(const Value *other) const @@ -366,21 +364,21 @@ Value *ValueUnit::pow(const Value *other) const return new ValueUnit(tmp); } -Value *ValueUnit::max(const Value * /*other*/) const +Value *ValueUnit::max(const Value *other) const { unsupportedOp(MaxFunction::REPR); - return nullptr; + return 0; } -Value *ValueUnit::min(const Value * /*other*/) const +Value *ValueUnit::min(const Value *other) const { unsupportedOp(MinFunction::REPR); - return nullptr; + return 0; } const ValueUnit *ValueUnit::checkSameType(const Value *val) { - const auto *valC=dynamic_cast(val); + const ValueUnit *valC=dynamic_cast(val); if(!valC) throw INTERP_KERNEL::Exception("Trying to operate on non homogeneous Values (Units with other type) !"); return valC; @@ -413,7 +411,7 @@ void ValueDoubleExpr::setDouble(double val) std::fill(_dest_data,_dest_data+_sz_dest_data,val); } -void ValueDoubleExpr::setVarname(int fastPos, const std::string& /*var*/) +void ValueDoubleExpr::setVarname(int fastPos, const std::string& var) { if(fastPos==-2) std::copy(_src_data,_src_data+_sz_dest_data,_dest_data); @@ -528,71 +526,71 @@ void ValueDoubleExpr::log10() Value *ValueDoubleExpr::plus(const Value *other) const { - const auto *otherC=static_cast(other); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + const ValueDoubleExpr *otherC=static_cast(other); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::plus()); return ret; } Value *ValueDoubleExpr::minus(const Value *other) const { - const auto *otherC=static_cast(other); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + const ValueDoubleExpr *otherC=static_cast(other); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::minus()); return ret; } Value *ValueDoubleExpr::mult(const Value *other) const { - const auto *otherC=static_cast(other); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + const ValueDoubleExpr *otherC=static_cast(other); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::multiplies()); return ret; } Value *ValueDoubleExpr::div(const Value *other) const { - const auto *otherC=static_cast(other); + const ValueDoubleExpr *otherC=static_cast(other); double *it=std::find(otherC->getData(),otherC->getData()+_sz_dest_data,0.); if(it!=otherC->getData()+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to operate division by 0. !"); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::divides()); return ret; } Value *ValueDoubleExpr::pow(const Value *other) const { - const auto *otherC=static_cast(other); - double const p=otherC->getData()[0]; + const ValueDoubleExpr *otherC=static_cast(other); + double p=otherC->getData()[0]; double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::less(),std::placeholders::_1,0.)); if(it!=_dest_data+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to operate pow(a,b) with a<0. !"); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); std::transform(_dest_data,_dest_data+_sz_dest_data,ret->getData(),std::bind([](double x, double y){return std::pow(x,y);},std::placeholders::_1,p)); return ret; } Value *ValueDoubleExpr::max(const Value *other) const { - const auto *otherC=static_cast(other); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + const ValueDoubleExpr *otherC=static_cast(other); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),[](const double& x, const double& y){return std::max(x,y);}); return ret; } Value *ValueDoubleExpr::min(const Value *other) const { - const auto *otherC=static_cast(other); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + const ValueDoubleExpr *otherC=static_cast(other); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),[](const double& x, const double& y){return std::min(x,y);}); return ret; } Value *ValueDoubleExpr::greaterThan(const Value *other) const { - const auto *otherC=static_cast(other); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + const ValueDoubleExpr *otherC=static_cast(other); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); for(int i=0;i<_sz_dest_data;i++) if(_dest_data[i]<=otherC->getData()[i]) { @@ -605,8 +603,8 @@ Value *ValueDoubleExpr::greaterThan(const Value *other) const Value *ValueDoubleExpr::lowerThan(const Value *other) const { - const auto *otherC=static_cast(other); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + const ValueDoubleExpr *otherC=static_cast(other); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); for(int i=0;i<_sz_dest_data;i++) if(_dest_data[i]>=otherC->getData()[i]) { @@ -619,9 +617,9 @@ Value *ValueDoubleExpr::lowerThan(const Value *other) const Value *ValueDoubleExpr::ifFunc(const Value *the, const Value *els) const { - const auto *theC=static_cast(the); - const auto *elsC=static_cast(els); - auto *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); + const ValueDoubleExpr *theC=static_cast(the); + const ValueDoubleExpr *elsC=static_cast(els); + ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); bool okmax=true; bool okmin=true; for(int i=0;i<_sz_dest_data && (okmax || okmin);i++) diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelValue.hxx b/src/INTERP_KERNEL/ExprEval/InterpKernelValue.hxx index 5b69033f6..e0b80ff65 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelValue.hxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelValue.hxx @@ -22,8 +22,8 @@ #define __INTERPKERNELVALUE_HXX__ #include "INTERPKERNELDefines.hxx" +#include "InterpKernelException.hxx" #include "InterpKernelUnit.hxx" -#include namespace INTERP_KERNEL { @@ -31,7 +31,7 @@ namespace INTERP_KERNEL { public: virtual Value *newInstance() const = 0; - virtual ~Value() = default; + virtual ~Value() { } virtual void setDouble(double val) = 0; virtual void setVarname(int fastPos, const std::string& var) = 0; //unary @@ -69,39 +69,39 @@ namespace INTERP_KERNEL { public: ValueDouble(); - Value *newInstance() const override; - void setDouble(double val) override; - void setVarname(int fastPos, const std::string& var) override; + Value *newInstance() const; + void setDouble(double val); + void setVarname(int fastPos, const std::string& var); // double getData() const { return _data; } - void positive() override; - void negate() override; - void sqrt() override; - void cos() override; - void sin() override; - void tan() override; - void acos() override; - void asin() override; - void atan() override; - void cosh() override; - void sinh() override; - void tanh() override; - void abs() override; - void exp() override; - void ln() override; - void log10() override; + void positive(); + void negate(); + void sqrt(); + void cos(); + void sin(); + void tan(); + void acos(); + void asin(); + void atan(); + void cosh(); + void sinh(); + void tanh(); + void abs(); + void exp(); + void ln(); + void log10(); // - Value *plus(const Value *other) const override; - Value *minus(const Value *other) const override; - Value *mult(const Value *other) const override; - Value *div(const Value *other) const override; - Value *pow(const Value *other) const override; - Value *max(const Value *other) const override; - Value *min(const Value *other) const override; - Value *greaterThan(const Value *other) const override; - Value *lowerThan(const Value *other) const override; + Value *plus(const Value *other) const; + Value *minus(const Value *other) const; + Value *mult(const Value *other) const; + Value *div(const Value *other) const; + Value *pow(const Value *other) const; + Value *max(const Value *other) const; + Value *min(const Value *other) const; + Value *greaterThan(const Value *other) const; + Value *lowerThan(const Value *other) const; // - Value *ifFunc(const Value *the, const Value *els) const override; + Value *ifFunc(const Value *the, const Value *els) const; private: ValueDouble(double val); static const ValueDouble *checkSameType(const Value *val); @@ -113,39 +113,39 @@ namespace INTERP_KERNEL { public: INTERPKERNEL_EXPORT ValueUnit(); - INTERPKERNEL_EXPORT Value *newInstance() const override; - INTERPKERNEL_EXPORT void setDouble(double val) override; - INTERPKERNEL_EXPORT void setVarname(int fastPos, const std::string& var) override; + INTERPKERNEL_EXPORT Value *newInstance() const; + INTERPKERNEL_EXPORT void setDouble(double val); + INTERPKERNEL_EXPORT void setVarname(int fastPos, const std::string& var); // INTERPKERNEL_EXPORT DecompositionInUnitBase getData() const { return _data; } - INTERPKERNEL_EXPORT void positive() override; - INTERPKERNEL_EXPORT void negate() override; - INTERPKERNEL_EXPORT void sqrt() override; - INTERPKERNEL_EXPORT void cos() override; - INTERPKERNEL_EXPORT void sin() override; - INTERPKERNEL_EXPORT void tan() override; - INTERPKERNEL_EXPORT void acos() override; - INTERPKERNEL_EXPORT void asin() override; - INTERPKERNEL_EXPORT void atan() override; - INTERPKERNEL_EXPORT void cosh() override; - INTERPKERNEL_EXPORT void sinh() override; - INTERPKERNEL_EXPORT void tanh() override; - INTERPKERNEL_EXPORT void abs() override; - INTERPKERNEL_EXPORT void exp() override; - INTERPKERNEL_EXPORT void ln() override; - INTERPKERNEL_EXPORT void log10() override; + INTERPKERNEL_EXPORT void positive(); + INTERPKERNEL_EXPORT void negate(); + INTERPKERNEL_EXPORT void sqrt(); + INTERPKERNEL_EXPORT void cos(); + INTERPKERNEL_EXPORT void sin(); + INTERPKERNEL_EXPORT void tan(); + INTERPKERNEL_EXPORT void acos(); + INTERPKERNEL_EXPORT void asin(); + INTERPKERNEL_EXPORT void atan(); + INTERPKERNEL_EXPORT void cosh(); + INTERPKERNEL_EXPORT void sinh(); + INTERPKERNEL_EXPORT void tanh(); + INTERPKERNEL_EXPORT void abs(); + INTERPKERNEL_EXPORT void exp(); + INTERPKERNEL_EXPORT void ln(); + INTERPKERNEL_EXPORT void log10(); // - INTERPKERNEL_EXPORT Value *plus(const Value *other) const override; - INTERPKERNEL_EXPORT Value *minus(const Value *other) const override; - INTERPKERNEL_EXPORT Value *mult(const Value *other) const override; - INTERPKERNEL_EXPORT Value *div(const Value *other) const override; - INTERPKERNEL_EXPORT Value *pow(const Value *other) const override; - INTERPKERNEL_EXPORT Value *max(const Value *other) const override; - INTERPKERNEL_EXPORT Value *min(const Value *other) const override; - INTERPKERNEL_EXPORT Value *greaterThan(const Value *other) const override; - INTERPKERNEL_EXPORT Value *lowerThan(const Value *other) const override; + INTERPKERNEL_EXPORT Value *plus(const Value *other) const; + INTERPKERNEL_EXPORT Value *minus(const Value *other) const; + INTERPKERNEL_EXPORT Value *mult(const Value *other) const; + INTERPKERNEL_EXPORT Value *div(const Value *other) const; + INTERPKERNEL_EXPORT Value *pow(const Value *other) const; + INTERPKERNEL_EXPORT Value *max(const Value *other) const; + INTERPKERNEL_EXPORT Value *min(const Value *other) const; + INTERPKERNEL_EXPORT Value *greaterThan(const Value *other) const; + INTERPKERNEL_EXPORT Value *lowerThan(const Value *other) const; // - INTERPKERNEL_EXPORT Value *ifFunc(const Value *the, const Value *els) const override; + INTERPKERNEL_EXPORT Value *ifFunc(const Value *the, const Value *els) const; private: ValueUnit(const DecompositionInUnitBase& unit); static void unsupportedOp(const char *type); @@ -158,40 +158,40 @@ namespace INTERP_KERNEL { public: ValueDoubleExpr(int szDestData, const double *srcData); - ~ValueDoubleExpr() override; + ~ValueDoubleExpr(); double *getData() const { return _dest_data; } - Value *newInstance() const override; - void setDouble(double val) override; - void setVarname(int fastPos, const std::string& var) override; + Value *newInstance() const; + void setDouble(double val); + void setVarname(int fastPos, const std::string& var); // - void positive() override; - void negate() override; - void sqrt() override; - void cos() override; - void sin() override; - void tan() override; - void acos() override; - void asin() override; - void atan() override; - void cosh() override; - void sinh() override; - void tanh() override; - void abs() override; - void exp() override; - void ln() override; - void log10() override; + void positive(); + void negate(); + void sqrt(); + void cos(); + void sin(); + void tan(); + void acos(); + void asin(); + void atan(); + void cosh(); + void sinh(); + void tanh(); + void abs(); + void exp(); + void ln(); + void log10(); // - Value *plus(const Value *other) const override; - Value *minus(const Value *other) const override; - Value *mult(const Value *other) const override; - Value *div(const Value *other) const override; - Value *pow(const Value *other) const override; - Value *max(const Value *other) const override; - Value *min(const Value *other) const override; - Value *greaterThan(const Value *other) const override; - Value *lowerThan(const Value *other) const override; + Value *plus(const Value *other) const; + Value *minus(const Value *other) const; + Value *mult(const Value *other) const; + Value *div(const Value *other) const; + Value *pow(const Value *other) const; + Value *max(const Value *other) const; + Value *min(const Value *other) const; + Value *greaterThan(const Value *other) const; + Value *lowerThan(const Value *other) const; // - Value *ifFunc(const Value *the, const Value *els) const override; + Value *ifFunc(const Value *the, const Value *els) const; private: int _sz_dest_data; double *_dest_data; diff --git a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx index fccd67bfa..fe06a52bd 100644 --- a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx +++ b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx @@ -20,17 +20,12 @@ //Local includes #include "InterpKernelGaussCoords.hxx" #include "CellModel.hxx" -#include "NormalizedGeometricTypes" -#include "InterpKernelException.hxx" -#include "MCIdType.hxx" //STL includes -#include #include #include #include #include -#include using namespace INTERP_KERNEL; @@ -149,7 +144,7 @@ const double GaussInfo::HEXA27A_REF[81]={-1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, //--------------------------------------------------------------- static bool IsEqual(double theLeft, double theRight) { - static double const EPS = 1.0E-3; + static double EPS = 1.0E-3; if(fabs(theLeft) + fabs(theRight) > EPS) return fabs(theLeft-theRight)/(fabs(theLeft)+fabs(theRight)) < EPS; return true; @@ -183,7 +178,8 @@ GaussInfo::GaussInfo( NormalizedCellType theGeometry, * Destructor */ GaussInfo::~GaussInfo() -= default; +{ +} /*! * Return dimension of the gauss coordinates @@ -245,10 +241,10 @@ GaussInfo GaussInfo::convertToLinear() const { case NORM_SEG3: { - std::vector const a(SEG3_REF,SEG3_REF+3); + std::vector a(SEG3_REF,SEG3_REF+3); if(IsSatisfy(a,_my_reference_coord)) { - std::vector const c(SEG2A_REF,SEG2A_REF+2); + std::vector c(SEG2A_REF,SEG2A_REF+2); return GaussInfo(NORM_SEG2,_my_gauss_coord,getNbGauss(),c,2); } throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for SEG3 !"); @@ -258,22 +254,22 @@ GaussInfo GaussInfo::convertToLinear() const std::vector a(TRIA6A_REF,TRIA6A_REF+12),b(TRIA6B_REF,TRIA6B_REF+12); if(IsSatisfy(a,_my_reference_coord)) { - std::vector const c(TRIA3A_REF,TRIA3A_REF+6); + std::vector c(TRIA3A_REF,TRIA3A_REF+6); return GaussInfo(NORM_TRI3,_my_gauss_coord,getNbGauss(),c,3); } if(IsSatisfy(b,_my_reference_coord)) { - std::vector const c(TRIA3B_REF,TRIA3B_REF+6); + std::vector c(TRIA3B_REF,TRIA3B_REF+6); return GaussInfo(NORM_TRI3,_my_gauss_coord,getNbGauss(),c,3); } throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for TRI6 !"); } case NORM_TRI7: { - std::vector const a(TRIA7A_REF,TRIA7A_REF+14); + std::vector a(TRIA7A_REF,TRIA7A_REF+14); if(IsSatisfy(a,_my_reference_coord)) { - std::vector const c(TRIA3B_REF,TRIA3B_REF+6); + std::vector c(TRIA3B_REF,TRIA3B_REF+6); return GaussInfo(NORM_TRI3,_my_gauss_coord,getNbGauss(),c,3); } throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for TRI7 !"); @@ -283,22 +279,22 @@ GaussInfo GaussInfo::convertToLinear() const std::vector a(QUAD8A_REF,QUAD8A_REF+16),b(QUAD8B_REF,QUAD8B_REF+16); if(IsSatisfy(a,_my_reference_coord)) { - std::vector const c(QUAD4A_REF,QUAD4A_REF+8); + std::vector c(QUAD4A_REF,QUAD4A_REF+8); return GaussInfo(NORM_QUAD4,_my_gauss_coord,getNbGauss(),c,4); } if(IsSatisfy(b,_my_reference_coord)) { - std::vector const c(QUAD4B_REF,QUAD4B_REF+8); + std::vector c(QUAD4B_REF,QUAD4B_REF+8); return GaussInfo(NORM_QUAD4,_my_gauss_coord,getNbGauss(),c,4); } throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for QUAD8 !"); } case NORM_QUAD9: { - std::vector const a(QUAD9A_REF,QUAD9A_REF+18); + std::vector a(QUAD9A_REF,QUAD9A_REF+18); if(IsSatisfy(a,_my_reference_coord)) { - std::vector const c(QUAD4B_REF,QUAD4B_REF+8); + std::vector c(QUAD4B_REF,QUAD4B_REF+8); return GaussInfo(NORM_QUAD4,_my_gauss_coord,getNbGauss(),c,4); } throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for QUAD9 !"); @@ -308,7 +304,7 @@ GaussInfo GaussInfo::convertToLinear() const std::vector a(TETRA10A_REF,TETRA10A_REF+30),b(TETRA10B_REF,TETRA10B_REF+30); if(IsSatisfy(a,_my_reference_coord)) { - std::vector const c(TETRA4A_REF,TETRA4A_REF+12); + std::vector c(TETRA4A_REF,TETRA4A_REF+12); return GaussInfo(NORM_TETRA4,_my_gauss_coord,getNbGauss(),c,4); } if(IsSatisfy(b,_my_reference_coord)) @@ -411,7 +407,7 @@ bool GaussInfo::IsSatisfy(const std::vector& ref1, const std::vector GaussInfo::NormalizeCoordinatesIfNecessary(NormalizedCellTyp if(sz%dim!=0) throw INTERP_KERNEL::Exception("GaussInfo::NormalizeCoordinatesIfNecessary : invalid input array ! Inconsistent with the given dimension !"); const CellModel& cm(CellModel::GetCellModel(ct)); - auto const baseDim((std::size_t)cm.getDimension()); + std::size_t baseDim((std::size_t)cm.getDimension()); if(baseDim==dim) return inputArray; - std::size_t const nbOfItems(sz/dim); + std::size_t nbOfItems(sz/dim); std::vector ret(nbOfItems*baseDim); if(baseDim>dim) { @@ -546,7 +542,7 @@ bool GaussInfo::IsInOrOutForReference(NormalizedCellType ct, const double *ptInR } } -using MapToShapeFunction = void (*)(GaussInfo &); +typedef void (*MapToShapeFunction)(GaussInfo& obj); /*! * Initialize the internal vectors @@ -634,7 +630,7 @@ void GaussInfo::initLocalInfo() _my_local_ref_dim = 2; _my_local_nb_ref = 4; MapToShapeFunction QUAD4PTR[]={Quad4aInit,Quad4bInit,Quad4cInit,Quad4DegSeg2Init}; - std::size_t const NB_OF_QUAD4PTR(sizeof(QUAD4PTR)/sizeof(MapToShapeFunction)); + std::size_t NB_OF_QUAD4PTR(sizeof(QUAD4PTR)/sizeof(MapToShapeFunction)); for(std::size_t i=0;i(theNbGauss), aReferenceCoord, FromIdType(theNbRef)); + GaussInfo* info = new GaussInfo( theGeometry, aGaussCoord, FromIdType(theNbGauss), aReferenceCoord, FromIdType(theNbRef)); info->initLocalInfo(); //If info with cell type doesn't exist add it @@ -4777,8 +4774,8 @@ double* GaussCoords::calculateCoords( NormalizedCellType theGeometry, const mcIdType *theIndex) { const GaussInfo *info = getInfoGivenCellType(theGeometry); - int const nbCoords = theSpaceDim * info->getNbGauss(); - auto *aCoords = new double[nbCoords]; + int nbCoords = theSpaceDim * info->getNbGauss(); + double *aCoords = new double[nbCoords]; calculateCoordsAlg(info,theNodeCoords,theSpaceDim,theIndex,aCoords); return aCoords; } @@ -4792,9 +4789,9 @@ void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result) { - int const aConn = info->getNbRef(); + int aConn = info->getNbRef(); - int const nbCoords = theSpaceDim * info->getNbGauss(); + int nbCoords = theSpaceDim * info->getNbGauss(); std::fill(result,result+nbCoords,0.); for( int gaussId = 0; gaussId < info->getNbGauss(); gaussId++ ) diff --git a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx index a5a8a76e6..a4aa652e7 100644 --- a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx +++ b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx @@ -21,15 +21,16 @@ #define __INTERPKERNELGAUSSCOORDS_HXX__ #include "INTERPKERNELDefines.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelException.hxx" #include "MCIdType.hxx" -#include "NormalizedGeometricTypes" #include namespace INTERP_KERNEL { - using DataVector = std::vector; - using IndexVector = std::vector; + typedef std::vector DataVector; + typedef std::vector IndexVector; //Class to store Gauss Points information class GaussInfo @@ -230,7 +231,7 @@ namespace INTERP_KERNEL void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result); private: - using GaussInfoVector = std::vector; + typedef std::vector GaussInfoVector; GaussInfoVector _my_gauss_info; }; } diff --git a/src/INTERP_KERNEL/GenMathFormulae.hxx b/src/INTERP_KERNEL/GenMathFormulae.hxx index d1d6a1d23..07ebea013 100644 --- a/src/INTERP_KERNEL/GenMathFormulae.hxx +++ b/src/INTERP_KERNEL/GenMathFormulae.hxx @@ -21,9 +21,9 @@ #ifndef __GENMATHFORMULAE_HXX__ #define __GENMATHFORMULAE_HXX__ +#include "InterpKernelException.hxx" #include -#include namespace INTERP_KERNEL { @@ -37,13 +37,13 @@ namespace INTERP_KERNEL */ void computeEigenValues6(const double *matrix, double *eigenVals) { - double const tr=(matrix[0]+matrix[1]+matrix[2])/3.; - double const K[6]={matrix[0]-tr,matrix[1]-tr,matrix[2]-tr,matrix[3],matrix[4],matrix[5]}; - double const q=(K[0]*K[1]*K[2]+2.*K[4]*K[5]*K[3]-K[0]*K[4]*K[4]-K[2]*K[3]*K[3]-K[1]*K[5]*K[5])/2.; + double tr=(matrix[0]+matrix[1]+matrix[2])/3.; + double K[6]={matrix[0]-tr,matrix[1]-tr,matrix[2]-tr,matrix[3],matrix[4],matrix[5]}; + double q=(K[0]*K[1]*K[2]+2.*K[4]*K[5]*K[3]-K[0]*K[4]*K[4]-K[2]*K[3]*K[3]-K[1]*K[5]*K[5])/2.; double p=K[0]*K[0]+K[1]*K[1]+K[2]*K[2]+2*(K[3]*K[3]+K[4]*K[4]+K[5]*K[5]); p/=6.; - double const sqp=sqrt(p); - double const tmp=p*sqp; + double sqp=sqrt(p); + double tmp=p*sqp; double phi; if(fabs(q)<=fabs(tmp)) if(tmp !=0) @@ -72,14 +72,14 @@ namespace INTERP_KERNEL const double m9[9]={matrix[0]-eigenVal,matrix[3],matrix[5],matrix[3],matrix[1]-eigenVal,matrix[4],matrix[5],matrix[4],matrix[2]-eigenVal}; for(int i=0;i<3;i++) { - double const w[9]={m9[0+3*i],m9[1+3*i],m9[2+3*i],m9[0+(3*(i+1))%6],m9[1+(3*(i+1))%6],m9[2+(3*(i+1))%6],1.,1.,1.}; - double const det=w[0]*w[4]*w[8]+w[1]*w[5]*w[6]+w[2]*w[3]*w[7]-w[0]*w[5]*w[7]-w[1]*w[3]*w[8]-w[2]*w[4]*w[6]; + double w[9]={m9[0+3*i],m9[1+3*i],m9[2+3*i],m9[0+(3*(i+1))%6],m9[1+(3*(i+1))%6],m9[2+(3*(i+1))%6],1.,1.,1.}; + double det=w[0]*w[4]*w[8]+w[1]*w[5]*w[6]+w[2]*w[3]*w[7]-w[0]*w[5]*w[7]-w[1]*w[3]*w[8]-w[2]*w[4]*w[6]; if(fabs(det)>eps) { eigenVector[0]=(w[1]*w[5]-w[4]*w[2])/det; eigenVector[1]=(w[2]*w[3]-w[0]*w[5])/det; eigenVector[2]=(w[0]*w[4]-w[1]*w[3])/det; - double const norm=sqrt(eigenVector[0]*eigenVector[0]+eigenVector[1]*eigenVector[1]+eigenVector[2]*eigenVector[2]); + double norm=sqrt(eigenVector[0]*eigenVector[0]+eigenVector[1]*eigenVector[1]+eigenVector[2]*eigenVector[2]); eigenVector[0]/=norm; eigenVector[1]/=norm; eigenVector[2]/=norm; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx index a7ca9ef1b..7f539da88 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx @@ -20,14 +20,11 @@ #include "InterpKernelGeo2DAbstractEdge.hxx" #include "InterpKernelGeo2DComposedEdge.hxx" -#include "InterpKernelGeo2DEdge.hxx" #include "InterpKernelGeo2DElementaryEdge.hxx" -#include -#include using namespace INTERP_KERNEL; -IteratorOnComposedEdge::IteratorOnComposedEdge():_list_handle(nullptr) +IteratorOnComposedEdge::IteratorOnComposedEdge():_list_handle(0) { } @@ -99,18 +96,18 @@ bool IteratorOnComposedEdge::goToNextInOn(bool direction, int& i, int nbMax) void IteratorOnComposedEdge::assignMySelfToAllElems(ComposedEdge *elems) { std::list *myList=elems->getListBehind(); - for(auto & iter : *myList) - iter->getIterator()=(*this); + for(std::list::iterator iter=myList->begin();iter!=myList->end();iter++) + (*iter)->getIterator()=(*this); } void IteratorOnComposedEdge::insertElemEdges(ComposedEdge *elems, bool changeMySelf) { std::list *myListToInsert=elems->getListBehind(); - auto iter=myListToInsert->begin(); + std::list::iterator iter=myListToInsert->begin(); *_deep_it=*iter; _deep_it++; iter++; - std::size_t const sizeOfMyList=myListToInsert->size(); + std::size_t sizeOfMyList=myListToInsert->size(); _list_handle->insert(_deep_it,iter,myListToInsert->end()); if(!changeMySelf) { diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.hxx index 805aa26af..1b544216a 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.hxx @@ -23,7 +23,9 @@ #include "INTERPKERNELDefines.hxx" +#include #include +#include namespace INTERP_KERNEL { @@ -45,7 +47,7 @@ namespace INTERP_KERNEL public: INTERPKERNEL_EXPORT IteratorOnComposedEdge(); INTERPKERNEL_EXPORT IteratorOnComposedEdge(ComposedEdge *compEdges); - INTERPKERNEL_EXPORT bool isValid() const { return _list_handle!=nullptr; } + INTERPKERNEL_EXPORT bool isValid() const { return _list_handle!=0; } INTERPKERNEL_EXPORT void operator=(const IteratorOnComposedEdge& other); INTERPKERNEL_EXPORT void first() { _deep_it=_list_handle->begin(); } INTERPKERNEL_EXPORT void next() { _deep_it++; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx index c66569978..b6429829f 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx @@ -22,9 +22,6 @@ #include "InterpKernelException.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DNode.hxx" -#include -#include -#include "InterpKernelGeo2DPrecision.hxx" using namespace INTERP_KERNEL; @@ -62,8 +59,8 @@ double &Bounds::operator[](int i) double Bounds::getDiagonal() const { - double const a=_x_max-_x_min; - double const b=_y_max-_y_min; + double a=_x_max-_x_min; + double b=_y_max-_y_min; return sqrt(a*a+b*b); } @@ -111,14 +108,14 @@ void Bounds::prepareForAggregation() */ void Bounds::getInterceptedArc(const double *center, double radius, double& intrcptArcAngle0, double& intrcptArcDelta) const { - double const diag=getDiagonal(); + double diag=getDiagonal(); if(diag<2.*radius) { double v1[2],v2[2],w1[2],w2[2]; v1[0]=_x_min-center[0]; v1[1]=_y_max-center[1]; v2[0]=_x_max-center[0]; v2[1]=_y_min-center[1]; w1[0]=v1[0]; w1[1]=_y_min-center[1]; w2[0]=v2[0]; w2[1]=_y_max-center[1]; - double const delta1=EdgeArcCircle::SafeAsin(v1[0]*v2[1]-v1[1]*v2[0]); - double const delta2=EdgeArcCircle::SafeAsin(w1[0]*w2[1]-w1[1]*w2[0]); + double delta1=EdgeArcCircle::SafeAsin(v1[0]*v2[1]-v1[1]*v2[0]); + double delta2=EdgeArcCircle::SafeAsin(w1[0]*w2[1]-w1[1]*w2[0]); double tmp; if(fabs(delta1)>fabs(delta2)) { @@ -136,7 +133,7 @@ void Bounds::getInterceptedArc(const double *center, double radius, double& intr double Bounds::fitXForXFigD(double val, int res) const { double delta=std::max(_x_max-_x_min,_y_max-_y_min)/2.; - double const ret=val-(_x_max+_x_min)/2.+delta; + double ret=val-(_x_max+_x_min)/2.+delta; delta=11.1375*res/(2.*delta); return ret*delta; } @@ -144,17 +141,17 @@ double Bounds::fitXForXFigD(double val, int res) const double Bounds::fitYForXFigD(double val, int res) const { double delta=std::max(_x_max-_x_min,_y_max-_y_min)/2.; - double const ret=(_y_max+_y_min)/2.-val+delta; + double ret=(_y_max+_y_min)/2.-val+delta; delta=11.1375*res/(2.*delta); return ret*delta; } Bounds *Bounds::nearlyAmIIntersectingWith(const Bounds& other) const { - double const eps = QuadraticPlanarPrecision::getPrecision(); + double eps = QuadraticPlanarPrecision::getPrecision(); if( (other._x_min > _x_max+eps) || (other._x_max < _x_min-eps) || (other._y_min > _y_max+eps) || (other._y_max < _y_min-eps) ) - return nullptr; + return 0; if( (other._x_min >= _x_max ) || (other._x_max <= _x_min) || (other._y_min >= _y_max) || (other._y_max <= _y_min) ) { return new Bounds(std::max(_x_min-eps,other._x_min), @@ -169,7 +166,7 @@ Bounds *Bounds::nearlyAmIIntersectingWith(const Bounds& other) const Bounds *Bounds::amIIntersectingWith(const Bounds& other) const { if( (other._x_min > _x_max) || (other._x_max < _x_min) || (other._y_min > _y_max) || (other._y_max < _y_min) ) - return nullptr; + return 0; return new Bounds(std::max(_x_min,other._x_min),std::min(_x_max,other._x_max),std::max(_y_min,other._y_min),std::min(_y_max,other._y_max)); } @@ -183,8 +180,8 @@ Position Bounds::where(double x, double y) const Position Bounds::nearlyWhere(double x, double y) const { - bool const thinX=Node::areDoubleEquals(_x_min,_x_max); - bool const thinY=Node::areDoubleEquals(_y_min,_y_max); + bool thinX=Node::areDoubleEquals(_x_min,_x_max); + bool thinY=Node::areDoubleEquals(_y_min,_y_max); if(!thinX) { if((Node::areDoubleEquals(x,_x_min) || Node::areDoubleEquals(x,_x_max)) && ((y<_y_max+QuadraticPlanarPrecision::getPrecision()) && (y>_y_min-QuadraticPlanarPrecision::getPrecision()))) diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.hxx index 806763b65..3f267f476 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.hxx @@ -52,7 +52,7 @@ namespace INTERP_KERNEL void getBarycenter(double& xBary, double& yBary) const; void applySimilarity(double xBary, double yBary, double dimChar); void unApplySimilarity(double xBary, double yBary, double dimChar); - Bounds& operator=(const Bounds& other) = default; + Bounds& operator=(const Bounds& other) { _x_min=other._x_min; _x_max=other._x_max; _y_min=other._y_min; _y_max=other._y_max; return *this; } Bounds(double xMin, double xMax, double yMin, double yMax):_x_min(xMin),_x_max(xMax),_y_min(yMin),_y_max(yMax) { } void setValues(double xMin, double xMax, double yMin, double yMax) { _x_min=xMin; _x_max=xMax; _y_min=yMin; _y_max=yMax; } void prepareForAggregation(); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx index 2488095a6..94d4e5363 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx @@ -19,35 +19,22 @@ // Author : Anthony Geay (CEA/DEN) #include "InterpKernelGeo2DComposedEdge.hxx" -#include "InterpKernelGeo2DEdge.hxx" -#include "InterpKernelGeo2DBounds.hxx" #include "InterpKernelGeo2DElementaryEdge.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DEdgeInfLin.hxx" #include "InterpKernelException.hxx" -#include "InterpKernelGeo2DNode.hxx" -#include "InterpKernelGeo2DPrecision.hxx" #include -#include -#include -#include -#include -#include -#include -#include #include #include -#include #include -#include using namespace INTERP_KERNEL; ComposedEdge::ComposedEdge(const ComposedEdge& other) { - for(auto _sub_edge : other._sub_edges) - _sub_edges.push_back(_sub_edge->clone()); + for(std::list::const_iterator iter=other._sub_edges.begin();iter!=other._sub_edges.end();iter++) + _sub_edges.push_back((*iter)->clone()); } ComposedEdge::~ComposedEdge() @@ -57,7 +44,7 @@ ComposedEdge::~ComposedEdge() void ComposedEdge::setValueAt(int i, Edge *e, bool direction) { - auto it=_sub_edges.begin(); + std::list::iterator it=_sub_edges.begin(); for(int j=0;j::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - if(find_if(other._sub_edges.begin(),other._sub_edges.end(),AbsEdgeCmp(_sub_edge))!=other._sub_edges.end()) + if(find_if(other._sub_edges.begin(),other._sub_edges.end(),AbsEdgeCmp(*iter))!=other._sub_edges.end()) { - const auto *tmp=static_cast(_sub_edge); + const ElementaryEdge *tmp=static_cast(*iter); ret+=tmp->getCurveLength(); } } @@ -112,7 +99,7 @@ void ComposedEdge::pushBack(ComposedEdge *elem) ElementaryEdge *ComposedEdge::operator[](int i) const { - auto iter=_sub_edges.begin(); + std::list::const_iterator iter=_sub_edges.begin(); for(int ii=0;iireverse(); + for(std::list::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->reverse(); } bool ComposedEdge::presenceOfOn() const { bool ret=false; - for(auto iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++) ret=((*iter)->getLoc()==FULL_ON_1); return ret; } @@ -136,19 +123,19 @@ bool ComposedEdge::presenceOfOn() const bool ComposedEdge::presenceOfQuadraticEdge() const { bool ret=false; - for(auto iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++) { Edge *e=(*iter)->getPtr(); if(e) - ret=dynamic_cast(e)!=nullptr; + ret=dynamic_cast(e)!=0; } return ret; } void ComposedEdge::initLocations() const { - for(auto _sub_edge : _sub_edges) - _sub_edge->initLocations(); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->initLocations(); } /** @@ -158,16 +145,16 @@ void ComposedEdge::initLocations() const void ComposedEdge::InitLocationsWithOther(const ComposedEdge& first, const ComposedEdge& other) { std::set s1,s2; - for(auto _sub_edge : first._sub_edges) - s1.insert(_sub_edge->getPtr()); - for(auto _sub_edge : other._sub_edges) - s2.insert(_sub_edge->getPtr()); + for(std::list::const_iterator it1=first._sub_edges.begin();it1!=first._sub_edges.end();it1++) + s1.insert((*it1)->getPtr()); + for(std::list::const_iterator it2=other._sub_edges.begin();it2!=other._sub_edges.end();it2++) + s2.insert((*it2)->getPtr()); first.initLocations(); other.initLocations(); std::vector s3; std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector >(s3)); - for(auto it3 : s3) - it3->declareOn(); + for(std::vector::const_iterator it3=s3.begin();it3!=s3.end();it3++) + (*it3)->declareOn(); } ComposedEdge *ComposedEdge::clone() const @@ -178,7 +165,7 @@ ComposedEdge *ComposedEdge::clone() const bool ComposedEdge::isNodeIn(Node *n) const { bool ret=false; - for(auto iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++) ret=(*iter)->isNodeIn(n); return ret; } @@ -201,16 +188,16 @@ bool ComposedEdge::isNodeIn(Node *n) const double ComposedEdge::getArea() const { double ret=0.; - for(auto _sub_edge : _sub_edges) - ret+=_sub_edge->getAreaOfZone(); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + ret+=(*iter)->getAreaOfZone(); return ret; } double ComposedEdge::getPerimeter() const { double ret=0.; - for(auto _sub_edge : _sub_edges) - ret+=_sub_edge->getCurveLength(); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + ret+=(*iter)->getCurveLength(); return ret; } @@ -243,10 +230,10 @@ void ComposedEdge::getBarycenter(double *bary) const bary[0]=0.; bary[1]=0.; double area=0.; - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - _sub_edge->getBarycenterOfZone(bary); - area+=_sub_edge->getAreaOfZone(); + (*iter)->getBarycenterOfZone(bary); + area+=(*iter)->getAreaOfZone(); } bary[0]/=area; bary[1]/=area; @@ -270,7 +257,7 @@ double ComposedEdge::normalizeMe(double& xBary, double& yBary) Bounds b; b.prepareForAggregation(); fillBounds(b); - double const dimChar=b.getCaracteristicDim(); + double dimChar=b.getCaracteristicDim(); b.getBarycenter(xBary,yBary); applyGlobalSimilarity(xBary,yBary,dimChar); return dimChar; @@ -282,7 +269,7 @@ double ComposedEdge::normalize(ComposedEdge *other, double& xBary, double& yBary b.prepareForAggregation(); fillBounds(b); other->fillBounds(b); - double const dimChar=b.getCaracteristicDim(); + double dimChar=b.getCaracteristicDim(); b.getBarycenter(xBary,yBary); applyGlobalSimilarity(xBary,yBary,dimChar); other->applyGlobalSimilarity(xBary,yBary,dimChar); @@ -310,7 +297,7 @@ double ComposedEdge::normalizeExt(ComposedEdge *other, double& xBary, double& yB b.prepareForAggregation(); fillBounds(b); other->fillBounds(b); - double const dimChar=b.getCaracteristicDim(); + double dimChar=b.getCaracteristicDim(); b.getBarycenter(xBary,yBary); applyGlobalSimilarity2(other,xBary,yBary,dimChar); return dimChar; @@ -319,14 +306,14 @@ double ComposedEdge::normalizeExt(ComposedEdge *other, double& xBary, double& yB void ComposedEdge::dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const { stream.precision(10); - for(auto _sub_edge : _sub_edges) - _sub_edge->dumpInXfigFile(stream,resolution,box); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->dumpInXfigFile(stream,resolution,box); } void ComposedEdge::dumpToCout(const std::map& mapp) const { int i=0; - for(auto iter=_sub_edges.begin();iter!=_sub_edges.end();iter++, i++) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++, i++) (*iter)->dumpToCout(mapp, i); std::cout << std::endl; } @@ -353,8 +340,8 @@ bool ComposedEdge::changeStartNodeWith(Node *node) const void ComposedEdge::fillBounds(Bounds& output) const { - for(auto _sub_edge : _sub_edges) - _sub_edge->fillBounds(output); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->fillBounds(output); } /*! @@ -362,8 +349,8 @@ void ComposedEdge::fillBounds(Bounds& output) const */ void ComposedEdge::applySimilarity(double xBary, double yBary, double dimChar) { - for(auto & _sub_edge : _sub_edges) - _sub_edge->applySimilarity(xBary,yBary,dimChar); + for(std::list::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->applySimilarity(xBary,yBary,dimChar); } /*! @@ -373,10 +360,10 @@ void ComposedEdge::applyGlobalSimilarity(double xBary, double yBary, double dimC { std::set allNodes; getAllNodes(allNodes); - for(auto allNode : allNodes) - allNode->applySimilarity(xBary,yBary,dimChar); - for(auto & _sub_edge : _sub_edges) - _sub_edge->applySimilarity(xBary,yBary,dimChar); + for(std::set::iterator iter=allNodes.begin();iter!=allNodes.end();iter++) + (*iter)->applySimilarity(xBary,yBary,dimChar); + for(std::list::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->applySimilarity(xBary,yBary,dimChar); } /*! @@ -401,11 +388,11 @@ void ComposedEdge::applyGlobalSimilarity2(ComposedEdge *other, double xBary, dou */ void ComposedEdge::dispatchPerimeter(double& partConsidered) const { - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - TypeOfEdgeLocInPolygon const loc=_sub_edge->getLoc(); + TypeOfEdgeLocInPolygon loc=(*iter)->getLoc(); if(loc==FULL_IN_1 || loc==FULL_ON_1) - partConsidered+=_sub_edge->getCurveLength(); + partConsidered+=(*iter)->getCurveLength(); } } @@ -414,105 +401,105 @@ void ComposedEdge::dispatchPerimeter(double& partConsidered) const */ void ComposedEdge::dispatchPerimeterExcl(double& partConsidered, double& commonPart) const { - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - TypeOfEdgeLocInPolygon const loc=_sub_edge->getLoc(); + TypeOfEdgeLocInPolygon loc=(*iter)->getLoc(); if(loc==FULL_IN_1) - partConsidered+=_sub_edge->getCurveLength(); + partConsidered+=(*iter)->getCurveLength(); if(loc==FULL_ON_1) - commonPart+=_sub_edge->getCurveLength(); + commonPart+=(*iter)->getCurveLength(); } } void ComposedEdge::getAllNodes(std::set& output) const { - auto iter=_sub_edges.begin(); + std::list::const_iterator iter=_sub_edges.begin(); for(;iter!=_sub_edges.end();iter++) (*iter)->getAllNodes(output); } void ComposedEdge::initNodeHitStatus() const { - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - _sub_edge->getStartNode()->initHitStatus(); - _sub_edge->getEndNode()->initHitStatus(); + (*iter)->getStartNode()->initHitStatus(); + (*iter)->getEndNode()->initHitStatus(); } } void ComposedEdge::applySimilarityOnMyNodes(double xBary, double yBary, double dimChar) const { - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - _sub_edge->getStartNode()->hitMeAlone(xBary,yBary,dimChar); - _sub_edge->getEndNode()->hitMeAlone(xBary,yBary,dimChar); + (*iter)->getStartNode()->hitMeAlone(xBary,yBary,dimChar); + (*iter)->getEndNode()->hitMeAlone(xBary,yBary,dimChar); } } void ComposedEdge::unApplySimilarityOnMyNodes(double xBary, double yBary, double dimChar) const { - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - _sub_edge->getStartNode()->unHitMeAlone(xBary,yBary,dimChar); - _sub_edge->getEndNode()->unHitMeAlone(xBary,yBary,dimChar); + (*iter)->getStartNode()->unHitMeAlone(xBary,yBary,dimChar); + (*iter)->getEndNode()->unHitMeAlone(xBary,yBary,dimChar); } } void ComposedEdge::applySimilarityOnMyNodesIfNotAlreadyHit(double xBary, double yBary, double dimChar) const { - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - _sub_edge->getStartNode()->hitMeAfter(xBary,yBary,dimChar); - _sub_edge->getEndNode()->hitMeAfter(xBary,yBary,dimChar); + (*iter)->getStartNode()->hitMeAfter(xBary,yBary,dimChar); + (*iter)->getEndNode()->hitMeAfter(xBary,yBary,dimChar); } } void ComposedEdge::unApplySimilarityOnMyNodesIfNotAlreadyHit(double xBary, double yBary, double dimChar) const { - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - _sub_edge->getStartNode()->unHitMeAfter(xBary,yBary,dimChar); - _sub_edge->getEndNode()->unHitMeAfter(xBary,yBary,dimChar); + (*iter)->getStartNode()->unHitMeAfter(xBary,yBary,dimChar); + (*iter)->getEndNode()->unHitMeAfter(xBary,yBary,dimChar); } } void ComposedEdge::initEdgeHitStatus() const { - for(auto _sub_edge : _sub_edges) - _sub_edge->getPtr()->initHitStatus(); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->getPtr()->initHitStatus(); } void ComposedEdge::applySimilarityOnMyEdges(double xBary, double yBary, double dimChar) const { - for(auto _sub_edge : _sub_edges) - _sub_edge->getPtr()->hitMeAlone(xBary,yBary,dimChar); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->getPtr()->hitMeAlone(xBary,yBary,dimChar); } void ComposedEdge::unApplySimilarityOnMyEdges(double xBary, double yBary, double dimChar) const { - for(auto _sub_edge : _sub_edges) - _sub_edge->getPtr()->unHitMeAlone(xBary,yBary,dimChar); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->getPtr()->unHitMeAlone(xBary,yBary,dimChar); } void ComposedEdge::applySimilarityOnMyEdgesIfNotAlreadyHit(double xBary, double yBary, double dimChar) const { - for(auto _sub_edge : _sub_edges) - _sub_edge->getPtr()->hitMeAfter(xBary,yBary,dimChar); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->getPtr()->hitMeAfter(xBary,yBary,dimChar); } void ComposedEdge::unApplySimilarityOnMyEdgesIfNotAlreadyHit(double xBary, double yBary, double dimChar) const { - for(auto _sub_edge : _sub_edges) - _sub_edge->getPtr()->unHitMeAfter(xBary,yBary,dimChar); + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->getPtr()->unHitMeAfter(xBary,yBary,dimChar); } void ComposedEdge::getBarycenter(double *bary, double& weigh) const { weigh=0.; bary[0]=0.; bary[1]=0.; double tmp1,tmp2[2]; - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) { - _sub_edge->getBarycenter(tmp2,tmp1); + (*iter)->getBarycenter(tmp2,tmp1); weigh+=tmp1; bary[0]+=tmp1*tmp2[0]; bary[1]+=tmp1*tmp2[1]; @@ -535,13 +522,13 @@ bool ComposedEdge::isInOrOut(Node *nodeToTest) const std::set< IntersectElement > inOutSwitch; std::set nodes; getAllNodes(nodes); - double const ref(isInOrOutAlg(nodeToTest,nodes,inOutSwitch)); + double ref(isInOrOutAlg(nodeToTest,nodes,inOutSwitch)); bool ret(false); - for(const auto & iter4 : inOutSwitch) + for(std::set< IntersectElement >::iterator iter4=inOutSwitch.begin();iter4!=inOutSwitch.end();iter4++) { - if(iter4.getVal1()getLoc()==ON_1) + if((*iter4).getNodeOnly()->getLoc()==ON_1) ret=!ret; } else @@ -561,19 +548,19 @@ bool ComposedEdge::isInOrOut2(Node *nodeToTest) const std::set< IntersectElement > inOutSwitch; std::set nodes; getAllNodes(nodes); - for(auto node : nodes) - if(sqrt(node->distanceWithSq(*nodeToTest))::const_iterator iter=nodes.begin();iter!=nodes.end();iter++) + if(sqrt((*iter)->distanceWithSq(*nodeToTest))::iterator iter4=inOutSwitch.begin();iter4!=inOutSwitch.end();iter4++) { - double const val(iter4.getVal1()); + double val((*iter4).getVal1()); if(fabs(val-ref)>=QuadraticPlanarPrecision::getPrecision()) { if(valgetLoc()==ON_1) + if((*iter4).getNodeOnly()->getLoc()==ON_1) ret=!ret; } else @@ -599,13 +586,14 @@ double ComposedEdge::isInOrOutAlg(Node *nodeToTest, const std::set& nodes radialDistrib2.back()=M_PI+radialDistrib.front(); std::vector radialDistrib3(radialDistrib.size()); std::transform(radialDistrib2.begin(),radialDistrib2.end(),radialDistrib.begin(),radialDistrib3.begin(),std::minus()); - auto const iter3=max_element(radialDistrib3.begin(),radialDistrib3.end()); - std::size_t const i=iter3-radialDistrib3.begin(); + std::vector::iterator iter3=max_element(radialDistrib3.begin(),radialDistrib3.end()); + std::size_t i=iter3-radialDistrib3.begin(); // ok for e1 - Let's go. - auto *e1=new EdgeInfLin(nodeToTest,radialDistrib[i]+radialDistrib3[i]/2.); - double const ref=e1->getCharactValue(*nodeToTest); - for(auto val : _sub_edges) + EdgeInfLin *e1=new EdgeInfLin(nodeToTest,radialDistrib[i]+radialDistrib3[i]/2.); + double ref=e1->getCharactValue(*nodeToTest); + for(std::list::const_iterator iter4=_sub_edges.begin();iter4!=_sub_edges.end();iter4++) { + ElementaryEdge *val=(*iter4); if(val) { Edge *e=val->getPtr(); @@ -618,10 +606,10 @@ double ComposedEdge::isInOrOutAlg(Node *nodeToTest, const std::set& nodes } if(!areOverlapped) { - std::list< IntersectElement > const listOfIntesc=intersc->getIntersectionsCharacteristicVal(); - for(auto & iter2 : listOfIntesc) - if(iter2.isIncludedByBoth()) - inOutSwitch.insert(iter2); + std::list< IntersectElement > listOfIntesc=intersc->getIntersectionsCharacteristicVal(); + for(std::list< IntersectElement >::iterator iter2=listOfIntesc.begin();iter2!=listOfIntesc.end();iter2++) + if((*iter2).isIncludedByBoth()) + inOutSwitch.insert(*iter2); } //if overlapped we can forget } @@ -646,6 +634,6 @@ bool ComposedEdge::intresincEqCoarse(const Edge *other) const void ComposedEdge::clearAll(std::list::iterator startToDel) { - for(auto iter=startToDel;iter!=_sub_edges.end();iter++) + for(std::list::iterator iter=startToDel;iter!=_sub_edges.end();iter++) delete (*iter); } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx index fb1a9ef64..b21c03c9c 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx @@ -24,7 +24,6 @@ #include "INTERPKERNELDefines.hxx" #include "InterpKernelGeo2DEdge.hxx" -#include #include #include #include @@ -47,7 +46,7 @@ namespace INTERP_KERNEL { friend class IteratorOnComposedEdge; public: - INTERPKERNEL_EXPORT ComposedEdge() = default; + INTERPKERNEL_EXPORT ComposedEdge() { } INTERPKERNEL_EXPORT ComposedEdge(const ComposedEdge& other); INTERPKERNEL_EXPORT ComposedEdge(int sz):_sub_edges(sz) { } INTERPKERNEL_EXPORT static void Delete(ComposedEdge *pt) { delete pt; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index b5697b8d5..b184345d5 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -20,26 +20,15 @@ #include "InterpKernelGeo2DEdge.hxx" #include "InterpKernelGeo2DEdgeLin.hxx" +#include "InterpKernelGeo2DEdgeInfLin.hxx" //#include "EdgeParabol.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DComposedEdge.hxx" #include "InterpKernelException.hxx" -#include "MCIdType.hxx" #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include using namespace INTERP_KERNEL; @@ -51,7 +40,7 @@ MergePoints::MergePoints():_ass1Start1(0),_ass1End1(0),_ass1Start2(0),_ass1End2( void MergePoints::start1Replaced() { - unsigned const nbOfAsso=getNumberOfAssociations(); + unsigned nbOfAsso=getNumberOfAssociations(); if(nbOfAsso==0) _ass1Start1=1; else @@ -60,7 +49,7 @@ void MergePoints::start1Replaced() void MergePoints::end1Replaced() { - unsigned const nbOfAsso=getNumberOfAssociations(); + unsigned nbOfAsso=getNumberOfAssociations(); if(nbOfAsso==0) _ass1End1=1; else @@ -69,7 +58,7 @@ void MergePoints::end1Replaced() void MergePoints::start1OnStart2() { - unsigned const nbOfAsso=getNumberOfAssociations(); + unsigned nbOfAsso=getNumberOfAssociations(); if(nbOfAsso==0) { _ass1Start1=1; @@ -84,7 +73,7 @@ void MergePoints::start1OnStart2() void MergePoints::start1OnEnd2() { - unsigned const nbOfAsso=getNumberOfAssociations(); + unsigned nbOfAsso=getNumberOfAssociations(); if(nbOfAsso==0) { _ass1Start1=1; @@ -99,7 +88,7 @@ void MergePoints::start1OnEnd2() void MergePoints::end1OnStart2() { - unsigned const nbOfAsso=getNumberOfAssociations(); + unsigned nbOfAsso=getNumberOfAssociations(); if(nbOfAsso==0) { _ass1End1=1; @@ -114,7 +103,7 @@ void MergePoints::end1OnStart2() void MergePoints::end1OnEnd2() { - unsigned const nbOfAsso=getNumberOfAssociations(); + unsigned nbOfAsso=getNumberOfAssociations(); if(nbOfAsso==0) { _ass1End1=1; @@ -363,7 +352,7 @@ bool EdgeIntersector::intersect(std::vector& newNodes, bool& order, Merg iter=listOfIntesc.erase(iter); continue; } - unsigned const tmp=(*iter).isOnExtrForAnEdgeAndInForOtherEdge(); + unsigned tmp=(*iter).isOnExtrForAnEdgeAndInForOtherEdge(); if(tmp==IntersectElement::LIMIT_ALONE) { iter=listOfIntesc.erase(iter); @@ -395,8 +384,8 @@ bool EdgeIntersector::intersect(std::vector& newNodes, bool& order, Merg std::vector vecOfIntesc(listOfIntesc.begin(),listOfIntesc.end()); listOfIntesc.clear(); sort(vecOfIntesc.begin(),vecOfIntesc.end()); - for(auto & iterV : vecOfIntesc) - newNodes.push_back(iterV.getNodeAndReleaseIt()); + for(std::vector::iterator iterV=vecOfIntesc.begin();iterV!=vecOfIntesc.end();iterV++) + newNodes.push_back((*iterV).getNodeAndReleaseIt()); order=vecOfIntesc.front().isLowerOnOther(vecOfIntesc.back()); } return true; @@ -478,7 +467,7 @@ Edge::~Edge() bool Edge::decrRef() { - bool const ret=(--_cnt==0); + bool ret=(--_cnt==0); if(ret) delete this; return ret; @@ -615,9 +604,9 @@ void Edge::getNormalVector(double *vectOutput) const { std::copy((const double *)(*_end),(const double *)(*_end)+2,vectOutput); std::transform(vectOutput,vectOutput+2,(const double *)(*_start),vectOutput,std::minus()); - double const norm=1./Node::norm(vectOutput); + double norm=1./Node::norm(vectOutput); std::transform(vectOutput,vectOutput+2,vectOutput,bind(std::multiplies(),std::placeholders::_1,norm)); - double const tmp=vectOutput[0]; + double tmp=vectOutput[0]; vectOutput[0]=vectOutput[1]; vectOutput[1]=-tmp; } @@ -625,9 +614,9 @@ void Edge::getNormalVector(double *vectOutput) const Edge *Edge::BuildEdgeFrom3Points(const double *start, const double *middle, const double *end) { Node *b(new Node(start[0],start[1])),*m(new Node(middle[0],middle[1])),*e(new Node(end[0],end[1])); - auto *e1(new EdgeLin(b,m)),*e2(new EdgeLin(m,e)); - SegSegIntersector const inters(*e1,*e2); bool const colinearity=inters.areColinears(); delete e1; delete e2; - Edge *ret=nullptr; + EdgeLin *e1(new EdgeLin(b,m)),*e2(new EdgeLin(m,e)); + SegSegIntersector inters(*e1,*e2); bool colinearity=inters.areColinears(); delete e1; delete e2; + Edge *ret=0; if(colinearity) ret=new EdgeLin(b,e); else @@ -652,7 +641,7 @@ Edge *Edge::BuildFromXfigLine(std::istream& str) else { std::cerr << "Unknown line found..."; - return nullptr; + return 0; } } @@ -671,7 +660,7 @@ bool Edge::intersectWith(const Edge *other, MergePoints& commonNode, if(!merge) return false; delete merge; - merge=nullptr; + merge=0; EdgeIntersector *intersector=BuildIntersectorWith(this,other); ret=Intersect(this,other,intersector,commonNode,outVal1,outVal2); delete intersector; @@ -681,12 +670,12 @@ bool Edge::intersectWith(const Edge *other, MergePoints& commonNode, bool Edge::IntersectOverlapped(const Edge *f1, const Edge *f2, EdgeIntersector *intersector, MergePoints& commonNode, ComposedEdge& outValForF1, ComposedEdge& outValForF2) { - bool const rev=intersector->haveTheySameDirection(); + bool rev=intersector->haveTheySameDirection(); Node *f2Start=f2->getNode(rev?START:END); Node *f2End=f2->getNode(rev?END:START); TypeOfLocInEdge place1, place2; intersector->getPlacements(f2Start,f2End,place1,place2,commonNode); - int const codeForIntersectionCase=CombineCodes(place1,place2); + int codeForIntersectionCase=CombineCodes(place1,place2); return SplitOverlappedEdges(f1,f2,f2Start,f2End,rev,codeForIntersectionCase,outValForF1,outValForF2); } @@ -695,25 +684,25 @@ bool Edge::IntersectOverlapped(const Edge *f1, const Edge *f2, EdgeIntersector * */ void Edge::Interpolate1DLin(const std::vector& distrib1, const std::vector& distrib2, std::map >& result) { - std::size_t const nbOfV1=distrib1.size()-1; - std::size_t const nbOfV2=distrib2.size()-1; + std::size_t nbOfV1=distrib1.size()-1; + std::size_t nbOfV2=distrib2.size()-1; Node *n1=new Node(0.,0.); Node *n3=new Node(0.,0.); Node *n2=new Node(0.,0.); Node *n4=new Node(0.,0.); MergePoints commonNode; for(unsigned int i=0;i(),std::placeholders::_1,distrib1[i])); + std::vector::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind(std::greater_equal(),std::placeholders::_1,distrib1[i])); if(iter!=distrib2.end()) { for(unsigned int j=(unsigned)((iter-1)-distrib2.begin());jsetNewCoords(distrib1[i],0.); n2->setNewCoords(distrib1[i+1],0.); n3->setNewCoords(distrib2[j],0.); n4->setNewCoords(distrib2[j+1],0.); - auto *f1=new ComposedEdge; - auto *f2=new ComposedEdge; + ComposedEdge *f1=new ComposedEdge; + ComposedEdge *f2=new ComposedEdge; SegSegIntersector inters(*e1,*e2); bool b1,b2; inters.areOverlappedOrOnlyColinears(b1,b2); @@ -732,12 +721,12 @@ void Edge::Interpolate1DLin(const std::vector& distrib1, const std::vect EdgeIntersector *Edge::BuildIntersectorWith(const Edge *e1, const Edge *e2) { - EdgeIntersector *ret=nullptr; - const EdgeLin *tmp1=nullptr; - const EdgeArcCircle *tmp2=nullptr; + EdgeIntersector *ret=0; + const EdgeLin *tmp1=0; + const EdgeArcCircle *tmp2=0; unsigned char type1=e1->getTypeOfFunc(); e1->dynCastFunction(tmp1,tmp2); - unsigned char const type2=e2->getTypeOfFunc(); + unsigned char type2=e2->getTypeOfFunc(); e2->dynCastFunction(tmp1,tmp2); type1|=type2; switch(type1) @@ -792,11 +781,11 @@ bool Edge::Intersect(const Edge *f1, const Edge *f2, EdgeIntersector *intersecto { if(newNodes.empty()) throw Exception("Internal error occurred - error in intersector implementation!");// This case should never happen - auto const iter=newNodes.begin(); - auto iterR=newNodes.rbegin(); + std::vector::iterator iter=newNodes.begin(); + std::vector::reverse_iterator iterR=newNodes.rbegin(); f1->addSubEdgeInVector(f1->getStartNode(),*iter,outValForF1); f2->addSubEdgeInVector(f2->getStartNode(),order?*iter:*iterR,outValForF2); - for(auto iter2=newNodes.begin();iter2!=newNodes.end();iter2++,iterR++) + for(std::vector::iterator iter2=newNodes.begin();iter2!=newNodes.end();iter2++,iterR++) { if((iter2+1)==newNodes.end()) { @@ -1001,7 +990,7 @@ bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) b.prepareForAggregation(); b.aggregate(getBounds()); double xBary,yBary; - double const dimChar(b.getCaracteristicDim()); + double dimChar(b.getCaracteristicDim()); b.getBarycenter(xBary,yBary); applySimilarity(xBary,yBary,dimChar); _start->applySimilarity(xBary,yBary,dimChar); @@ -1022,7 +1011,7 @@ bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) bool ret(false); for(i=0;i& subNodes) void Edge::sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis) { - mcIdType const startId=(*mapp1.find(_start)).second; - mcIdType const endId=(*mapp1.find(_end)).second; + mcIdType startId=(*mapp1.find(_start)).second; + mcIdType endId=(*mapp1.find(_end)).second; if (! addNodes.size()) // quick way out, no new node to add. { edgesThis.push_back(startId); @@ -1051,31 +1040,31 @@ void Edge::sortIdsAbs(const std::vector& addNodes, const b.prepareForAggregation(); b.aggregate(getBounds()); double xBary,yBary; - double const dimChar=b.getCaracteristicDim(); + double dimChar=b.getCaracteristicDim(); b.getBarycenter(xBary,yBary); - for(auto addNode : addNodes) - addNode->applySimilarity(xBary,yBary,dimChar); + for(std::vector::const_iterator iter=addNodes.begin();iter!=addNodes.end();iter++) + (*iter)->applySimilarity(xBary,yBary,dimChar); applySimilarity(xBary,yBary,dimChar); _start->applySimilarity(xBary,yBary,dimChar); _end->applySimilarity(xBary,yBary,dimChar); - std::size_t const sz=addNodes.size(); + std::size_t sz=addNodes.size(); std::vector< std::pair > an2(sz); for(std::size_t i=0;i(getCharactValueBtw0And1(*addNodes[i]),addNodes[i]); std::sort(an2.begin(),an2.end()); std::vector tmpp; - for(const auto & it : an2) + for(std::vector< std::pair >::const_iterator it=an2.begin();it!=an2.end();it++) { - mcIdType const idd=(*mapp2.find(it.second)).second; + mcIdType idd=(*mapp2.find((*it).second)).second; tmpp.push_back(idd); } std::vector tmpp2(tmpp.size()+2); tmpp2[0]=startId; std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1); tmpp2[tmpp.size()+1]=endId; - auto const itt=std::unique(tmpp2.begin(),tmpp2.end()); + std::vector::iterator itt=std::unique(tmpp2.begin(),tmpp2.end()); tmpp2.resize(std::distance(tmpp2.begin(),itt)); - std::size_t const nbOfEdges=tmpp2.size()-1; + std::size_t nbOfEdges=tmpp2.size()-1; for(std::size_t i=0;i see areOverlappedOrOnlyColinears() + IntersectElement *_earlyInter; // Non null if the intersection can be determined early -> see areOverlappedOrOnlyColinears() }; class INTERPKERNEL_EXPORT SameTypeEdgeIntersector : public EdgeIntersector { protected: SameTypeEdgeIntersector(const Edge& e1, const Edge& e2):EdgeIntersector(e1,e2) { } - bool keepOrder() const override { return true; } + bool keepOrder() const { return true; } }; class INTERPKERNEL_EXPORT CrossTypeEdgeIntersector : public EdgeIntersector { protected: CrossTypeEdgeIntersector(const Edge& e1, const Edge& e2, bool reverse):EdgeIntersector(e1,e2),_reverse(reverse) { } - bool keepOrder() const override { return _reverse; } - bool haveTheySameDirection() const override { throw Exception("Cross type intersector is not supposed to deal with overlapped in cross type."); } + bool keepOrder() const { return _reverse; } + bool haveTheySameDirection() const { throw Exception("Cross type intersector is not supposed to deal with overlapped in cross type."); } const Edge *myE1() { if(_reverse) return &_e1; else return &_e2; } const Edge *myE2() { if(_reverse) return &_e2; else return &_e1; } protected: @@ -223,7 +223,7 @@ namespace INTERP_KERNEL void unHitMeAfter(double xBary, double yBary, double dimChar) { if(!_hit) unHitMeAlone(xBary,yBary,dimChar); } const Bounds& getBounds() const { return _bounds; } void fillXfigStreamForLoc(std::ostream& stream) const; - Node *getNode(TypeOfLocInEdge where) const { if(where==START) return _start; else if(where==END) return _end; else return nullptr; } + Node *getNode(TypeOfLocInEdge where) const { if(where==START) return _start; else if(where==END) return _end; else return 0; } Node *getStartNode() const { return _start; } Node *getEndNode() const { return _end; } void setEndNodeWithoutChange(Node *newEnd); @@ -292,7 +292,7 @@ namespace INTERP_KERNEL std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; protected: - Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(nullptr),_end(nullptr) { } + Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { } virtual ~Edge(); static int CombineCodes(TypeOfLocInEdge code1, TypeOfLocInEdge code2); static bool Intersect(const Edge *f1, const Edge *f2, EdgeIntersector *intersector, MergePoints& commonNode, diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.txx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.txx index 66287ebd7..fa44acd77 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.txx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.txx @@ -20,9 +20,7 @@ #ifndef __INTERPKERNELGEO2DEDGE_TXX__ #define __INTERPKERNELGEO2DEDGE_TXX__ -#include "InterpKernelGeo2DEdge.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" -#include "InterpKernelGeo2DNode.hxx" template INTERP_KERNEL::Edge *INTERP_KERNEL::Edge::BuildEdgeFrom(Node *start, Node *middle, Node *end) diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index c0932b940..41624df7f 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -19,23 +19,14 @@ // Author : Anthony Geay (CEA/DEN) #include "InterpKernelGeo2DEdgeArcCircle.hxx" -#include "InterpKernelGeo2DEdge.hxx" #include "InterpKernelGeo2DEdgeLin.hxx" #include "InterpKernelException.hxx" #include "InterpKernelGeo2DNode.hxx" -#include "InterpKernelGeo2DPrecision.hxx" -#include "MCIdType.hxx" -#include "NormalizedGeometricTypes" - -#include -#include -#include -#include -#include +#include "NormalizedUnstructuredMesh.hxx" + +#include #include #include -#include -#include using namespace INTERP_KERNEL; @@ -66,8 +57,8 @@ void ArcCArcCIntersector::getPlacements(Node *start, Node *end, TypeOfLocInEdge& obviousCaseForCurvAbscisse(end,whereEnd,commonNode,obvious2); if(obvious1 && obvious2) return ; - double const angleInRadStart=getAngle(start); - double const angleInRadEnd=getAngle(end); + double angleInRadStart=getAngle(start); + double angleInRadEnd=getAngle(end); if(obvious1 || obvious2) { if(obvious1) @@ -129,8 +120,8 @@ double ArcCArcCIntersector::getAngle(Node *node) const bool ArcCArcCIntersector::internalAreColinears(const EdgeArcCircle& a1, const EdgeArcCircle& a2, double& distBetweenCenters, double& cst, double& radiusL, double centerL[2], double& radiusB, double centerB[2]) { - double const lgth1=fabs(a1.getAngle()*a1.getRadius()); - double const lgth2=fabs(a2.getAngle()*a2.getRadius()); + double lgth1=fabs(a1.getAngle()*a1.getRadius()); + double lgth2=fabs(a2.getAngle()*a2.getRadius()); if(lgth1radius1+radius2+QuadraticPlanarPrecision::getPrecision() || _dist+std::min(radius1,radius2)+QuadraticPlanarPrecision::getPrecision() ArcCArcCIntersector::getIntersectionsCharacteristi std::list< IntersectElement > ret; const double *center1=getE1().getCenter(); const double *center2=getE2().getCenter(); - double const radius1=getE1().getRadius(); double const radius2=getE2().getRadius(); - double const d1_1=(_dist*_dist-radius2*radius2+radius1*radius1)/(2.*_dist); // computation of 'x' on wolfram + double radius1=getE1().getRadius(); double radius2=getE2().getRadius(); + double d1_1=(_dist*_dist-radius2*radius2+radius1*radius1)/(2.*_dist); // computation of 'x' on wolfram double u[2];//u is normalized vector from center1 to center2. u[0]=(center2[0]-center1[0])/_dist; u[1]=(center2[1]-center1[1])/_dist; - double const d1_1y=EdgeArcCircle::SafeSqrt(radius1*radius1-d1_1*d1_1); // computation of 'y' on wolfram - double const angleE1=EdgeArcCircle::NormalizeAngle(getE1().getAngle0()+getE1().getAngle()); - double const angleE2=EdgeArcCircle::NormalizeAngle(getE2().getAngle0()+getE2().getAngle()); + double d1_1y=EdgeArcCircle::SafeSqrt(radius1*radius1-d1_1*d1_1); // computation of 'y' on wolfram + double angleE1=EdgeArcCircle::NormalizeAngle(getE1().getAngle0()+getE1().getAngle()); + double angleE2=EdgeArcCircle::NormalizeAngle(getE2().getAngle0()+getE2().getAngle()); if(!Node::areDoubleEquals(d1_1y,0)) { //2 intersections @@ -228,24 +219,24 @@ std::list< IntersectElement > ArcCArcCIntersector::getIntersectionsCharacteristi v2[0]=u[0]*d1_1+u[1]*d1_1y; v2[1]=u[1]*d1_1-u[0]*d1_1y; Node *node1=new Node(center1[0]+v1[0],center1[1]+v1[1]); node1->declareOn(); Node *node2=new Node(center1[0]+v2[0],center1[1]+v2[1]); node2->declareOn(); - double const angle1_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1); - double const angle2_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius1,v2[1]/radius1); + double angle1_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1); + double angle2_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius1,v2[1]/radius1); double v3[2],v4[2]; v3[0]=center1[0]-center2[0]+v1[0]; v3[1]=center1[1]-center2[1]+v1[1]; v4[0]=center1[0]-center2[0]+v2[0]; v4[1]=center1[1]-center2[1]+v2[1]; - double const angle1_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v3[0]/radius2,v3[1]/radius2); - double const angle2_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v4[0]/radius2,v4[1]/radius2); + double angle1_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v3[0]/radius2,v3[1]/radius2); + double angle2_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v4[0]/radius2,v4[1]/radius2); // Check whether intersection points are exactly ON the other arc or not // -> the curvilinear distance (=radius*angle) must below eps - bool const e1_1S=Node::areDoubleEqualsWPLeft(angle1_1,getE1().getAngle0(),radius1); - bool const e1_1E=Node::areDoubleEqualsWPLeft(angle1_1,angleE1,radius1); - bool const e1_2S=Node::areDoubleEqualsWPLeft(angle1_2,getE2().getAngle0(),radius1); - bool const e1_2E=Node::areDoubleEqualsWPLeft(angle1_2,angleE2,radius1); + bool e1_1S=Node::areDoubleEqualsWPLeft(angle1_1,getE1().getAngle0(),radius1); + bool e1_1E=Node::areDoubleEqualsWPLeft(angle1_1,angleE1,radius1); + bool e1_2S=Node::areDoubleEqualsWPLeft(angle1_2,getE2().getAngle0(),radius1); + bool e1_2E=Node::areDoubleEqualsWPLeft(angle1_2,angleE2,radius1); // - bool const e2_1S=Node::areDoubleEqualsWPLeft(angle2_1,getE1().getAngle0(),radius2); - bool const e2_1E=Node::areDoubleEqualsWPLeft(angle2_1,angleE1,radius2); - bool const e2_2S=Node::areDoubleEqualsWPLeft(angle2_2,getE2().getAngle0(),radius2); - bool const e2_2E=Node::areDoubleEqualsWPLeft(angle2_2,angleE2,radius2); + bool e2_1S=Node::areDoubleEqualsWPLeft(angle2_1,getE1().getAngle0(),radius2); + bool e2_1E=Node::areDoubleEqualsWPLeft(angle2_1,angleE1,radius2); + bool e2_2S=Node::areDoubleEqualsWPLeft(angle2_2,getE2().getAngle0(),radius2); + bool e2_2E=Node::areDoubleEqualsWPLeft(angle2_2,angleE2,radius2); ret.push_back(IntersectElement(angle1_1,angle1_2,e1_1S,e1_1E,e1_2S,e1_2E,node1,_e1,_e2,keepOrder())); ret.push_back(IntersectElement(angle2_1,angle2_2,e2_1S,e2_1E,e2_2S,e2_2E,node2,_e1,_e2,keepOrder())); } @@ -255,12 +246,12 @@ std::list< IntersectElement > ArcCArcCIntersector::getIntersectionsCharacteristi double v1[2],v2[2]; v1[0]=d1_1*u[0]; v1[1]=d1_1*u[1]; v2[0]=center1[0]-center2[0]+v1[0]; v2[1]=center1[1]-center2[1]+v1[1]; - double const angle0_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1); - double const angle0_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius2,v2[1]/radius2); - bool const e0_1S=Node::areDoubleEqualsWPLeft(angle0_1,getE1().getAngle0(),radius1); - bool const e0_1E=Node::areDoubleEqualsWPLeft(angle0_1,angleE1,radius1); - bool const e0_2S=Node::areDoubleEqualsWPLeft(angle0_2,getE2().getAngle0(),radius2); - bool const e0_2E=Node::areDoubleEqualsWPLeft(angle0_2,angleE2,radius2); + double angle0_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1); + double angle0_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius2,v2[1]/radius2); + bool e0_1S=Node::areDoubleEqualsWPLeft(angle0_1,getE1().getAngle0(),radius1); + bool e0_1E=Node::areDoubleEqualsWPLeft(angle0_1,angleE1,radius1); + bool e0_2S=Node::areDoubleEqualsWPLeft(angle0_2,getE2().getAngle0(),radius2); + bool e0_2E=Node::areDoubleEqualsWPLeft(angle0_2,angleE2,radius2); Node *node=new Node(center1[0]+d1_1*u[0],center1[1]+d1_1*u[1]); node->declareOnTangent(); ret.push_back(IntersectElement(angle0_1,angle0_2,e0_1S,e0_1E,e0_2S,e0_2E,node,_e1,_e2,keepOrder())); } @@ -360,14 +351,14 @@ void ArcCSegIntersector::areOverlappedOrOnlyColinears(bool& obviousNoIntersectio // We need to compute d = R*R-_cross*_cross/_drSq // In terms of numerical precision, this can trigger 'catastrophic cancellation' and is hence better expressed as: - double const _dr = sqrt(_drSq); + double _dr = sqrt(_drSq); double diff = (R-_cross/_dr), add=(R+_cross/_dr); // Ah ah: we will be taking a square root later. If we want the user to be able to use an epsilon finer than 1.0e-8, then we need // to prevent ourselves going below machine precision (typ. 1.0e-16 for double). const double eps_machine = std::numeric_limits::epsilon(); diff = fabs(diff/R) < eps_machine ? 0.0 : diff; add = fabs(add/R) < eps_machine ? 0.0 : add; - double const d = add*diff; + double d = add*diff; // Compute deltaRoot_div_dr := sqrt(delta)/dr, where delta has the meaning of Wolfram. // Then 2*deltaRoot_div_dr is the distance between the two intersection points of the line with the circle. This is what we compare to eps. // We compute it in such a way that it can be used in boolean tests too (a very negative value means we're far apart from intersection) @@ -387,7 +378,7 @@ bool ArcCSegIntersector::areColinears() const return false; } -void ArcCSegIntersector::getPlacements(Node * /*start*/, Node * /*end*/, TypeOfLocInEdge& /*whereStart*/, TypeOfLocInEdge& /*whereEnd*/, MergePoints& /*commonNode*/) const +void ArcCSegIntersector::getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const { throw Exception("Internal error. Should never been called : no overlapping possible between arc of circle and a segment."); } @@ -405,9 +396,9 @@ std::list< IntersectElement > ArcCSegIntersector::getIntersectionsCharacteristic // There we can tell if the arc of circle is 'moving away' from the seg, or if it might intersect it twice const Node &n(*_earlyInter->getNodeOnly()); - double const tang[2] = {-(n[1]-center[1]), n[0]-center[0]}; // (-y, x) is the tangent vector in the trigo direction with (x,y) = (center->node) - bool const invSeg = _i1S2E || _i1E2E; - double const linEdge[2] = {invSeg ? (-_dx) : _dx, invSeg ? (-_dy) : _dy}; + double tang[2] = {-(n[1]-center[1]), n[0]-center[0]}; // (-y, x) is the tangent vector in the trigo direction with (x,y) = (center->node) + bool invSeg = _i1S2E || _i1E2E; + double linEdge[2] = {invSeg ? (-_dx) : _dx, invSeg ? (-_dy) : _dy}; if(tang[1]*linEdge[0]-tang[0]*linEdge[1] < 0) { ret.push_back(*_earlyInter); @@ -415,12 +406,12 @@ std::list< IntersectElement > ArcCSegIntersector::getIntersectionsCharacteristic } } - double const determinant=fabs(_deltaRoot_div_dr)/sqrt(_drSq); - double const x1=(_cross*_dy/_drSq+Node::sign(_dy)*_dx*determinant)+center[0]; - double const y1=(-_cross*_dx/_drSq+fabs(_dy)*determinant)+center[1]; + double determinant=fabs(_deltaRoot_div_dr)/sqrt(_drSq); + double x1=(_cross*_dy/_drSq+Node::sign(_dy)*_dx*determinant)+center[0]; + double y1=(-_cross*_dx/_drSq+fabs(_dy)*determinant)+center[1]; Node *intersect1=new Node(x1,y1); intersect1->declareOn(); - double const x2=(_cross*_dy/_drSq-Node::sign(_dy)*_dx*determinant)+center[0]; - double const y2=(-_cross*_dx/_drSq-fabs(_dy)*determinant)+center[1]; + double x2=(_cross*_dy/_drSq-Node::sign(_dy)*_dx*determinant)+center[0]; + double y2=(-_cross*_dx/_drSq-fabs(_dy)*determinant)+center[1]; Node *intersect2=new Node(x2,y2); intersect2->declareOn(); bool isN1(false), isN2(false); @@ -429,8 +420,8 @@ std::list< IntersectElement > ArcCSegIntersector::getIntersectionsCharacteristic // Which node do we actually already found? Assume this is the closest ... const Node &iN = *(_earlyInter->getNodeOnly()); const Node &n1(*intersect1), &n2(*intersect2); - double const d1 = std::max(fabs(iN[0]-n1[0]), fabs(iN[1]-n1[1])); - double const d2 = std::max(fabs(iN[0]-n2[0]), fabs(iN[1]-n2[1])); + double d1 = std::max(fabs(iN[0]-n1[0]), fabs(iN[1]-n1[1])); + double d2 = std::max(fabs(iN[0]-n2[0]), fabs(iN[1]-n2[1])); isN1 = d1 < d2; isN2 = !isN1; if (isN1) intersect1->decrRef(); if (isN2) intersect2->decrRef(); @@ -438,18 +429,18 @@ std::list< IntersectElement > ArcCSegIntersector::getIntersectionsCharacteristic } if (!isN1) { - bool const i1_1S=_e1.getStartNode()->isEqual(*intersect1); - bool const i1_1E=_e1.getEndNode()->isEqual(*intersect1); - bool const i1_2S=_e2.getStartNode()->isEqual(*intersect1); - bool const i1_2E=_e2.getEndNode()->isEqual(*intersect1); + bool i1_1S=_e1.getStartNode()->isEqual(*intersect1); + bool i1_1E=_e1.getEndNode()->isEqual(*intersect1); + bool i1_2S=_e2.getStartNode()->isEqual(*intersect1); + bool i1_2E=_e2.getEndNode()->isEqual(*intersect1); ret.push_back(IntersectElement(getE1().getCharactValue(*intersect1),getE2().getCharactValue(*intersect1),i1_1S,i1_1E,i1_2S,i1_2E,intersect1,_e1,_e2,keepOrder())); } if(!isN2) { - bool const i2_1S=_e1.getStartNode()->isEqual(*intersect2); - bool const i2_1E=_e1.getEndNode()->isEqual(*intersect2); - bool const i2_2S=_e2.getStartNode()->isEqual(*intersect2); - bool const i2_2E=_e2.getEndNode()->isEqual(*intersect2); + bool i2_1S=_e1.getStartNode()->isEqual(*intersect2); + bool i2_1E=_e1.getEndNode()->isEqual(*intersect2); + bool i2_2S=_e2.getStartNode()->isEqual(*intersect2); + bool i2_2E=_e2.getEndNode()->isEqual(*intersect2); ret.push_back(IntersectElement(getE1().getCharactValue(*intersect2),getE2().getCharactValue(*intersect2),i2_1S,i2_1E,i2_2S,i2_2E,intersect2,_e1,_e2,keepOrder())); } } @@ -460,13 +451,13 @@ std::list< IntersectElement > ArcCSegIntersector::getIntersectionsCharacteristic ret.push_back(*_earlyInter); return ret; } - double const x=(_cross*_dy)/_drSq+center[0]; - double const y=(-_cross*_dx)/_drSq+center[1]; + double x=(_cross*_dy)/_drSq+center[0]; + double y=(-_cross*_dx)/_drSq+center[1]; Node *intersect3=new Node(x,y); intersect3->declareOnTangent(); - bool const i_1S=_e1.getStartNode()->isEqual(*intersect3); - bool const i_1E=_e1.getEndNode()->isEqual(*intersect3); - bool const i_2S=_e2.getStartNode()->isEqual(*intersect3); - bool const i_2E=_e2.getEndNode()->isEqual(*intersect3); + bool i_1S=_e1.getStartNode()->isEqual(*intersect3); + bool i_1E=_e1.getEndNode()->isEqual(*intersect3); + bool i_2S=_e2.getStartNode()->isEqual(*intersect3); + bool i_2E=_e2.getEndNode()->isEqual(*intersect3); ret.push_back(IntersectElement(_e1.getCharactValue(*intersect3),_e2.getCharactValue(*intersect3),i_1S,i_1E,i_2S,i_2E,intersect3,_e1,_e2,keepOrder())); } return ret; @@ -519,11 +510,11 @@ void EdgeArcCircle::changeMiddle(Node *newMiddle) Edge *EdgeArcCircle::buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const { - double const sx=((*start)[0]-_center[0])/_radius; - double const sy=((*start)[1]-_center[1])/_radius; - double const ex=((*end)[0]-_center[0])/_radius; - double const ey=((*end)[1]-_center[1])/_radius; - double const angle0=GetAbsoluteAngleOfNormalizedVect(direction?sx:ex,direction?sy:ey); + double sx=((*start)[0]-_center[0])/_radius; + double sy=((*start)[1]-_center[1])/_radius; + double ex=((*end)[0]-_center[0])/_radius; + double ey=((*end)[1]-_center[1])/_radius; + double angle0=GetAbsoluteAngleOfNormalizedVect(direction?sx:ex,direction?sy:ey); double deltaAngle=GetAbsoluteAngleOfNormalizedVect(sx*ex+sy*ey,sx*ey-sy*ex); if(deltaAngle>0. && _angle<0.) deltaAngle-=2.*M_PI; @@ -557,18 +548,18 @@ void EdgeArcCircle::unApplySimilarity(double xBary, double yBary, double dimChar void EdgeArcCircle::tesselate(const mcIdType *conn, mcIdType offset, double eps, std::vector& newConn, std::vector& addCoo) const { newConn.push_back(INTERP_KERNEL::NORM_POLYL); - int const nbOfSubDiv=(int)(fabs(_angle)/eps); + int nbOfSubDiv=(int)(fabs(_angle)/eps); if(nbOfSubDiv<=2) { newConn.push_back(conn[0]); newConn.push_back(conn[2]); newConn.push_back(conn[1]); return ; } - double const signOfAngle=_angle>0.?1.:-1.; + double signOfAngle=_angle>0.?1.:-1.; mcIdType offset2=offset+(ToIdType(addCoo.size()))/2; newConn.push_back(conn[0]); for(int i=1;idecrRef(); middle->decrRef(); end->decrRef(); - return nullptr; + return 0; } else { - auto *ret=new EdgeArcCircle(start,middle,end); + EdgeArcCircle *ret=new EdgeArcCircle(start,middle,end); start->decrRef(); middle->decrRef(); end->decrRef(); return ret; } @@ -618,14 +609,14 @@ double EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(double ux, double uy) void EdgeArcCircle::GetArcOfCirclePassingThru(const double *start, const double *middle, const double *end, double *center, double& radius, double& angleInRad, double& angleInRad0) { - double const delta=(middle[0]-start[0])*(end[1]-middle[1])-(end[0]-middle[0])*(middle[1]-start[1]); - double const b1=(middle[1]*middle[1]+middle[0]*middle[0]-start[0]*start[0]-start[1]*start[1])/2; - double const b2=(end[1]*end[1]+end[0]*end[0]-middle[0]*middle[0]-middle[1]*middle[1])/2; + double delta=(middle[0]-start[0])*(end[1]-middle[1])-(end[0]-middle[0])*(middle[1]-start[1]); + double b1=(middle[1]*middle[1]+middle[0]*middle[0]-start[0]*start[0]-start[1]*start[1])/2; + double b2=(end[1]*end[1]+end[0]*end[0]-middle[0]*middle[0]-middle[1]*middle[1])/2; center[0]=((end[1]-middle[1])*b1+(start[1]-middle[1])*b2)/delta; center[1]=((middle[0]-end[0])*b1+(middle[0]-start[0])*b2)/delta; radius=SafeSqrt((start[0]-center[0])*(start[0]-center[0])+(start[1]-center[1])*(start[1]-center[1])); angleInRad0=GetAbsoluteAngleOfNormalizedVect((start[0]-center[0])/radius,(start[1]-center[1])/radius); - double const angleInRadM=GetAbsoluteAngleOfNormalizedVect((middle[0]-center[0])/radius,(middle[1]-center[1])/radius); + double angleInRadM=GetAbsoluteAngleOfNormalizedVect((middle[0]-center[0])/radius,(middle[1]-center[1])/radius); angleInRad=GetAbsoluteAngleOfNormalizedVect(((start[0]-center[0])*(end[0]-center[0])+(start[1]-center[1])*(end[1]-center[1]))/(radius*radius), ((start[0]-center[0])*(end[1]-center[1])-(start[1]-center[1])*(end[0]-center[0]))/(radius*radius)); if(IsAngleNotIn(angleInRad0,angleInRad,angleInRadM)) @@ -699,14 +690,14 @@ void EdgeArcCircle::getBarycenter(double *bary) const */ void EdgeArcCircle::getBarycenterOfZone(double *bary) const { - double const x0=_center[0]; - double const y0=_center[1]; - double const angle1=_angle0+_angle; - double const tmp1=sin(angle1); - double const tmp0=sin(_angle0); - double const tmp2=_radius*_radius*_radius; - double const tmp3=cos(angle1); - double const tmp4=cos(_angle0); + double x0=_center[0]; + double y0=_center[1]; + double angle1=_angle0+_angle; + double tmp1=sin(angle1); + double tmp0=sin(_angle0); + double tmp2=_radius*_radius*_radius; + double tmp3=cos(angle1); + double tmp4=cos(_angle0); bary[0]=_radius*x0*y0*(tmp4-tmp3)+_radius*_radius*(y0*(cos(2*_angle0)-cos(2*angle1))/4.+ x0*(_angle/2.+(sin(2.*_angle0)-sin(2.*angle1))/4.)) +tmp2*(tmp1*tmp1*tmp1-tmp0*tmp0*tmp0)/3.; @@ -803,16 +794,16 @@ bool EdgeArcCircle::isLower(double val1, double val2) const */ double EdgeArcCircle::getCharactValue(const Node& node) const { - double const dx=(node[0]-_center[0])/_radius; - double const dy=(node[1]-_center[1])/_radius; + double dx=(node[0]-_center[0])/_radius; + double dy=(node[1]-_center[1])/_radius; return GetAbsoluteAngleOfNormalizedVect(dx,dy); } double EdgeArcCircle::getCharactValueBtw0And1(const Node& node) const { - double const dx=(node[0]-_center[0])/_radius; - double const dy=(node[1]-_center[1])/_radius; - double const angle=GetAbsoluteAngleOfNormalizedVect(dx,dy); + double dx=(node[0]-_center[0])/_radius; + double dy=(node[1]-_center[1])/_radius; + double angle=GetAbsoluteAngleOfNormalizedVect(dx,dy); // double myDelta=angle-_angle0; if(_angle>0.) @@ -824,23 +815,23 @@ double EdgeArcCircle::getCharactValueBtw0And1(const Node& node) const double EdgeArcCircle::getDistanceToPoint(const double *pt) const { - double const angle=Node::computeAngle(_center,pt); + double angle=Node::computeAngle(_center,pt); if(IsIn2Pi(_angle0,_angle,angle)) return fabs(Node::distanceBtw2Pt(_center,pt)-_radius); else { - double const dist1=Node::distanceBtw2Pt(*_start,pt); - double const dist2=Node::distanceBtw2Pt(*_end,pt); + double dist1=Node::distanceBtw2Pt(*_start,pt); + double dist2=Node::distanceBtw2Pt(*_end,pt); return std::min(dist1,dist2); } } bool EdgeArcCircle::isNodeLyingOn(const double *coordOfNode) const { - double const dist=Node::distanceBtw2Pt(_center,coordOfNode); + double dist=Node::distanceBtw2Pt(_center,coordOfNode); if(Node::areDoubleEquals(dist,_radius)) { - double const angle=Node::computeAngle(_center,coordOfNode); + double angle=Node::computeAngle(_center,coordOfNode); return IsIn2Pi(_angle0,_angle,angle); } else diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx index f4c86e117..627bcbb33 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx @@ -22,17 +22,8 @@ #define __INTERPKERNELGEO2DEDGEARCCIRCLE_HXX__ #include "INTERPKERNELDefines.hxx" -#include "InterpKernelGeo2DBounds.hxx" #include "InterpKernelGeo2DEdge.hxx" -#include "InterpKernelGeo2DNode.hxx" #include "MCIdType.hxx" -#include -#include -#include -#include -#include -#include -#include namespace INTERP_KERNEL { @@ -40,11 +31,11 @@ namespace INTERP_KERNEL { public: ArcCArcCIntersector(const EdgeArcCircle& e1, const EdgeArcCircle& e2); - bool haveTheySameDirection() const override; - bool areColinears() const override; - void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const override; - void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped) override; - std::list< IntersectElement > getIntersectionsCharacteristicVal() const override; + bool haveTheySameDirection() const; + bool areColinears() const; + void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const; + void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped); + std::list< IntersectElement > getIntersectionsCharacteristicVal() const; private: //! return angle in ]-Pi;Pi[ - 'node' must be on curve of '_e1' double getAngle(Node *node) const; @@ -65,10 +56,10 @@ namespace INTERP_KERNEL public: ArcCSegIntersector(const EdgeArcCircle& e1, const EdgeLin& e2, bool reverse=true); //virtual overloading - bool areColinears() const override; - void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const override; - void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped) override; - std::list< IntersectElement > getIntersectionsCharacteristicVal() const override; + bool areColinears() const; + void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const; + void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped); + std::list< IntersectElement > getIntersectionsCharacteristicVal() const; private: const EdgeArcCircle& getE1() const { return (const EdgeArcCircle&)_e1; } const EdgeLin& getE2() const { return (const EdgeLin&)_e2; } @@ -90,29 +81,29 @@ namespace INTERP_KERNEL EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction=true); //! for tests void changeMiddle(Node *newMiddle); - void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const override; - void update(Node *m) override; - double getAreaOfZone() const override; - double getCurveLength() const override; - void getBarycenter(double *bary) const override; - void getBarycenterOfZone(double *bary) const override; - void getMiddleOfPoints(const double *p1, const double *p2, double *mid) const override; - void getMiddleOfPointsOriented(const double *p1, const double *p2, double *mid) const override; - bool isIn(double characterVal) const override; - Node *buildRepresentantOfMySelf() const override; - bool isLower(double val1, double val2) const override; - double getCharactValue(const Node& node) const override; - double getCharactValueBtw0And1(const Node& node) const override; - double getDistanceToPoint(const double *pt) const override; - bool isNodeLyingOn(const double *coordOfNode) const override; - TypeOfFunction getTypeOfFunc() const override { return ARC_CIRCLE; } - void dynCastFunction(const EdgeLin * & /*seg*/, - const EdgeArcCircle * &arcSeg) const override { arcSeg=this; } + void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const; + void update(Node *m); + double getAreaOfZone() const; + double getCurveLength() const; + void getBarycenter(double *bary) const; + void getBarycenterOfZone(double *bary) const; + void getMiddleOfPoints(const double *p1, const double *p2, double *mid) const; + void getMiddleOfPointsOriented(const double *p1, const double *p2, double *mid) const; + bool isIn(double characterVal) const; + Node *buildRepresentantOfMySelf() const; + bool isLower(double val1, double val2) const; + double getCharactValue(const Node& node) const; + double getCharactValueBtw0And1(const Node& node) const; + double getDistanceToPoint(const double *pt) const; + bool isNodeLyingOn(const double *coordOfNode) const; + TypeOfFunction getTypeOfFunc() const { return ARC_CIRCLE; } + void dynCastFunction(const EdgeLin * &seg, + const EdgeArcCircle * &arcSeg) const { arcSeg=this; } const double *getCenter() const { return _center; } void getCenter(double *center) const { center[0]=_center[0]; center[1]=_center[1]; } - bool doIHaveSameDirectionAs(const Edge& /*other*/) const { return false; } - void applySimilarity(double xBary, double yBary, double dimChar) override; - void unApplySimilarity(double xBary, double yBary, double dimChar) override; + bool doIHaveSameDirectionAs(const Edge& other) const { return false; } + void applySimilarity(double xBary, double yBary, double dimChar); + void unApplySimilarity(double xBary, double yBary, double dimChar); double getAngle0() const { return _angle0; } double getRadius() const { return _radius; } double getAngle() const { return _angle; } @@ -123,7 +114,7 @@ namespace INTERP_KERNEL static void GetArcOfCirclePassingThru(const double *start, const double *middle, const double *end, double *center, double& radius, double& angleInRad, double& angleInRad0); //! To avoid in aggressive optimizations nan. - static double SafeSqrt(double val) { double const ret=std::max(val,0.); return sqrt(ret); } + static double SafeSqrt(double val) { double ret=std::max(val,0.); return sqrt(ret); } static double SafeAcos(double cosAngle) { double ret=std::min(cosAngle,1.); ret=std::max(ret,-1.); return acos(ret); } static double SafeAsin(double sinAngle) { double ret=std::min(sinAngle,1.); ret=std::max(ret,-1.); return asin(ret); } //! @param start and @param angleIn in ]-Pi;Pi] and @param delta in ]-2*Pi,2*Pi[ @@ -134,7 +125,7 @@ namespace INTERP_KERNEL static double NormalizeAngle(double angle) { if(angle>M_PI) return angle-2.*M_PI; if(angle<-M_PI) return angle+2.*M_PI; return angle; } protected: void updateBounds(); - Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const override; + Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const; protected: //! Absolute angle where the arc starts. Value between -Pi and Pi diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.cxx index 294840ada..bd3b45ac2 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.cxx @@ -19,8 +19,6 @@ // Author : Anthony Geay (CEA/DEN) #include "InterpKernelGeo2DEdgeInfLin.hxx" -#include "InterpKernelGeo2DNode.hxx" -#include using namespace INTERP_KERNEL; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.hxx index 4d36d69ba..13aa21895 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.hxx @@ -21,9 +21,7 @@ #ifndef __INTERPKERNELGEO2DEDGEINFLIN_HXX__ #define __INTERPKERNELGEO2DEDGEINFLIN_HXX__ -#include "InterpKernelGeo2DEdge.hxx" #include "InterpKernelGeo2DEdgeLin.hxx" -#include "InterpKernelGeo2DNode.hxx" namespace INTERP_KERNEL { @@ -32,11 +30,11 @@ namespace INTERP_KERNEL public: EdgeInfLin(Node *start, Node *end):EdgeLin(start,end,true) { } EdgeInfLin(Node *pointPassingThrough, double slope); - bool isIn(double /*characterVal*/) const override { return true; } + bool isIn(double characterVal) const { return true; } void dynCastFunction(const EdgeLin * &seg, - const EdgeArcCircle * & /*arcSeg*/) const override { seg=this; } + const EdgeArcCircle * &arcSeg) const { seg=this; } protected: - ~EdgeInfLin() override = default; + ~EdgeInfLin() { } }; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx index 695e5d463..a1044f94e 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx @@ -19,14 +19,9 @@ // Author : Anthony Geay (CEA/DEN) #include "InterpKernelGeo2DEdgeLin.hxx" -#include "InterpKernelGeo2DEdge.hxx" #include "InterpKernelGeo2DNode.hxx" -#include "InterpKernelGeo2DPrecision.hxx" -#include -#include -#include -#include -#include +#include "InterpKernelException.hxx" +#include "NormalizedUnstructuredMesh.hxx" using namespace INTERP_KERNEL; @@ -78,7 +73,7 @@ void SegSegIntersector::getCurveAbscisse(Node *node, TypeOfLocInEdge& where, Mer obviousCaseForCurvAbscisse(node,where,commonNode,obvious); if(obvious) return ; - double const ret=((*node)[!_ind]-(*_e1.getStartNode())[!_ind])/((*_e1.getEndNode())[!_ind]-(*_e1.getStartNode())[!_ind]); + double ret=((*node)[!_ind]-(*_e1.getStartNode())[!_ind])/((*_e1.getEndNode())[!_ind]-(*_e1.getStartNode())[!_ind]); if(ret>0. && ret <1.) where=INSIDE; else if(ret<0.) @@ -100,15 +95,15 @@ std::list< IntersectElement > SegSegIntersector::getIntersectionsCharacteristicV return ret; } - double const x= (-_matrix[2]*_col[0]+_matrix[0]*_col[1]) / _determinant; - double const y= (-_matrix[3]*_col[0]+_matrix[1]*_col[1]) / _determinant; + double x= (-_matrix[2]*_col[0]+_matrix[0]*_col[1]) / _determinant; + double y= (-_matrix[3]*_col[0]+_matrix[1]*_col[1]) / _determinant; //Only one intersect point possible Node *node=new Node(x,y); node->declareOn(); - bool const i_1S=_e1.getStartNode()->isEqual(*node); - bool const i_1E=_e1.getEndNode()->isEqual(*node); - bool const i_2S=_e2.getStartNode()->isEqual(*node); - bool const i_2E=_e2.getEndNode()->isEqual(*node); + bool i_1S=_e1.getStartNode()->isEqual(*node); + bool i_1E=_e1.getEndNode()->isEqual(*node); + bool i_2S=_e2.getStartNode()->isEqual(*node); + bool i_2E=_e2.getEndNode()->isEqual(*node); ret.push_back(IntersectElement(_e1.getCharactValue(*node), _e2.getCharactValue(*node), i_1S,i_1E,i_2S,i_2E,node,_e1,_e2,keepOrder())); @@ -162,15 +157,15 @@ void SegSegIntersector::areOverlappedOrOnlyColinears(bool& obviousNoIntersection else // Colinear vectors { // Compute vectors joining tips of e1 and e2 - double const xS=(*(_e1.getStartNode()))[0]-(*(_e2.getStartNode()))[0]; - double const yS=(*(_e1.getStartNode()))[1]-(*(_e2.getStartNode()))[1]; - double const xE=(*(_e1.getEndNode()))[0]-(*(_e2.getEndNode()))[0]; - double const yE=(*(_e1.getEndNode()))[1]-(*(_e2.getEndNode()))[1]; + double xS=(*(_e1.getStartNode()))[0]-(*(_e2.getStartNode()))[0]; + double yS=(*(_e1.getStartNode()))[1]-(*(_e2.getStartNode()))[1]; + double xE=(*(_e1.getEndNode()))[0]-(*(_e2.getEndNode()))[0]; + double yE=(*(_e1.getEndNode()))[1]-(*(_e2.getEndNode()))[1]; double maxDimS(std::max(fabs(xS),fabs(yS))), maxDimE(std::max(fabs(xE), fabs(yE))); bool isS = (maxDimS > maxDimE), isE1 = (dimCharE1 >= dimCharE2); - double const x = isS ? xS : xE; - double const y = isS ? yS : yE; - unsigned const shift = isE1 ? 0 : 2; + double x = isS ? xS : xE; + double y = isS ? yS : yE; + unsigned shift = isE1 ? 0 : 2; // test colinearity of the greatest tip-joining vector and greatest vector among {e1, e2} areOverlapped = fabs(x*_matrix[1+shift]-y*_matrix[0+shift]) < dimCharE1*dimCharE2*QuadraticPlanarPrecision::getPrecision(); // explanation: if areOverlapped is true, we don't know yet if there will be an intersection (see meaning of areOverlapped in method doxy above) @@ -199,7 +194,8 @@ EdgeLin::EdgeLin(double sX, double sY, double eX, double eY):Edge(sX,sY,eX,eY) } EdgeLin::~EdgeLin() -= default; +{ +} /*! * Characteristic for edges is relative position btw 0.;1. @@ -226,7 +222,7 @@ double EdgeLin::getCharactValueBtw0And1(const Node& node) const double EdgeLin::getDistanceToPoint(const double *pt) const { - double const loc=getCharactValueEng(pt); + double loc=getCharactValueEng(pt); if(loc>0. && loc<1.) { double tmp[2]; @@ -236,15 +232,15 @@ double EdgeLin::getDistanceToPoint(const double *pt) const } else { - double const dist1=Node::distanceBtw2Pt(*_start,pt); - double const dist2=Node::distanceBtw2Pt(*_end,pt); + double dist1=Node::distanceBtw2Pt(*_start,pt); + double dist2=Node::distanceBtw2Pt(*_end,pt); return std::min(dist1,dist2); } } bool EdgeLin::isNodeLyingOn(const double *coordOfNode) const { - double const dBase=sqrt(_start->distanceWithSq(*_end)); + double dBase=sqrt(_start->distanceWithSq(*_end)); double d1=Node::distanceBtw2Pt(*_start,coordOfNode); d1+=Node::distanceBtw2Pt(*_end,coordOfNode); return Node::areDoubleEquals(dBase,d1); @@ -260,7 +256,7 @@ void EdgeLin::dumpInXfigFile(std::ostream& stream, bool direction, int resolutio stream << std::endl; } -void EdgeLin::update(Node * /*m*/) +void EdgeLin::update(Node *m) { updateBounds(); } @@ -301,10 +297,10 @@ void EdgeLin::getBarycenter(double *bary) const */ void EdgeLin::getBarycenterOfZone(double *bary) const { - double const x1=(*_start)[0]; - double const y1=(*_start)[1]; - double const x2=(*_end)[0]; - double const y2=(*_end)[1]; + double x1=(*_start)[0]; + double y1=(*_start)[1]; + double x2=(*_end)[0]; + double y2=(*_end)[1]; bary[0]=(x1-x2)*(y1*(2.*x1+x2)+y2*(2.*x2+x1))/6.; //bary[0]+=(y1-y2)*(x2*x2/3.-(x1*x2+x1*x1)/6.)+y1*(x1*x1-x2*x2)/2.; //bary[0]+=(y1-y2)*((x2*x2+x1*x2+x1*x1)/3.-(x2+x1)*x1/2.)+y1*(x1*x1-x2*x2)/2.; @@ -322,8 +318,8 @@ void EdgeLin::getMiddleOfPoints(const double *p1, const double *p2, double *mid) double EdgeLin::getCurveLength() const { - double const x=(*_start)[0]-(*_end)[0]; - double const y=(*_start)[1]-(*_end)[1]; + double x=(*_start)[0]-(*_end)[0]; + double y=(*_start)[1]-(*_end)[1]; return sqrt(x*x+y*y); } @@ -342,7 +338,7 @@ void EdgeLin::updateBounds() double EdgeLin::getCharactValueEng(const double *node) const { - double const car1_1x=node[0]-(*(_start))[0]; double const car1_2x=(*(_end))[0]-(*(_start))[0]; - double const car1_1y=node[1]-(*(_start))[1]; double const car1_2y=(*(_end))[1]-(*(_start))[1]; + double car1_1x=node[0]-(*(_start))[0]; double car1_2x=(*(_end))[0]-(*(_start))[0]; + double car1_1y=node[1]-(*(_start))[1]; double car1_2y=(*(_end))[1]-(*(_start))[1]; return (car1_1x*car1_2x+car1_1y*car1_2y)/(car1_2x*car1_2x+car1_2y*car1_2y); } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx index 0c7408f0c..dca0e1d08 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx @@ -22,12 +22,7 @@ #define __INTERPKERNELGEO2DEDGELIN_HXX__ #include "INTERPKERNELDefines.hxx" -#include "InterpKernelGeo2DBounds.hxx" #include "InterpKernelGeo2DEdge.hxx" -#include "InterpKernelGeo2DNode.hxx" -#include -#include -#include namespace INTERP_KERNEL { @@ -36,11 +31,11 @@ namespace INTERP_KERNEL friend class Edge; public: SegSegIntersector(const EdgeLin& e1, const EdgeLin& e2); - bool areColinears() const override; - bool haveTheySameDirection() const override; - void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const override; - void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped) override; - std::list< IntersectElement > getIntersectionsCharacteristicVal() const override; + bool areColinears() const; + bool haveTheySameDirection() const; + void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const; + void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped); + std::list< IntersectElement > getIntersectionsCharacteristicVal() const; private: void getCurveAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode) const; private: @@ -58,31 +53,31 @@ namespace INTERP_KERNEL EdgeLin(std::istream& lineInXfig); EdgeLin(Node *start, Node *end, bool direction=true); EdgeLin(double sX, double sY, double eX, double eY); - ~EdgeLin() override; - TypeOfFunction getTypeOfFunc() const override { return SEG; } - void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const override; - void update(Node *m) override; + ~EdgeLin(); + TypeOfFunction getTypeOfFunc() const { return SEG; } + void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const; + void update(Node *m); double getNormSq() const; - double getAreaOfZone() const override; - double getCurveLength() const override; - void getBarycenter(double *bary) const override; - void getBarycenterOfZone(double *bary) const override; - void getMiddleOfPoints(const double *p1, const double *p2, double *mid) const override; - bool isIn(double characterVal) const override; - Node *buildRepresentantOfMySelf() const override; - double getCharactValue(const Node& node) const override; - double getCharactValueBtw0And1(const Node& node) const override; - double getDistanceToPoint(const double *pt) const override; - bool isNodeLyingOn(const double *coordOfNode) const override; - bool isLower(double val1, double val2) const override { return val1 -#include "InterpKernelGeo2DNode.hxx" -#include -#include -#include "MCIdType.hxx" -#include using namespace INTERP_KERNEL; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx index 9b710a444..22ca3b4c3 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx @@ -22,13 +22,9 @@ #define __INTERPKERNELGEO2DELEMENTARYEDGE_HXX__ #include "INTERPKERNELDefines.hxx" +#include "InterpKernelException.hxx" #include "InterpKernelGeo2DAbstractEdge.hxx" #include "InterpKernelGeo2DEdge.hxx" -#include -#include -#include -#include "MCIdType.hxx" -#include namespace INTERP_KERNEL { @@ -48,7 +44,7 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT Edge *getPtr() const { return _ptr; } INTERPKERNEL_EXPORT void reverse() { _direction=(!_direction); } INTERPKERNEL_EXPORT bool isNodeIn(Node *n) const; - INTERPKERNEL_EXPORT double getAreaOfZone() const { double const ret=_ptr->getAreaOfZone(); return _direction?ret:-ret; } + INTERPKERNEL_EXPORT double getAreaOfZone() const { double ret=_ptr->getAreaOfZone(); return _direction?ret:-ret; } INTERPKERNEL_EXPORT void getBarycenterOfZone(double *bary) const; INTERPKERNEL_EXPORT void fillBounds(Bounds& output) const; INTERPKERNEL_EXPORT void applySimilarity(double xBary, double yBary, double dimChar) { _ptr->applySimilarity(xBary,yBary,dimChar); } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx index 9ca2ab366..57c6c977c 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx @@ -20,15 +20,6 @@ #include "InterpKernelGeo2DNode.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" -#include -#include -#include -#include -#include -#include -#include "MCIdType.hxx" -#include -#include using namespace INTERP_KERNEL; @@ -53,11 +44,12 @@ Node::Node(std::istream& stream):_cnt(1),_loc(UNKNOWN) } Node::~Node() -= default; +{ +} bool Node::decrRef() { - bool const ret=(--_cnt==0); + bool ret=(--_cnt==0); if(ret) delete this; return ret; @@ -83,7 +75,7 @@ double Node::getSlope(const Node& other) const */ bool Node::isEqualAndKeepTrack(const Node& other, std::vector& track) const { - bool const ret=isEqual(other); + bool ret=isEqual(other); if(ret) track.push_back(const_cast(&other)); return ret; @@ -106,10 +98,10 @@ double Node::distanceWithSq(const Node& other) const */ double Node::computeSlope(const double *pt1, const double *pt2) { - double const x=pt2[0]-pt1[0]; - double const y=pt2[1]-pt1[1]; - double const norm=sqrt(x*x+y*y); - double const ret=EdgeArcCircle::SafeAcos(fabs(x)/norm); + double x=pt2[0]-pt1[0]; + double y=pt2[1]-pt1[1]; + double norm=sqrt(x*x+y*y); + double ret=EdgeArcCircle::SafeAcos(fabs(x)/norm); if( (x>=0. && y>=0.) || (x<0. && y<0.) ) return ret; else @@ -122,9 +114,9 @@ double Node::computeSlope(const double *pt1, const double *pt2) */ double Node::computeAngle(const double *pt1, const double *pt2) { - double const x=pt2[0]-pt1[0]; - double const y=pt2[1]-pt1[1]; - double const norm=sqrt(x*x+y*y); + double x=pt2[0]-pt1[0]; + double y=pt2[1]-pt1[1]; + double norm=sqrt(x*x+y*y); return EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(x/norm,y/norm); } @@ -159,7 +151,7 @@ void Node::unApplySimilarity(double xBary, double yBary, double dimChar) void Node::fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, std::vector& addCoo, std::map& mapAddCoo, mcIdType *nodeId) const { - auto it=mapOther.find(const_cast(this)); + std::map::const_iterator it=mapOther.find(const_cast(this)); if(it!=mapOther.end()) // order matters, try in mapOther first. { *nodeId=(*it).second+offset1; @@ -177,7 +169,7 @@ void Node::fillGlobalInfoAbs(const std::map& map *nodeId=(*it).second; return; } - int const id=(int)addCoo.size()/2; + int id=(int)addCoo.size()/2; addCoo.push_back(fact*_coords[0]+baryX); addCoo.push_back(fact*_coords[1]+baryY); *nodeId=offset2+id; @@ -191,7 +183,7 @@ void Node::fillGlobalInfoAbs2(const std::map& ma std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const { mcIdType tmp; - std::size_t const sz1=addCoo.size(); + std::size_t sz1=addCoo.size(); fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,&tmp); if(sz1!=addCoo.size() // newly created point || (tmp >= offset2 // or previously created point merged with a neighbour @@ -200,7 +192,7 @@ void Node::fillGlobalInfoAbs2(const std::map& ma pointsOther.push_back(tmp); return ; } - std::vector::const_iterator const it=std::find(pointsOther.begin(),pointsOther.end(),tmp); + std::vector::const_iterator it=std::find(pointsOther.begin(),pointsOther.end(),tmp); if(it!=pointsOther.end()) return ; pointsOther.push_back(tmp); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 18d7d2048..a1f38483d 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -19,35 +19,20 @@ // Author : Anthony Geay (CEA/DEN) #include "InterpKernelGeo2DQuadraticPolygon.hxx" -#include "InterpKernelGeo2DEdge.hxx" #include "InterpKernelGeo2DElementaryEdge.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DAbstractEdge.hxx" #include "InterpKernelGeo2DEdgeLin.hxx" #include "InterpKernelGeo2DBounds.hxx" -#include "NormalizedGeometricTypes" +#include "InterpKernelGeo2DEdge.txx" -#include "MCIdType.hxx" -#include "InterpKernelGeo2DNode.hxx" +#include "NormalizedUnstructuredMesh.hxx" -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include #include #include #include #include -#include -#include -#include using namespace INTERP_KERNEL; @@ -73,7 +58,7 @@ QuadraticPolygon::QuadraticPolygon(const char *file) newEdge->changeStartNodeWith(back()->getEndNode()); pushBack(newEdge); } - while(true); + while(1); } catch(const std::ifstream::failure&) { @@ -97,12 +82,13 @@ QuadraticPolygon::QuadraticPolygon(const char *file) } QuadraticPolygon::~QuadraticPolygon() -= default; +{ +} QuadraticPolygon *QuadraticPolygon::BuildLinearPolygon(std::vector& nodes) { - auto *ret(new QuadraticPolygon); - std::size_t const size=nodes.size(); + QuadraticPolygon *ret(new QuadraticPolygon); + std::size_t size=nodes.size(); for(std::size_t i=0;ipushBack(new EdgeLin(nodes[i],nodes[(i+1)%size])); @@ -113,16 +99,16 @@ QuadraticPolygon *QuadraticPolygon::BuildLinearPolygon(std::vector& node QuadraticPolygon *QuadraticPolygon::BuildArcCirclePolygon(std::vector& nodes) { - auto *ret(new QuadraticPolygon); - std::size_t const size=nodes.size(); + QuadraticPolygon *ret(new QuadraticPolygon); + std::size_t size=nodes.size(); for(std::size_t i=0;ipushBack(new EdgeLin(nodes[i],nodes[(i+1)%(size/2)])); @@ -146,11 +132,11 @@ Edge *QuadraticPolygon::BuildArcCircleEdge(std::vector& nodes) { if(nodes.size()!=3) throw INTERP_KERNEL::Exception("QuadraticPolygon::BuildArcCircleEdge : input vector is expected to be of size 3 !"); - auto *e1(new EdgeLin(nodes[0],nodes[2])),*e2(new EdgeLin(nodes[2],nodes[1])); - SegSegIntersector const inters(*e1,*e2); - bool const colinearity=inters.areColinears(); + EdgeLin *e1(new EdgeLin(nodes[0],nodes[2])),*e2(new EdgeLin(nodes[2],nodes[1])); + SegSegIntersector inters(*e1,*e2); + bool colinearity=inters.areColinears(); delete e1; delete e2; - Edge *ret(nullptr); + Edge *ret(0); if(colinearity) ret=new EdgeLin(nodes[0],nodes[1]); else @@ -164,7 +150,7 @@ void QuadraticPolygon::BuildDbgFile(const std::vector& nodes, const char std::ofstream file(fileName); file << std::setprecision(16); file << " double coords[]=" << std::endl << " { "; - for(auto iter=nodes.begin();iter!=nodes.end();iter++) + for(std::vector::const_iterator iter=nodes.begin();iter!=nodes.end();iter++) { if(iter!=nodes.begin()) file << "," << std::endl << " "; @@ -195,7 +181,7 @@ bool QuadraticPolygon::isButterflyAbs() double xBary,yBary; b.prepareForAggregation(); fillBounds(b); - double const dimChar=b.getCaracteristicDim(); + double dimChar=b.getCaracteristicDim(); b.getBarycenter(xBary,yBary); applyGlobalSimilarity(xBary,yBary,dimChar); // @@ -204,16 +190,16 @@ bool QuadraticPolygon::isButterflyAbs() bool QuadraticPolygon::isButterfly() const { - for(auto it=_sub_edges.begin();it!=_sub_edges.end();it++) + for(std::list::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++) { Edge *e1=(*it)->getPtr(); - auto it2=it; + std::list::const_iterator it2=it; it2++; for(;it2!=_sub_edges.end();it2++) { MergePoints commonNode; - auto *outVal1=new ComposedEdge; - auto *outVal2=new ComposedEdge; + ComposedEdge *outVal1=new ComposedEdge; + ComposedEdge *outVal2=new ComposedEdge; Edge *e2=(*it2)->getPtr(); if(e1->intersectWith(e2,commonNode,*outVal1,*outVal2)) { @@ -270,12 +256,12 @@ void QuadraticPolygon::dumpInXfigFile(std::ostream& stream, int resolution, cons double QuadraticPolygon::intersectWithAbs(QuadraticPolygon& other) { double ret=0.,xBaryBB,yBaryBB; - double const fact=normalize(&other,xBaryBB,yBaryBB); - std::vector const polygs=intersectMySelfWith(other); - for(auto & polyg : polygs) + double fact=normalize(&other,xBaryBB,yBaryBB); + std::vector polygs=intersectMySelfWith(other); + for(std::vector::iterator iter=polygs.begin();iter!=polygs.end();iter++) { - ret+=fabs(polyg->getArea()); - delete polyg; + ret+=fabs((*iter)->getArea()); + delete *iter; } return ret*fact*fact; } @@ -306,13 +292,13 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, std::vector& addCoo, std::map& mergedNodes) { double xBaryBB, yBaryBB; - double const fact=normalizeExt(&other, xBaryBB, yBaryBB); + double fact=normalizeExt(&other, xBaryBB, yBaryBB); // IteratorOnComposedEdge itThis(this),itOther(&other); // other is (part of) the tool mesh MergePoints merge; - auto *cThis=new ComposedEdge; - auto *cOther=new ComposedEdge; + ComposedEdge *cThis=new ComposedEdge; + ComposedEdge *cOther=new ComposedEdge; int i=0; std::map mapAddCoo; for(itOther.first();!itOther.finished();itOther.next(),i++) @@ -336,7 +322,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, ElementaryEdge* curThis=itThis.current(); merge.clear(); // - auto thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())), + std::map::const_iterator thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())), otherStart(mapOther.find(curOtherTmp->getStartNode())),otherEnd(mapOther.find(curOtherTmp->getEndNode())); mcIdType thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second), thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second), otherStart2(otherStart==mapOther.end()?-1:(*otherStart).second+offset1),otherEnd2(otherEnd==mapOther.end()?-1:(*otherEnd).second+offset1); @@ -379,7 +365,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, std::size_t jj = 0, sz(otherTmp._sub_edges.size()); for(std::list::const_iterator it=otherTmp._sub_edges.begin();it!=otherTmp._sub_edges.end();it++, jj++) { - short const skipStartOrEnd = jj == 0 ? -1 : (jj == sz-1 ? 1 : 0); // -1 means START, 1 means END, 0 other + short skipStartOrEnd = jj == 0 ? -1 : (jj == sz-1 ? 1 : 0); // -1 means START, 1 means END, 0 other (*it)->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2, fact,xBaryBB,yBaryBB, skipStartOrEnd, /*out*/ subDivOther[otherEdgeIds[i]],addCoo,mapAddCoo); @@ -403,7 +389,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, void QuadraticPolygon::buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges) { - std::size_t const nbOfSeg=std::distance(descBg,descEnd); + std::size_t nbOfSeg=std::distance(descBg,descEnd); for(std::size_t i=0;i0; - mcIdType const edgeId=std::abs(descBg[edgePos])-1; // back to C indexing mode + bool direct=descBg[edgePos]>0; + mcIdType edgeId=std::abs(descBg[edgePos])-1; // back to C indexing mode const std::vector& subEdge=intersectEdges[edgeId]; - std::size_t const nbOfSubEdges=subEdge.size()/2; + std::size_t nbOfSubEdges=subEdge.size()/2; for(std::size_t j=0;j0; - mcIdType const edgeId=std::abs(descBg[edgePos])-1; + bool direct=descBg[edgePos]>0; + mcIdType edgeId=std::abs(descBg[edgePos])-1; const std::vector& subEdge=intersectEdges[edgeId]; - std::size_t const nbOfSubEdges=subEdge.size()/2; + std::size_t nbOfSubEdges=subEdge.size()/2; if(colinearity) { for(std::size_t j=0;j& subEdge, const std::map& mapp) +void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType edgeId, const std::vector& subEdge, const std::map& mapp) { - std::size_t const nbOfSubEdges=subEdge.size()/2; + std::size_t nbOfSubEdges=subEdge.size()/2; if(!baseEdge) {//it is not a quadratic subedge Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second; @@ -474,7 +460,7 @@ void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second; Node *end=(*mapp.find(direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2])).second; Edge *ee=baseEdge->buildEdgeLyingOnMe(start,end); - auto *eee=new ElementaryEdge(ee,true); + ElementaryEdge *eee=new ElementaryEdge(ee,true); pushBack(eee); } } @@ -488,27 +474,27 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map >& colinear1, std::map >& alreadyExistingIn2) { - std::size_t const nbOfSeg=std::distance(descBg,descEnd); + std::size_t nbOfSeg=std::distance(descBg,descEnd); for(std::size_t i=0;i0; - mcIdType const edgeId=std::abs(descBg[i])-1;//current edge id of pol2 + bool direct=descBg[i]>0; + mcIdType edgeId=std::abs(descBg[i])-1;//current edge id of pol2 std::map >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]); if(it1!=alreadyExistingIn2.end() || it2!=alreadyExistingIn2.end()) { - bool const sameDir=(it1!=alreadyExistingIn2.end()); + bool sameDir=(it1!=alreadyExistingIn2.end()); const std::vector& edgesAlreadyBuilt=sameDir?(*it1).second:(*it2).second; if(sameDir) { - for(auto it3 : edgesAlreadyBuilt) + for(std::vector::const_iterator it3=edgesAlreadyBuilt.begin();it3!=edgesAlreadyBuilt.end();it3++) { - Edge *ee=it3->getPtr(); ee->incrRef(); - pushBack(new ElementaryEdge(ee,it3->getDirection())); + Edge *ee=(*it3)->getPtr(); ee->incrRef(); + pushBack(new ElementaryEdge(ee,(*it3)->getDirection())); } } else { - for(auto it4=edgesAlreadyBuilt.rbegin();it4!=edgesAlreadyBuilt.rend();it4++) + for(std::vector::const_reverse_iterator it4=edgesAlreadyBuilt.rbegin();it4!=edgesAlreadyBuilt.rend();it4++) { Edge *ee=(*it4)->getPtr(); ee->incrRef(); pushBack(new ElementaryEdge(ee,!(*it4)->getDirection())); @@ -522,10 +508,10 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map& c=colinear1[edgeId]; - std::size_t const nbOfEdgesIn1=std::distance(descBg1,descEnd1); + std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1); for(std::size_t j=0;j >(edgeId1,std::pair(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2 @@ -537,10 +523,10 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map::const_reverse_iterator it5=_sub_edges.rbegin(); for(std::size_t p=0;p& subEdge=intersectEdges2[edgeId]; - std::size_t const nbOfSubEdges=subEdge.size()/2; + std::size_t nbOfSubEdges=subEdge.size()/2; for(std::size_t j=0;j > >::const_iterator it=idIns1.begin();it!=idIns1.end() && !found;it++) { - mcIdType const idIn1=(*it).first;//store if needed the cell id in 1 + mcIdType idIn1=(*it).first;//store if needed the cell id in 1 direct1=(*it).second.first; offset1=(*it).second.second; const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; @@ -590,7 +576,7 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map(offset1+(direct1?offset2:nbOfSubEdges1-offset2-1))]; Edge *ee=e->getPtr(); ee->incrRef(); - auto *e2=new ElementaryEdge(ee,!(direct1^direction11)); + ElementaryEdge *e2=new ElementaryEdge(ee,!(direct1^direction11)); pushBack(e2); alreadyExistingIn2[descBg[i]].push_back(e2); } @@ -607,32 +593,32 @@ void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(const mcIdType *descBg const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector >& intersectEdges1, const std::vector< std::vector >& colinear1) const { - std::size_t const nbOfSeg=std::distance(descBg,descEnd); + std::size_t nbOfSeg=std::distance(descBg,descEnd); for(std::size_t i=0;i0; - mcIdType const edgeId=std::abs(descBg[i])-1;//current edge id of pol2 + bool direct=descBg[i]>0; + mcIdType edgeId=std::abs(descBg[i])-1;//current edge id of pol2 const std::vector& c=colinear1[edgeId]; if(c.empty()) continue; const std::vector& subEdge=intersectEdges[edgeId]; - std::size_t const nbOfSubEdges=subEdge.size()/2; + std::size_t nbOfSubEdges=subEdge.size()/2; // - std::size_t const nbOfEdgesIn1=std::distance(descBg1,descEnd1); + std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1); mcIdType offset1=0; for(std::size_t j=0;j0; + mcIdType idBg=direct?subEdge[2*k]:subEdge[2*nbOfSubEdges-2*k-1]; + mcIdType idEnd=direct?subEdge[2*k+1]:subEdge[2*nbOfSubEdges-2*k-2]; + mcIdType idIn1=edgeId1; + bool direct1=descBg1[j]>0; const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; - mcIdType const nbOfSubEdges1=ToIdType(subEdge1PossiblyAlreadyIn1.size()/2); + mcIdType nbOfSubEdges1=ToIdType(subEdge1PossiblyAlreadyIn1.size()/2); mcIdType offset2=0; bool found=false; for(mcIdType kk=0;kk& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI) const { int nbOfNodesInPg=0; - bool const presenceOfQuadratic=presenceOfQuadraticEdge(); + bool presenceOfQuadratic=presenceOfQuadraticEdge(); conn.push_back(presenceOfQuadratic?NORM_QPOLYG:NORM_POLYGON); - for(auto _sub_edge : _sub_edges) + for(std::list::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++) { - Node *tmp=nullptr; - tmp=_sub_edge->getStartNode(); - auto const it1=mapp.find(tmp); + Node *tmp=0; + tmp=(*it)->getStartNode(); + std::map::const_iterator it1=mapp.find(tmp); conn.push_back((*it1).second); nbOfNodesInPg++; } if(presenceOfQuadratic) { int j=0; - mcIdType const off=offset+ToIdType(addCoordsQuadratic.size())/2; - for(auto it=_sub_edges.begin();it!=_sub_edges.end();it++,j++,nbOfNodesInPg++) + mcIdType off=offset+ToIdType(addCoordsQuadratic.size())/2; + for(std::list::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++,j++,nbOfNodesInPg++) { INTERP_KERNEL::Node *node=(*it)->getPtr()->buildRepresentantOfMySelf(); node->unApplySimilarity(xBary,yBary,fact); @@ -695,14 +681,14 @@ void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, std::set& nbThis, std::vector& nbOther) { double xBaryBB, yBaryBB; - double const fact=normalizeExt(&other, xBaryBB, yBaryBB); + double fact=normalizeExt(&other, xBaryBB, yBaryBB); //Locate \a this relative to \a other (edges of \a this, aka \a pol1 are marked as IN or OUT) other.performLocatingOperationSlow(*this); // without any assumption - std::vector const res=buildIntersectionPolygons(*this,other); - for(auto & re : res) + std::vector res=buildIntersectionPolygons(*this,other); + for(std::vector::iterator it=res.begin();it!=res.end();it++) { - re->appendCrudeData(mapp,xBaryBB,yBaryBB,fact,offset,addCoordsQuadratic,conn,connI); - INTERP_KERNEL::IteratorOnComposedEdge it1(re); + (*it)->appendCrudeData(mapp,xBaryBB,yBaryBB,fact,offset,addCoordsQuadratic,conn,connI); + INTERP_KERNEL::IteratorOnComposedEdge it1(*it); for(it1.first();!it1.finished();it1.next()) { Edge *e=it1.current()->getPtr(); @@ -718,7 +704,7 @@ void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, std::set 2) for(it.first();!it.finished();it.next()) { @@ -752,7 +738,7 @@ void QuadraticPolygon::cleanDegeneratedConsecutiveEdges() double QuadraticPolygon::intersectWithAbs1D(QuadraticPolygon& other, bool& isColinear) { double ret = 0., xBaryBB, yBaryBB; - double const fact = normalize(&other, xBaryBB, yBaryBB); + double fact = normalize(&other, xBaryBB, yBaryBB); QuadraticPolygon cpyOfThis(*this); QuadraticPolygon cpyOfOther(other); @@ -791,13 +777,13 @@ double QuadraticPolygon::intersectWithAbs(QuadraticPolygon& other, double* baryc { double ret=0.,bary[2],area,xBaryBB,yBaryBB; barycenter[0] = barycenter[1] = 0.; - double const fact=normalize(&other,xBaryBB,yBaryBB); - std::vector const polygs=intersectMySelfWith(other); - for(auto & polyg : polygs) + double fact=normalize(&other,xBaryBB,yBaryBB); + std::vector polygs=intersectMySelfWith(other); + for(std::vector::iterator iter=polygs.begin();iter!=polygs.end();iter++) { - area=fabs(polyg->getArea()); - polyg->getBarycenter(bary); - delete polyg; + area=fabs((*iter)->getArea()); + (*iter)->getBarycenter(bary); + delete *iter; ret+=area; barycenter[0] += bary[0]*area; barycenter[1] += bary[1]*area; @@ -819,11 +805,11 @@ double QuadraticPolygon::intersectWithAbs(QuadraticPolygon& other, double* baryc double QuadraticPolygon::intersectWith(const QuadraticPolygon& other) const { double ret=0.; - std::vector const polygs=intersectMySelfWith(other); - for(auto & polyg : polygs) + std::vector polygs=intersectMySelfWith(other); + for(std::vector::iterator iter=polygs.begin();iter!=polygs.end();iter++) { - ret+=fabs(polyg->getArea()); - delete polyg; + ret+=fabs((*iter)->getArea()); + delete *iter; } return ret; } @@ -837,12 +823,12 @@ double QuadraticPolygon::intersectWith(const QuadraticPolygon& other, double* ba { double ret=0., bary[2]; barycenter[0] = barycenter[1] = 0.; - std::vector const polygs=intersectMySelfWith(other); - for(auto & polyg : polygs) + std::vector polygs=intersectMySelfWith(other); + for(std::vector::iterator iter=polygs.begin();iter!=polygs.end();iter++) { - double const area = fabs(polyg->getArea()); - polyg->getBarycenter(bary); - delete polyg; + double area = fabs((*iter)->getArea()); + (*iter)->getBarycenter(bary); + delete *iter; ret+=area; barycenter[0] += bary[0]*area; barycenter[1] += bary[1]*area; @@ -965,8 +951,8 @@ void QuadraticPolygon::SplitPolygonsEachOther(QuadraticPolygon& pol1, QuadraticP { IteratorOnComposedEdge it1(&pol1),it2(&pol2); MergePoints merge; - auto *c1=new ComposedEdge; - auto *c2=new ComposedEdge; + ComposedEdge *c1=new ComposedEdge; + ComposedEdge *c2=new ComposedEdge; for(it2.first();!it2.finished();it2.next()) { ElementaryEdge* curE2=it2.current(); @@ -1065,7 +1051,7 @@ std::list QuadraticPolygon::zipConsecutiveInSegments() const { std::list ret; IteratorOnComposedEdge it(const_cast(this)); - int const nbOfTurns=recursiveSize(); + int nbOfTurns=recursiveSize(); int i=0; if(!it.goToNextInOn(false,i,nbOfTurns)) return ret; @@ -1073,7 +1059,7 @@ std::list QuadraticPolygon::zipConsecutiveInSegments() const // while(igetLoc(); while(loc!=FULL_OUT_1 && i& pol1Zip, con bool directionKnownInPol2=false; bool directionInPol2=false; bool needCleaning = false; - for(auto iter=pol1Zip.begin();iter!=pol1Zip.end();) + for(std::list::iterator iter=pol1Zip.begin();iter!=pol1Zip.end();) { // Build incrementally the full closed cells from the consecutive line parts already built in pol1Zip. // At the end of the process the item currently iterated has been totally completed (start_node=end_node) @@ -1127,9 +1113,9 @@ void QuadraticPolygon::ClosePolygons(std::list& pol1Zip, con else directionKnownInPol2=true; } - auto iter2=iter; iter2++; + std::list::iterator iter2=iter; iter2++; // Fill as much as possible the current iterate (=a part of pol1) with consecutive pieces from pol2: - auto const iter3=(*iter)->fillAsMuchAsPossibleWith(pol2,iter2,pol1Zip.end(),directionInPol2); + std::list::iterator iter3=(*iter)->fillAsMuchAsPossibleWith(pol2,iter2,pol1Zip.end(),directionInPol2); // and now add a full connected piece from pol1Zip: if(iter3!=pol1Zip.end()) { @@ -1175,7 +1161,7 @@ bool QuadraticPolygon::haveIAChanceToBeCompletedBy(const QuadraticPolygon& pol1N it2.nextLoop(); cur=it2.current(); Node *repr=cur->getPtr()->buildRepresentantOfMySelf(); - bool const ret=pol1NotSplitted.isInOrOut(repr); + bool ret=pol1NotSplitted.isInOrOut(repr); repr->decrRef(); direction = ret; needCleaning = ret; // if true we are in tricky case 2 above, we know that we will produce two consecutive overlapping edges in result @@ -1184,7 +1170,7 @@ bool QuadraticPolygon::haveIAChanceToBeCompletedBy(const QuadraticPolygon& pol1N else // here we don't need to go prev or next: { Node *repr=cur->getPtr()->buildRepresentantOfMySelf(); - bool const ret=pol1NotSplitted.isInOrOut(repr); + bool ret=pol1NotSplitted.isInOrOut(repr); repr->decrRef(); direction = ret; return ret; @@ -1242,7 +1228,7 @@ std::list::iterator QuadraticPolygon::fillAsMuchAsPossibleWi std::list::iterator QuadraticPolygon::CheckInList(Node *n, std::list::iterator iStart, std::list::iterator iEnd) { - for(auto iter=iStart;iter!=iEnd;iter++) + for(std::list::iterator iter=iStart;iter!=iEnd;iter++) if((*iter)->isNodeIn(n)) return iter; return iEnd; @@ -1264,14 +1250,14 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: { // Initialise locations on pol1. Remember that edges found in 'notUsedInPol1' are also part of the edges forming pol1. pol1.initLocations(); - for(auto it1 : notUsedInPol1) - { it1->initLocs(); it1->declareOn(); } - for(auto it2 : edgesInPol2OnBoundary) - { it2->initLocs(); it2->declareIn(); } + for(std::set::const_iterator it1=notUsedInPol1.begin();it1!=notUsedInPol1.end();it1++) + { (*it1)->initLocs(); (*it1)->declareOn(); } + for(std::set::const_iterator it2=edgesInPol2OnBoundary.begin();it2!=edgesInPol2OnBoundary.end();it2++) + { (*it2)->initLocs(); (*it2)->declareIn(); } //// std::set notUsedInPol1L(notUsedInPol1); IteratorOnComposedEdge itPol1(const_cast(&pol1)); - int const sz=pol1.size(); + int sz=pol1.size(); std::list pol1Zip; // If none of the edges of pol1 was consumed by the rebuilding process, we can directly take pol1 as it is to form a cell: if(pol1.size()==(int)notUsedInPol1.size() && edgesInPol2OnBoundary.empty()) @@ -1287,7 +1273,7 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: itPol1.nextLoop(); if(itPol1.current()->getStartNode()->getLoc()!=IN_1 || itPol1.current()->getLoc()!=FULL_ON_1) throw INTERP_KERNEL::Exception("Presence of a target polygon fully included in source polygon ! The partition of this leads to a non simply connex cell (with hole) ! Impossible ! Such resulting cell cannot be stored in MED cell format !"); - auto *tmp1=new QuadraticPolygon; + QuadraticPolygon *tmp1=new QuadraticPolygon; do { Edge *ee=itPol1.current()->getPtr(); @@ -1316,7 +1302,7 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: while(nbOfTurn see if(!pol1Zip.empty()) below ... - for(auto itConstr=retPolsUnderContruction.begin();itConstr!=retPolsUnderContruction.end();) + for(std::list::iterator itConstr=retPolsUnderContruction.begin();itConstr!=retPolsUnderContruction.end();) { Node *startN = (*itConstr)->getStartNode(); Node *curN = (*itConstr)->getEndNode(); @@ -1325,7 +1311,7 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: bool smthHappened=false, doneEarly=false; // Complete a partially reconstructed polygon with boundary edges of pol2 by matching nodes: - for(auto it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();) + for(std::list::iterator it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();) { if(curN==(*it2)->getEndNode()) // only end node should be considered if orientation is correct for input meshes // in the funny case of cells exactly included (see test case testIntersect2DMeshesTmp13) this is mandatory to take edges from pol2 in the right order. @@ -1346,7 +1332,7 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: // Be somewhat flexible and keep on supporting this case here (useful for voronisation notably): if(!smthHappened) { - for(auto it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();) + for(std::list::iterator it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();) { if(curN==(*it2)->getStartNode()) { @@ -1368,12 +1354,12 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: if(smthHappened) // Now continue the construction by finding the next bit in pol1Zip. Not too sure what are the cases where the boolean if False ... { - for(auto itZip=pol1Zip.begin();itZip!=pol1Zip.end();) + for(std::list::iterator itZip=pol1Zip.begin();itZip!=pol1Zip.end();) { if(curN==(*itZip)->getStartNode()) // we found a matching piece to append in pol1Zip. Append all of it to the current polygon being reconstr { for(std::list::const_iterator it4=(*itZip)->_sub_edges.begin();it4!=(*itZip)->_sub_edges.end();it4++) - { (*it4)->getPtr()->incrRef(); bool const dir=(*it4)->getDirection(); (*itConstr)->pushBack(new ElementaryEdge((*it4)->getPtr(),dir)); } + { (*it4)->getPtr()->incrRef(); bool dir=(*it4)->getDirection(); (*itConstr)->pushBack(new ElementaryEdge((*it4)->getPtr(),dir)); } pol1ZipConsumed[*itConstr].push_back(*itZip); curN=(*itZip)->getEndNode(); itZip=pol1Zip.erase(itZip); // one zipped piece has been consumed @@ -1391,8 +1377,8 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: if(edgesInPol2OnBoundary.find(ee)!=edgesInPol2OnBoundary.end()) edgesInPol2OnBoundaryL.push_back(ee); } - for(auto & it6 : pol1ZipConsumed[*itConstr]) - pol1Zip.push_front(it6); + for(std::list::iterator it6=pol1ZipConsumed[*itConstr].begin();it6!=pol1ZipConsumed[*itConstr].end();it6++) + pol1Zip.push_front(*it6); pol1ZipConsumed.erase(*itConstr); delete *itConstr; itConstr=retPolsUnderContruction.erase(itConstr); @@ -1400,10 +1386,10 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: } if(!pol1Zip.empty()) // the filling process of retPolsUnderConstruction starts here { - auto *tmp=new QuadraticPolygon; + QuadraticPolygon *tmp=new QuadraticPolygon; QuadraticPolygon *first=*(pol1Zip.begin()); for(std::list::const_iterator it4=first->_sub_edges.begin();it4!=first->_sub_edges.end();it4++) - { (*it4)->getPtr()->incrRef(); bool const dir=(*it4)->getDirection(); tmp->pushBack(new ElementaryEdge((*it4)->getPtr(),dir)); } + { (*it4)->getPtr()->incrRef(); bool dir=(*it4)->getDirection(); tmp->pushBack(new ElementaryEdge((*it4)->getPtr(),dir)); } pol1ZipConsumed[tmp].push_back(first); retPolsUnderContruction.push_back(tmp); pol1Zip.erase(pol1Zip.begin()); @@ -1419,15 +1405,15 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: throw INTERP_KERNEL::Exception(oss.str().c_str()); } // Convert to integer connectivity: - for(auto & itConstr : retPolsUnderContruction) + for(std::list::iterator itConstr=retPolsUnderContruction.begin();itConstr!=retPolsUnderContruction.end();itConstr++) { - if(itConstr->getStartNode()==itConstr->getEndNode()) // take only fully closed reconstructed polygon + if((*itConstr)->getStartNode()==(*itConstr)->getEndNode()) // take only fully closed reconstructed polygon { - itConstr->cleanDegeneratedConsecutiveEdges(); - itConstr->appendCrudeData(mapp,0.,0.,1.,offset,addCoordsQuadratic,conn,connI); nb1.push_back(idThis); nb2.push_back(-1); - for(auto & it6 : pol1ZipConsumed[itConstr]) - delete it6; - delete itConstr; + (*itConstr)->cleanDegeneratedConsecutiveEdges(); + (*itConstr)->appendCrudeData(mapp,0.,0.,1.,offset,addCoordsQuadratic,conn,connI); nb1.push_back(idThis); nb2.push_back(-1); + for(std::list::iterator it6=pol1ZipConsumed[*itConstr].begin();it6!=pol1ZipConsumed[*itConstr].end();it6++) + delete *it6; + delete *itConstr; } else { diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx index 0f4b4aa4d..4fff24c8e 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx @@ -26,14 +26,8 @@ #include "InterpKernelGeo2DComposedEdge.hxx" #include "InterpKernelGeo2DAbstractEdge.hxx" #include "InterpKernelGeo2DElementaryEdge.hxx" -#include "MCIdType.hxx" -#include #include -#include -#include -#include -#include #include namespace INTERP_KERNEL @@ -42,7 +36,7 @@ namespace INTERP_KERNEL class MergePoints; enum NodeUsage { USAGE_UNKNOWN, USAGE_LINEAR, USAGE_QUADRATIC_ONLY }; - using NodeWithUsage = std::pair; + typedef std::pair NodeWithUsage; /** * A set of quadratic or linear edges, not necessarily connected to form a closed polygon. @@ -52,8 +46,8 @@ namespace INTERP_KERNEL class QuadraticPolygon : public ComposedEdge { public: - INTERPKERNEL_EXPORT QuadraticPolygon() = default; - INTERPKERNEL_EXPORT QuadraticPolygon(const QuadraticPolygon& other) = default; + INTERPKERNEL_EXPORT QuadraticPolygon() { } + INTERPKERNEL_EXPORT QuadraticPolygon(const QuadraticPolygon& other):ComposedEdge(other) { } INTERPKERNEL_EXPORT QuadraticPolygon(const char *fileName); INTERPKERNEL_EXPORT static QuadraticPolygon *BuildLinearPolygon(std::vector& nodes); INTERPKERNEL_EXPORT static QuadraticPolygon *BuildArcCirclePolygon(std::vector& nodes); @@ -124,7 +118,7 @@ namespace INTERP_KERNEL namespace INTERP_KERNEL { template - void QuadraticPolygon::UpdateNeighbours(const MergePoints& /*merger*/, IteratorOnComposedEdge it1, IteratorOnComposedEdge it2, + void QuadraticPolygon::UpdateNeighbours(const MergePoints& merger, IteratorOnComposedEdge it1, IteratorOnComposedEdge it2, const EDGES *e1, const EDGES *e2) { it1.previousLoop(); it2.previousLoop(); diff --git a/src/INTERP_KERNEL/Geometric2DIntersector.hxx b/src/INTERP_KERNEL/Geometric2DIntersector.hxx index 53c9d088a..fe5ff129c 100644 --- a/src/INTERP_KERNEL/Geometric2DIntersector.hxx +++ b/src/INTERP_KERNEL/Geometric2DIntersector.hxx @@ -21,10 +21,12 @@ #ifndef __GEOMETRIC2DINTERSECTOR_HXX__ #define __GEOMETRIC2DINTERSECTOR_HXX__ -#include "NormalizedUnstructuredMesh.hxx" -#include "NormalizedGeometricTypes" -#include "InterpKernelGeo2DPrecision.hxx" -#include +#include "PlanarIntersectorP0P0.hxx" +#include "PlanarIntersectorP0P1.hxx" +#include "PlanarIntersectorP1P0.hxx" +#include "PlanarIntersectorP1P1.hxx" +#include "PlanarIntersectorP1P0Bary.hxx" +#include "PlanarIntersectorP0P1Bary.hxx" namespace INTERP_KERNEL { @@ -36,7 +38,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: Geometric2DIntersector(const MyMeshType& meshT, const MyMeshType& meshS, diff --git a/src/INTERP_KERNEL/Geometric2DIntersector.txx b/src/INTERP_KERNEL/Geometric2DIntersector.txx index 53caa6734..a66b2ab22 100644 --- a/src/INTERP_KERNEL/Geometric2DIntersector.txx +++ b/src/INTERP_KERNEL/Geometric2DIntersector.txx @@ -21,7 +21,6 @@ #define __GEOMETRIC2DINTERSECTOR_TXX__ #include "Geometric2DIntersector.hxx" -#include "PlanarIntersector.txx" #include "PlanarIntersectorP0P0.txx" #include "Planar2D1DIntersectorP0P0.txx" #include "PlanarIntersectorP0P1.txx" @@ -29,20 +28,13 @@ #include "PlanarIntersectorP1P1.txx" #include "PlanarIntersectorP1P0Bary.txx" #include "PlanarIntersectorP0P1Bary.txx" -#include "InterpolationUtils.hxx" #include "CellModel.hxx" -#include "NormalizedGeometricTypes" #include "InterpKernelGeo2DQuadraticPolygon.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DEdgeLin.hxx" #include "InterpKernelGeo2DNode.hxx" -#include -#include -#include - - #define GEO2D_INTERSECTOR Geometric2DIntersector #define INTERSECTOR_TEMPLATE template class InterpType> diff --git a/src/INTERP_KERNEL/IntegralUniformIntersector.hxx b/src/INTERP_KERNEL/IntegralUniformIntersector.hxx index cb191fc71..a5e5fe39a 100644 --- a/src/INTERP_KERNEL/IntegralUniformIntersector.hxx +++ b/src/INTERP_KERNEL/IntegralUniformIntersector.hxx @@ -21,10 +21,9 @@ #ifndef __INTEGRALUNIFORMINTERSECTOR_HXX__ #define __INTEGRALUNIFORMINTERSECTOR_HXX__ -#include "TargetIntersector.hxx" +#include "TargetIntersector.txx" #include -#include namespace INTERP_KERNEL { @@ -32,7 +31,7 @@ namespace INTERP_KERNEL class IntegralUniformIntersector : public TargetIntersector { public: - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; public: IntegralUniformIntersector(const MyMeshType& mesh, bool isAbs); double performNormalization(double val) const { if(_is_abs) return fabs(val); else return val; } @@ -49,7 +48,7 @@ namespace INTERP_KERNEL class IntegralUniformIntersectorP0 : public IntegralUniformIntersector { public: - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; public: IntegralUniformIntersectorP0(const MyMeshType& mesh, bool isAbs); ConnType getNumberOfRowsOfResMatrix() const; @@ -61,7 +60,7 @@ namespace INTERP_KERNEL class IntegralUniformIntersectorP1 : public IntegralUniformIntersector { public: - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; public: IntegralUniformIntersectorP1(const MyMeshType& mesh, bool isAbs); ConnType getNumberOfRowsOfResMatrix() const; diff --git a/src/INTERP_KERNEL/IntegralUniformIntersector.txx b/src/INTERP_KERNEL/IntegralUniformIntersector.txx old mode 100644 new mode 100755 index 3016fe3ce..e603fcbc3 --- a/src/INTERP_KERNEL/IntegralUniformIntersector.txx +++ b/src/INTERP_KERNEL/IntegralUniformIntersector.txx @@ -21,11 +21,7 @@ #define __INTEGRALUNIFORMINTERSECTOR_TXX__ #include "IntegralUniformIntersector.hxx" -#include "NormalizedGeometricTypes" -#include "NormalizedUnstructuredMesh.hxx" -#include "InterpolationUtils.hxx" #include "VolSurfUser.txx" -#include namespace INTERP_KERNEL { @@ -91,7 +87,7 @@ namespace INTERP_KERNEL } template - void IntegralUniformIntersectorP0::intersectCells(ConnType /*targetCell*/, const std::vector& /*srcCells*/, MyMatrix& res) + void IntegralUniformIntersectorP0::intersectCells(ConnType targetCell, const std::vector& srcCells, MyMatrix& res) { static const NumberingPolicy numPol=MyMeshType::My_numPol; res.resize(getNumberOfRowsOfResMatrix()); @@ -131,7 +127,7 @@ namespace INTERP_KERNEL } template - void IntegralUniformIntersectorP1::intersectCells(ConnType /*targetCell*/, const std::vector& /*srcCells*/, MyMatrix& res) + void IntegralUniformIntersectorP1::intersectCells(ConnType targetCell, const std::vector& srcCells, MyMatrix& res) { static const NumberingPolicy numPol=MyMeshType::My_numPol; res.resize(getNumberOfRowsOfResMatrix()); diff --git a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx index be8853fcd..f28635998 100644 --- a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx +++ b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx @@ -20,16 +20,16 @@ #include "InterpKernelCellSimplify.hxx" #include "CellModel.hxx" -#include "NormalizedGeometricTypes" -#include "MCIdType.hxx" -#include "InterpKernelException.hxx" #include #include #include +#include +#include #include -#include +#include #include +#include #include using namespace INTERP_KERNEL; @@ -44,11 +44,11 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); std::set c(conn,conn+lgth); c.erase(-1); - bool const isObviousNonDegeneratedCell=(ToIdType(c.size())==lgth); + bool isObviousNonDegeneratedCell=(ToIdType(c.size())==lgth); if((cm.getDimension()==3 && cm.isQuadratic()) || isObviousNonDegeneratedCell) {//quadratic 3D, do nothing for the moment. retLgth=lgth; - auto *tmp=new mcIdType[lgth];//no direct std::copy ! overlapping of conn and retConn ! + mcIdType *tmp=new mcIdType[lgth];//no direct std::copy ! overlapping of conn and retConn ! std::copy(conn,conn+lgth,tmp); std::copy(tmp,tmp+lgth,retConn); delete [] tmp; @@ -56,7 +56,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K } if(cm.getDimension()==2) { - auto *tmp=new mcIdType[lgth]; + mcIdType *tmp=new mcIdType[lgth]; int newPos=0; if(!cm.isQuadratic()) { @@ -66,8 +66,8 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K } else { - mcIdType const quadOff = lgth/2; - auto *tmpQuad = new mcIdType[quadOff]; + mcIdType quadOff = lgth/2; + mcIdType *tmpQuad = new mcIdType[quadOff]; for(int i = 0; i < quadOff; i++) if(conn[i] != conn[(i+1)%quadOff] || conn[i] != conn[i+quadOff]) // zip nul segments/arcs (quad point must match too) { @@ -79,7 +79,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K delete [] tmpQuad; newPos *= 2; // take in quad points in the final length } - INTERP_KERNEL::NormalizedCellType const ret=tryToUnPoly2D(cm.isQuadratic(),tmp,newPos,retConn,retLgth); + INTERP_KERNEL::NormalizedCellType ret=tryToUnPoly2D(cm.isQuadratic(),tmp,newPos,retConn,retLgth); delete [] tmp; return ret; } @@ -87,7 +87,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K { mcIdType nbOfFaces,lgthOfPolyhConn; mcIdType *zipFullReprOfPolyh=getFullPolyh3DCell(type,conn,lgth,nbOfFaces,lgthOfPolyhConn); - INTERP_KERNEL::NormalizedCellType const ret=tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,retConn,retLgth); + INTERP_KERNEL::NormalizedCellType ret=tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,retConn,retLgth); delete [] zipFullReprOfPolyh; return ret; } @@ -139,16 +139,16 @@ mcIdType *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType typ mcIdType& retNbOfFaces, mcIdType& retLgth) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); - unsigned const nbOfFaces=cm.getNumberOfSons2(conn,lgth); - auto *tmp=new mcIdType[nbOfFaces*(lgth+1)]; + unsigned nbOfFaces=cm.getNumberOfSons2(conn,lgth); + mcIdType *tmp=new mcIdType[nbOfFaces*(lgth+1)]; mcIdType *work=tmp; std::vector faces; for(unsigned j=0;j nodes(conn,conn+lgth); nodes.erase(-1); - std::size_t const nbOfNodes=nodes.size(); - std::size_t const magicNumber=100*nbOfNodes+nbOfFaces; + std::size_t nbOfNodes=nodes.size(); + std::size_t magicNumber=100*nbOfNodes+nbOfFaces; switch(magicNumber) { case 806: @@ -205,8 +205,8 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly3D(const mcIdType *co bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace) { std::vector tmp2; - std::set const bases(baseFace,baseFace+lgthBaseFace); - std::set const sides(sideFace,sideFace+4); + std::set bases(baseFace,baseFace+lgthBaseFace); + std::set sides(sideFace,sideFace+4); std::set_intersection(bases.begin(),bases.end(),sides.begin(),sides.end(),std::back_insert_iterator< std::vector >(tmp2)); if(tmp2.size()!=2) return false; @@ -221,21 +221,21 @@ bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retCon for(int i=0;i<4;i++) sideEdges[i]=std::pair(sideFace[i],sideFace[(i+1)%4]); std::vector< std::pair > tmp; - std::set< std::pair > const baseEdgesS(baseEdges.begin(),baseEdges.end()); - std::set< std::pair > const sideEdgesS(sideEdges.begin(),sideEdges.end()); + std::set< std::pair > baseEdgesS(baseEdges.begin(),baseEdges.end()); + std::set< std::pair > sideEdgesS(sideEdges.begin(),sideEdges.end()); std::set_intersection(baseEdgesS.begin(),baseEdgesS.end(),sideEdgesS.begin(),sideEdgesS.end(),std::back_insert_iterator< std::vector< std::pair > >(tmp)); if(tmp.empty()) { //reverse sideFace for(int i=0;i<4;i++) { - std::pair const p=sideEdges[i]; - std::pair const r(p.second,p.first); + std::pair p=sideEdges[i]; + std::pair r(p.second,p.first); sideEdges[i]=r; } //end reverse sideFace - std::set< std::pair > const baseEdgesS2(baseEdges.begin(),baseEdges.end()); - std::set< std::pair > const sideEdgesS2(sideEdges.begin(),sideEdges.end()); + std::set< std::pair > baseEdgesS2(baseEdges.begin(),baseEdges.end()); + std::set< std::pair > sideEdgesS2(sideEdges.begin(),sideEdges.end()); std::set_intersection(baseEdgesS2.begin(),baseEdgesS2.end(),sideEdgesS2.begin(),sideEdgesS2.end(),std::back_insert_iterator< std::vector< std::pair > >(tmp)); if(tmp.empty()) return false; @@ -256,16 +256,16 @@ bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retCon } if(!found) return false; - int const pos=(int)std::distance(baseEdges.begin(),std::find(baseEdges.begin(),baseEdges.end(),tmp[0])); - auto const it=std::find(oppEdges.begin(),oppEdges.end(),pInOpp); + int pos=(int)std::distance(baseEdges.begin(),std::find(baseEdges.begin(),baseEdges.end(),tmp[0])); + std::vector< std::pair >::iterator it=std::find(oppEdges.begin(),oppEdges.end(),pInOpp); if(it==oppEdges.end())//the opposite edge of side face is not found opposite face ... maybe problem of orientation of polyhedron return false; - mcIdType const pos2=ToIdType(std::distance(oppEdges.begin(),it)); + mcIdType pos2=ToIdType(std::distance(oppEdges.begin(),it)); mcIdType offset=pos-pos2; if(offset<0) offset+=lgthBaseFace; //this is the end copy the result - auto *tmp3=new mcIdType[lgthBaseFace]; + mcIdType *tmp3=new mcIdType[lgthBaseFace]; for(int i=0;i(),std::placeholders::_1,ToIdType(INTERP_KERNEL::NORM_QUAD4)))==conn+lgth+nbOfFaces) {//6 faces are QUAD4. int oppositeFace=-1; - std::set const conn1(conn,conn+4); + std::set conn1(conn,conn+4); for(int i=1;i<6 && oppositeFace<0;i++) { std::vector tmp; - std::set const conn2(conn+5*i,conn+5*i+4); + std::set conn2(conn+5*i,conn+5*i+4); std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector >(tmp)); if(tmp.empty()) oppositeFace=i; @@ -345,25 +345,25 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHex8(const mcIdType * INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - std::size_t const nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON)); - std::size_t const nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)); + std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON)); + std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)); if(nbOfQuad==6 && nbOfHexagon==2) { const mcIdType *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON)); - std::size_t const hexg0Id=std::distance(conn+lgth,hexag0); + std::size_t hexg0Id=std::distance(conn+lgth,hexag0); const mcIdType *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON)); - std::size_t const hexg1Id=std::distance(conn+lgth,hexag1); + std::size_t hexg1Id=std::distance(conn+lgth,hexag1); const mcIdType *connHexag0=conn+5*hexg0Id; - std::size_t const lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1)); + std::size_t lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1)); if(lgthH0==6) { const mcIdType *connHexag1=conn+5*hexg0Id+7+(hexg1Id-hexg0Id-1)*5; - std::size_t const lgthH1=std::distance(connHexag1,std::find(connHexag1,conn+lgth,-1)); + std::size_t lgthH1=std::distance(connHexag1,std::find(connHexag1,conn+lgth,-1)); if(lgthH1==6) { std::vector tmp; - std::set const conn1(connHexag0,connHexag0+6); - std::set const conn2(connHexag1,connHexag1+6); + std::set conn1(connHexag0,connHexag0+6); + std::set conn2(connHexag1,connHexag1+6); std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector >(tmp)); if(tmp.empty()) { @@ -390,13 +390,13 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType */ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - std::size_t const nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)); - std::size_t const nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)); + std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)); + std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)); if(nbOfTriFace==2 && nbOfQuadFace==3) { - std::size_t const tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3))); - std::size_t const tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3))); - const mcIdType *tri_0=nullptr,*tri_1=nullptr; + std::size_t tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3))); + std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3))); + const mcIdType *tri_0=0,*tri_1=0; const mcIdType *w=conn; for(std::size_t i=0;i<5;i++) { @@ -408,8 +408,8 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType w++; } std::vector tmp; - std::set const conn1(tri_0,tri_0+3); - std::set const conn2(tri_1,tri_1+3); + std::set conn1(tri_0,tri_0+3); + std::set conn2(tri_1,tri_1+3); std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector >(tmp)); if(tmp.empty()) { @@ -434,21 +434,21 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType */ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - std::size_t const nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)); - std::size_t const nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)); + std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)); + std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)); if(nbOfTriFace==4 && nbOfQuadFace==1) { - std::size_t const quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4))); - const mcIdType *quad4=nullptr; + std::size_t quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4))); + const mcIdType *quad4=0; const mcIdType *w=conn; - for(std::size_t i=0;i<5 && quad4==nullptr;i++) + for(std::size_t i=0;i<5 && quad4==0;i++) { if(i==quad4_pos) quad4=w; w=std::find(w,conn+lgth,-1); w++; } - std::set const quad4S(quad4,quad4+4); + std::set quad4S(quad4,quad4+4); w=conn; bool ok=true; mcIdType point=-1; @@ -457,7 +457,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType if(i!=quad4_pos) { std::vector tmp; - std::set const conn2(w,w+3); + std::set conn2(w,w+3); std::set_intersection(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector >(tmp)); ok=tmp.size()==2; tmp.clear(); @@ -495,13 +495,13 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const mcIdType { if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind(std::not_equal_to(),std::placeholders::_1,ToIdType(INTERP_KERNEL::NORM_TRI3)))==conn+lgth+nbOfFaces) { - std::set const tribase(conn,conn+3); + std::set tribase(conn,conn+3); mcIdType point=-1; bool ok=true; for(int i=1;i<4 && ok;i++) { std::vector tmp; - std::set const conn2(conn+i*4,conn+4*i+3); + std::set conn2(conn+i*4,conn+4*i+3); std::set_intersection(conn2.begin(),conn2.end(),tribase.begin(),tribase.end(),std::back_insert_iterator< std::vector >(tmp)); ok=tmp.size()==2; tmp.clear(); diff --git a/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx b/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx index c1688b826..fde75b7f1 100644 --- a/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx +++ b/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx @@ -22,8 +22,9 @@ #define __INTERPKERNELCELLSIMPLIFY_HXX__ #include "INTERPKERNELDefines.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelException.hxx" #include "MCIdType.hxx" -#include "NormalizedGeometricTypes" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/InterpKernelDenseMatrix.txx b/src/INTERP_KERNEL/InterpKernelDenseMatrix.txx index e3595b33b..e4e2bd7de 100644 --- a/src/INTERP_KERNEL/InterpKernelDenseMatrix.txx +++ b/src/INTERP_KERNEL/InterpKernelDenseMatrix.txx @@ -21,7 +21,6 @@ #include "InterpKernelDenseMatrix.hxx" #include "InterpKernelException.hxx" -#include "MCIdType.hxx" #include "VectorUtils.hxx" #include diff --git a/src/INTERP_KERNEL/InterpKernelMatrix.hxx b/src/INTERP_KERNEL/InterpKernelMatrix.hxx index 693fecf4d..197027b33 100644 --- a/src/INTERP_KERNEL/InterpKernelMatrix.hxx +++ b/src/INTERP_KERNEL/InterpKernelMatrix.hxx @@ -18,12 +18,10 @@ // #ifndef __INTERPKERNELMATRIX_HXX_ -#define __INTERPKERNELMATRIX_HXX_ +#define __INTERPKERNELMATRIX_HXX__ #include "InterpolationUtils.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include #include #include #include @@ -77,7 +75,7 @@ namespace INTERP_KERNEL void erase(int elem) { std::vector< std::pair >::erase(std::find_if(std::vector< std::pair >::begin(),std::vector< std::pair >::end(),KeyComparator(elem))); } - void insert(const std::pair& myPair) { std::vector >::push_back(myPair); } + void insert(const std::pair& myPair) { vector >::push_back(myPair); } }; private: @@ -90,14 +88,14 @@ namespace INTERP_KERNEL friend std::istream& operator>><>(std::istream& in, Matrix& m); bool _is_configured; public: - using value_type = Row; + typedef Row value_type; public: - Matrix():_coeffs(0), _cols(nullptr), _nb_rows(0), _is_configured(false) + Matrix():_coeffs(0), _cols(0), _nb_rows(0), _is_configured(false) { } - Matrix(int nbrows):_coeffs(0), _cols(nullptr), _is_configured(false) + Matrix(int nbrows):_coeffs(0), _cols(0), _is_configured(false) { _nb_rows=nbrows; } Matrix(std::vector > & matrix) : - _coeffs(0), _cols(nullptr), _is_configured(false) + _coeffs(0), _cols(0), _is_configured(false) { _nb_rows=matrix.size(); _auxiliary_matrix.resize(_nb_rows); diff --git a/src/INTERP_KERNEL/InterpKernelMatrixTools.cxx b/src/INTERP_KERNEL/InterpKernelMatrixTools.cxx index ce866b692..56f29c75d 100644 --- a/src/INTERP_KERNEL/InterpKernelMatrixTools.cxx +++ b/src/INTERP_KERNEL/InterpKernelMatrixTools.cxx @@ -21,7 +21,6 @@ #include "InterpKernelMatrixTools.hxx" #include "InterpKernelException.hxx" #include "InterpKernelAutoPtr.hxx" -#include "MCIdType.hxx" #include #include @@ -391,7 +390,7 @@ namespace INTERP_KERNEL t=work[j]; daxpy(n,t,a+0+j*lda,1,a+0+k*lda,1); } - mcIdType const l=ipvt[k]; + mcIdType l=ipvt[k]; if(l!=k-1) dswap(n,a+0+k*lda,1,a+0+l*lda,1); } diff --git a/src/INTERP_KERNEL/InterpKernelMeshQuality.cxx b/src/INTERP_KERNEL/InterpKernelMeshQuality.cxx index b3b5100f7..5f1d2980f 100644 --- a/src/INTERP_KERNEL/InterpKernelMeshQuality.cxx +++ b/src/INTERP_KERNEL/InterpKernelMeshQuality.cxx @@ -22,6 +22,7 @@ #include #include +#include #include double INTERP_KERNEL::quadSkew(const double *coo) @@ -36,8 +37,8 @@ double INTERP_KERNEL::quadSkew(const double *coo) coo[7]+coo[10]-coo[1]-coo[4], coo[8]+coo[11]-coo[2]-coo[5], }; - double const l0=sqrt(pa0[0]*pa0[0]+pa0[1]*pa0[1]+pa0[2]*pa0[2]); - double const l1=sqrt(pa1[0]*pa1[0]+pa1[1]*pa1[1]+pa1[2]*pa1[2]); + double l0=sqrt(pa0[0]*pa0[0]+pa0[1]*pa0[1]+pa0[2]*pa0[2]); + double l1=sqrt(pa1[0]*pa1[0]+pa1[1]*pa1[1]+pa1[2]*pa1[2]); if(l0<1.e-15) return 0.; if(l1<1.e-15) @@ -49,16 +50,16 @@ double INTERP_KERNEL::quadSkew(const double *coo) double INTERP_KERNEL::quadEdgeRatio(const double *coo) { - double const a2=(coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]); - double const b2=(coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]); - double const c2=(coo[9]-coo[6])*(coo[9]-coo[6])+(coo[10]-coo[7])*(coo[10]-coo[7])+(coo[11]-coo[8])*(coo[11]-coo[8]); - double const d2=(coo[0]-coo[9])*(coo[0]-coo[9])+(coo[1]-coo[10])*(coo[1]-coo[10])+(coo[2]-coo[11])*(coo[2]-coo[11]); - double const mab=a2Mcd?Mab:Mcd; + double a2=(coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]); + double b2=(coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]); + double c2=(coo[9]-coo[6])*(coo[9]-coo[6])+(coo[10]-coo[7])*(coo[10]-coo[7])+(coo[11]-coo[8])*(coo[11]-coo[8]); + double d2=(coo[0]-coo[9])*(coo[0]-coo[9])+(coo[1]-coo[10])*(coo[1]-coo[10])+(coo[2]-coo[11])*(coo[2]-coo[11]); + double mab=a2Mcd?Mab:Mcd; if(m2>1.e-15) return sqrt(M2/m2); else @@ -67,20 +68,20 @@ double INTERP_KERNEL::quadEdgeRatio(const double *coo) double INTERP_KERNEL::quadAspectRatio(const double *coo) { - double const a=sqrt((coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2])); - double const b=sqrt((coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5])); - double const c=sqrt((coo[9]-coo[6])*(coo[9]-coo[6])+(coo[10]-coo[7])*(coo[10]-coo[7])+(coo[11]-coo[8])*(coo[11]-coo[8])); - double const d=sqrt((coo[0]-coo[9])*(coo[0]-coo[9])+(coo[1]-coo[10])*(coo[1]-coo[10])+(coo[2]-coo[11])*(coo[2]-coo[11])); - double const ma=a>b?a:b; - double const mb=c>d?c:d; - double const hm=ma>mb?ma:mb; - double const ab[3]={(coo[4]-coo[1])*(coo[8]-coo[5])-(coo[7]-coo[4])*(coo[5]-coo[2]), + double a=sqrt((coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2])); + double b=sqrt((coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5])); + double c=sqrt((coo[9]-coo[6])*(coo[9]-coo[6])+(coo[10]-coo[7])*(coo[10]-coo[7])+(coo[11]-coo[8])*(coo[11]-coo[8])); + double d=sqrt((coo[0]-coo[9])*(coo[0]-coo[9])+(coo[1]-coo[10])*(coo[1]-coo[10])+(coo[2]-coo[11])*(coo[2]-coo[11])); + double ma=a>b?a:b; + double mb=c>d?c:d; + double hm=ma>mb?ma:mb; + double ab[3]={(coo[4]-coo[1])*(coo[8]-coo[5])-(coo[7]-coo[4])*(coo[5]-coo[2]), (coo[5]-coo[2])*(coo[6]-coo[3])-(coo[3]-coo[0])*(coo[8]-coo[5]), (coo[3]-coo[0])*(coo[7]-coo[4])-(coo[4]-coo[1])*(coo[6]-coo[3])}; - double const cd[3]={(coo[10]-coo[7])*(coo[2]-coo[11])-(coo[1]-coo[10])*(coo[11]-coo[8]), + double cd[3]={(coo[10]-coo[7])*(coo[2]-coo[11])-(coo[1]-coo[10])*(coo[11]-coo[8]), (coo[11]-coo[8])*(coo[0]-coo[9])-(coo[9]-coo[6])*(coo[2]-coo[11]), (coo[9]-coo[6])*(coo[1]-coo[10])-(coo[10]-coo[7])*(coo[0]-coo[9])}; - double const e=sqrt(ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2])+sqrt(cd[0]*cd[0]+cd[1]*cd[1]+cd[2]*cd[2]); + double e=sqrt(ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2])+sqrt(cd[0]*cd[0]+cd[1]*cd[1]+cd[2]*cd[2]); if(d>1e-15) return 0.5*(a+b+c+d)*hm/e; else @@ -89,37 +90,37 @@ double INTERP_KERNEL::quadAspectRatio(const double *coo) double INTERP_KERNEL::quadWarp(const double *coo) { - double const e0[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]}; - double const e1[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]}; - double const e2[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]}; - double const e3[3]={coo[0]-coo[9],coo[1]-coo[10],coo[2]-coo[11]}; + double e0[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]}; + double e1[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]}; + double e2[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]}; + double e3[3]={coo[0]-coo[9],coo[1]-coo[10],coo[2]-coo[11]}; - double const n0[3]={e3[1]*e0[2]-e3[2]*e0[1],e3[2]*e0[0]-e3[0]*e0[2],e3[0]*e0[1]-e3[1]*e0[0]}; - double const n1[3]={e0[1]*e1[2]-e0[2]*e1[1],e0[2]*e1[0]-e0[0]*e1[2],e0[0]*e1[1]-e0[1]*e1[0]}; - double const n2[3]={e1[1]*e2[2]-e1[2]*e2[1],e1[2]*e2[0]-e1[0]*e2[2],e1[0]*e2[1]-e1[1]*e2[0]}; - double const n3[3]={e2[1]*e3[2]-e2[2]*e3[1],e2[2]*e3[0]-e2[0]*e3[2],e2[0]*e3[1]-e2[1]*e3[0]}; + double n0[3]={e3[1]*e0[2]-e3[2]*e0[1],e3[2]*e0[0]-e3[0]*e0[2],e3[0]*e0[1]-e3[1]*e0[0]}; + double n1[3]={e0[1]*e1[2]-e0[2]*e1[1],e0[2]*e1[0]-e0[0]*e1[2],e0[0]*e1[1]-e0[1]*e1[0]}; + double n2[3]={e1[1]*e2[2]-e1[2]*e2[1],e1[2]*e2[0]-e1[0]*e2[2],e1[0]*e2[1]-e1[1]*e2[0]}; + double n3[3]={e2[1]*e3[2]-e2[2]*e3[1],e2[2]*e3[0]-e2[0]*e3[2],e2[0]*e3[1]-e2[1]*e3[0]}; - double const l0=sqrt(n0[0]*n0[0]+n0[1]*n0[1]+n0[2]*n0[2]); - double const l1=sqrt(n1[0]*n1[0]+n1[1]*n1[1]+n1[2]*n1[2]); - double const l2=sqrt(n2[0]*n2[0]+n2[1]*n2[1]+n2[2]*n2[2]); - double const l3=sqrt(n3[0]*n3[0]+n3[1]*n3[1]+n3[2]*n3[2]); + double l0=sqrt(n0[0]*n0[0]+n0[1]*n0[1]+n0[2]*n0[2]); + double l1=sqrt(n1[0]*n1[0]+n1[1]*n1[1]+n1[2]*n1[2]); + double l2=sqrt(n2[0]*n2[0]+n2[1]*n2[1]+n2[2]*n2[2]); + double l3=sqrt(n3[0]*n3[0]+n3[1]*n3[1]+n3[2]*n3[2]); if(l0<1.e-15 || l1<1.e-15 || l2<1.e-15 || l3<1e-15) return std::numeric_limits::min(); - double const warp=std::min(n0[0]/l0*n2[0]/l2+n0[1]/l0*n2[1]/l2+n0[2]/l0*n2[2]/l2,n1[0]/l1*n3[0]/l3+n1[1]/l1*n3[1]/l3+n1[2]/l1*n3[2]/l3); + double warp=std::min(n0[0]/l0*n2[0]/l2+n0[1]/l0*n2[1]/l2+n0[2]/l0*n2[2]/l2,n1[0]/l1*n3[0]/l3+n1[1]/l1*n3[1]/l3+n1[2]/l1*n3[2]/l3); return warp*warp*warp; } double INTERP_KERNEL::triEdgeRatio(const double *coo) { - double const a2=(coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]); - double const b2=(coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]); - double const c2=(coo[0]-coo[6])*(coo[0]-coo[6])+(coo[1]-coo[7])*(coo[1]-coo[7])+(coo[2]-coo[8])*(coo[2]-coo[8]); - double const mab=a2mab?mab:c2; - double const M2=c2>Mab?c2:Mab; + double a2=(coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2]); + double b2=(coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5]); + double c2=(coo[0]-coo[6])*(coo[0]-coo[6])+(coo[1]-coo[7])*(coo[1]-coo[7])+(coo[2]-coo[8])*(coo[2]-coo[8]); + double mab=a2mab?mab:c2; + double M2=c2>Mab?c2:Mab; if(m2>1.e-15) return sqrt(M2/m2); else @@ -128,17 +129,17 @@ double INTERP_KERNEL::triEdgeRatio(const double *coo) double INTERP_KERNEL::triAspectRatio(const double *coo) { - double const a=sqrt((coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2])); - double const b=sqrt((coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5])); - double const c=sqrt((coo[0]-coo[6])*(coo[0]-coo[6])+(coo[1]-coo[7])*(coo[1]-coo[7])+(coo[2]-coo[8])*(coo[2]-coo[8])); + double a=sqrt((coo[3]-coo[0])*(coo[3]-coo[0])+(coo[4]-coo[1])*(coo[4]-coo[1])+(coo[5]-coo[2])*(coo[5]-coo[2])); + double b=sqrt((coo[6]-coo[3])*(coo[6]-coo[3])+(coo[7]-coo[4])*(coo[7]-coo[4])+(coo[8]-coo[5])*(coo[8]-coo[5])); + double c=sqrt((coo[0]-coo[6])*(coo[0]-coo[6])+(coo[1]-coo[7])*(coo[1]-coo[7])+(coo[2]-coo[8])*(coo[2]-coo[8])); double hm=a>b?a:b; hm=hm>c?hm:c; - double const ab[3]={(coo[4]-coo[1])*(coo[8]-coo[5])-(coo[7]-coo[4])*(coo[5]-coo[2]), + double ab[3]={(coo[4]-coo[1])*(coo[8]-coo[5])-(coo[7]-coo[4])*(coo[5]-coo[2]), (coo[5]-coo[2])*(coo[6]-coo[3])-(coo[3]-coo[0])*(coo[8]-coo[5]), (coo[3]-coo[0])*(coo[7]-coo[4])-(coo[4]-coo[1])*(coo[6]-coo[3])}; - double const d=sqrt(ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2]); + double d=sqrt(ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2]); static const double normalizeCoeff=sqrt(3.)/6.; if(d>1.e-15) return normalizeCoeff*hm*(a+b+c)/d; @@ -148,12 +149,12 @@ double INTERP_KERNEL::triAspectRatio(const double *coo) double INTERP_KERNEL::tetraEdgeRatio(const double *coo) { - double const a[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]}; - double const b[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]}; - double const c[3]={coo[0]-coo[6],coo[1]-coo[7],coo[2]-coo[8]}; - double const d[3]={coo[9]-coo[0],coo[10]-coo[1],coo[11]-coo[2]}; - double const e[3]={coo[9]-coo[3],coo[10]-coo[4],coo[11]-coo[5]}; - double const f[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]}; + double a[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]}; + double b[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]}; + double c[3]={coo[0]-coo[6],coo[1]-coo[7],coo[2]-coo[8]}; + double d[3]={coo[9]-coo[0],coo[10]-coo[1],coo[11]-coo[2]}; + double e[3]={coo[9]-coo[3],coo[10]-coo[4],coo[11]-coo[5]}; + double f[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]}; double l2[6]= {a[0]*a[0]+a[1]*a[1]+a[2]*a[2], @@ -163,8 +164,8 @@ double INTERP_KERNEL::tetraEdgeRatio(const double *coo) e[0]*e[0]+e[1]*e[1]+e[2]*e[2], f[0]*f[0]+f[1]*f[1]+f[2]*f[2]}; - double const M2=*std::max_element(l2,l2+6); - double const m2=*std::min_element(l2,l2+6); + double M2=*std::max_element(l2,l2+6); + double m2=*std::min_element(l2,l2+6); if(m2>1e-15) return sqrt(M2/m2); else @@ -174,28 +175,28 @@ double INTERP_KERNEL::tetraEdgeRatio(const double *coo) double INTERP_KERNEL::tetraAspectRatio(const double *coo) { static const double normalizeCoeff=sqrt(6.)/12.; - double const ab[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]}; - double const ac[3]={coo[6]-coo[0],coo[7]-coo[1],coo[8]-coo[2]}; - double const ad[3]={coo[9]-coo[0],coo[10]-coo[1],coo[11]-coo[2]}; - double const detTet=(ab[0]*(ac[1]*ad[2]-ac[2]*ad[1]))+(ab[1]*(ac[2]*ad[0]-ac[0]*ad[2]))+(ab[2]*(ac[0]*ad[1]-ac[1]*ad[0])); + double ab[3]={coo[3]-coo[0],coo[4]-coo[1],coo[5]-coo[2]}; + double ac[3]={coo[6]-coo[0],coo[7]-coo[1],coo[8]-coo[2]}; + double ad[3]={coo[9]-coo[0],coo[10]-coo[1],coo[11]-coo[2]}; + double detTet=(ab[0]*(ac[1]*ad[2]-ac[2]*ad[1]))+(ab[1]*(ac[2]*ad[0]-ac[0]*ad[2]))+(ab[2]*(ac[0]*ad[1]-ac[1]*ad[0])); //if(detTet<1.e-15) // return std::numeric_limits::max(); - double const bc[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]}; + double bc[3]={coo[6]-coo[3],coo[7]-coo[4],coo[8]-coo[5]}; double bd[3]={coo[9]-coo[3],coo[10]-coo[4],coo[11]-coo[5]}; - double const cd[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]}; + double cd[3]={coo[9]-coo[6],coo[10]-coo[7],coo[11]-coo[8]}; - double const ab2=ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2]; - double const bc2=bc[0]*bc[0]+bc[1]*bc[1]+bc[2]*bc[2]; - double const ac2=ac[0]*ac[0]+ac[1]*ac[1]+ac[2]*ac[2]; - double const ad2=ad[0]*ad[0]+ad[1]*ad[1]+ad[2]*ad[2]; - double const bd2=bd[0]*bd[0]+bd[1]*bd[1]+bd[2]*bd[2]; - double const cd2=cd[0]*cd[0]+cd[1]*cd[1]+cd[2]*cd[2]; + double ab2=ab[0]*ab[0]+ab[1]*ab[1]+ab[2]*ab[2]; + double bc2=bc[0]*bc[0]+bc[1]*bc[1]+bc[2]*bc[2]; + double ac2=ac[0]*ac[0]+ac[1]*ac[1]+ac[2]*ac[2]; + double ad2=ad[0]*ad[0]+ad[1]*ad[1]+ad[2]*ad[2]; + double bd2=bd[0]*bd[0]+bd[1]*bd[1]+bd[2]*bd[2]; + double cd2=cd[0]*cd[0]+cd[1]*cd[1]+cd[2]*cd[2]; double A=ab2>bc2?ab2:bc2; double B=ac2>ad2?ac2:ad2; double C=bd2>cd2?bd2:cd2; double D=A>B?A:B; - double const hm=D>C?sqrt(D):sqrt(C); + double hm=D>C?sqrt(D):sqrt(C); bd[0]=ab[1]*bc[2]-ab[2]*bc[1]; bd[1]=ab[2]*bc[0]-ab[0]*bc[2]; bd[2]=ab[0]*bc[1]-ab[1]*bc[0]; A=sqrt(bd[0]*bd[0]+bd[1]*bd[1]+bd[2]*bd[2]); diff --git a/src/INTERP_KERNEL/InterpKernelRootsMultiDim.hxx b/src/INTERP_KERNEL/InterpKernelRootsMultiDim.hxx index 01114b440..c518349c6 100644 --- a/src/INTERP_KERNEL/InterpKernelRootsMultiDim.hxx +++ b/src/INTERP_KERNEL/InterpKernelRootsMultiDim.hxx @@ -22,14 +22,13 @@ #include "InterpKernelDenseMatrix.hxx" #include "InterpKernelLUDecomp.hxx" +#include "InterpKernelQRDecomp.hxx" #include "InterpKernelException.hxx" #include "MCIdType.hxx" -#include #include #include #include -#include template inline T sqr(const T a) { return a*a; } @@ -101,18 +100,18 @@ namespace INTERP_KERNEL class JacobianCalculator { private: - const double EPS{1.0e-8}; + const double EPS; T &func; public: - JacobianCalculator(T &funcc) : func(funcc) {} + JacobianCalculator(T &funcc) : EPS(1.0e-8),func(funcc) {} INTERP_KERNEL::DenseMatrix operator() (const std::vector& x, const std::vector& fvec) { - mcIdType const n=x.size(); + mcIdType n=x.size(); INTERP_KERNEL::DenseMatrix df(n,n); std::vector xh=x; for (mcIdType j=0;j @@ -31,7 +33,7 @@ namespace INTERP_KERNEL class Interpolation : public InterpolationOptions { public: - Interpolation() = default; + Interpolation() { } Interpolation(const InterpolationOptions& io) :InterpolationOptions(io){} //interpolation of two triangular meshes. template diff --git a/src/INTERP_KERNEL/Interpolation.txx b/src/INTERP_KERNEL/Interpolation.txx old mode 100644 new mode 100755 index 8533cbe63..33848df42 --- a/src/INTERP_KERNEL/Interpolation.txx +++ b/src/INTERP_KERNEL/Interpolation.txx @@ -21,15 +21,9 @@ #define __INTERPOLATION_TXX__ #include "Interpolation.hxx" +#include "IntegralUniformIntersector.hxx" #include "IntegralUniformIntersector.txx" -#include "InterpolationOptions.hxx" -#include "InterpKernelException.hxx" #include "VectorUtils.hxx" -#include -#include -#include -#include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/Interpolation1D.hxx b/src/INTERP_KERNEL/Interpolation1D.hxx index 3a8a3d755..8ed838fcb 100644 --- a/src/INTERP_KERNEL/Interpolation1D.hxx +++ b/src/INTERP_KERNEL/Interpolation1D.hxx @@ -21,15 +21,14 @@ #ifndef __INTERPOLATION1D_HXX__ #define __INTERPOLATION1D_HXX__ -#include "InterpolationOptions.hxx" -#include "InterpolationCurve.txx" +#include "InterpolationCurve.hxx" namespace INTERP_KERNEL { class Interpolation1D : public InterpolationCurve { public: - Interpolation1D() = default; + Interpolation1D() { } Interpolation1D(const InterpolationOptions& io):InterpolationCurve(io) {} }; } diff --git a/src/INTERP_KERNEL/Interpolation1D.txx b/src/INTERP_KERNEL/Interpolation1D.txx index 3975b0f6b..599092f73 100644 --- a/src/INTERP_KERNEL/Interpolation1D.txx +++ b/src/INTERP_KERNEL/Interpolation1D.txx @@ -20,6 +20,8 @@ #ifndef __INTERPOLATION1D_TXX__ #define __INTERPOLATION1D_TXX__ +#include "Interpolation1D.hxx" +#include "InterpolationCurve.txx" #endif diff --git a/src/INTERP_KERNEL/Interpolation1D0D.cxx b/src/INTERP_KERNEL/Interpolation1D0D.cxx index 1e7bb369c..1f09c091a 100644 --- a/src/INTERP_KERNEL/Interpolation1D0D.cxx +++ b/src/INTERP_KERNEL/Interpolation1D0D.cxx @@ -19,14 +19,12 @@ // Author : Anthony GEAY (EDF R&D) #include "Interpolation1D0D.hxx" -#include "InterpolationOptions.hxx" -#include -#include +#include "Interpolation1D0D.txx" namespace INTERP_KERNEL { Interpolation1D0D::Interpolation1D0D() - = default; + {} Interpolation1D0D::Interpolation1D0D(const InterpolationOptions& io):Interpolation(io) {} @@ -39,7 +37,7 @@ namespace INTERP_KERNEL const int SPACE_DIM = 3; const double adj(getPrecision());// here precision is used instead of getBoundingBoxAdjustment and getBoundingBoxAdjustmentAbs because in the context only precision is relevant - std::size_t const size = bbox.size()/(2*SPACE_DIM); + std::size_t size = bbox.size()/(2*SPACE_DIM); for (std::size_t i=0; i #include namespace INTERP_KERNEL diff --git a/src/INTERP_KERNEL/Interpolation1D0D.txx b/src/INTERP_KERNEL/Interpolation1D0D.txx old mode 100644 new mode 100755 index 8bae8193b..6eec38723 --- a/src/INTERP_KERNEL/Interpolation1D0D.txx +++ b/src/INTERP_KERNEL/Interpolation1D0D.txx @@ -21,18 +21,18 @@ #ifndef __INTERPOLATION1D0D_TXX__ #define __INTERPOLATION1D0D_TXX__ -#include "InterpKernelException.hxx" #include "Interpolation1D0D.hxx" -#include "MeshElement.hxx" +#include "Interpolation.txx" +#include "MeshElement.txx" +#include "PointLocator3DIntersectorP0P0.txx" +#include "PointLocator3DIntersectorP0P1.txx" +#include "PointLocator3DIntersectorP1P0.txx" +#include "PointLocator3DIntersectorP1P1.txx" #include "Log.hxx" #include "BBTree.txx" #include "InterpKernelAssert.hxx" -#include -#include -#include -#include namespace INTERP_KERNEL { @@ -44,7 +44,7 @@ namespace INTERP_KERNEL typename MyMeshType::MyConnType Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) { constexpr int SPACEDIM=MyMeshType::MY_SPACEDIM; - typedef typename MyMeshType::MyConnType ConnType; + using ConnType=typename MyMeshType::MyConnType; IKAssert(SPACEDIM==3); if(InterpolationOptions::getIntersectionType() != PointLocator) diff --git a/src/INTERP_KERNEL/Interpolation2D.hxx b/src/INTERP_KERNEL/Interpolation2D.hxx index 632152445..3902c024b 100644 --- a/src/INTERP_KERNEL/Interpolation2D.hxx +++ b/src/INTERP_KERNEL/Interpolation2D.hxx @@ -21,17 +21,14 @@ #ifndef __INTERPOLATION2D_HXX__ #define __INTERPOLATION2D_HXX__ -#include "InterpolationOptions.hxx" -#include "PlanarIntersector.hxx" -#include "InterpolationPlanar.txx" -#include +#include "InterpolationPlanar.hxx" namespace INTERP_KERNEL { class Interpolation2D : public InterpolationPlanar { public: - Interpolation2D() = default; + Interpolation2D() { } Interpolation2D(const InterpolationOptions& io):InterpolationPlanar(io) { } public: bool doRotate() const { return false; } diff --git a/src/INTERP_KERNEL/Interpolation2D.txx b/src/INTERP_KERNEL/Interpolation2D.txx index 9e63d332b..67bf2188b 100644 --- a/src/INTERP_KERNEL/Interpolation2D.txx +++ b/src/INTERP_KERNEL/Interpolation2D.txx @@ -20,6 +20,8 @@ #ifndef __INTERPOLATION2D_TXX__ #define __INTERPOLATION2D_TXX__ +#include "Interpolation2D.hxx" +#include "InterpolationPlanar.txx" #endif diff --git a/src/INTERP_KERNEL/Interpolation2D1D.hxx b/src/INTERP_KERNEL/Interpolation2D1D.hxx index f6b05b949..a25996140 100644 --- a/src/INTERP_KERNEL/Interpolation2D1D.hxx +++ b/src/INTERP_KERNEL/Interpolation2D1D.hxx @@ -21,13 +21,10 @@ #ifndef __INTERPOLATION2D1D_HXX__ #define __INTERPOLATION2D1D_HXX__ -#include -#include -#include - -#include "InterpolationOptions.hxx" #include "Interpolation.hxx" -#include "MCIdType.hxx" +#include "Planar2D1DIntersectorP0P0.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpolationOptions.hxx" namespace INTERP_KERNEL { @@ -43,7 +40,7 @@ namespace INTERP_KERNEL class Interpolation2D1D : public Interpolation { public: - using DuplicateFacesType = std::map>; + typedef std::map > DuplicateFacesType; Interpolation2D1D() { setOrientation(2); } Interpolation2D1D(const InterpolationOptions& io):Interpolation(io) { } diff --git a/src/INTERP_KERNEL/Interpolation2D1D.txx b/src/INTERP_KERNEL/Interpolation2D1D.txx old mode 100644 new mode 100755 index d2fd7cfb5..0e95ea59e --- a/src/INTERP_KERNEL/Interpolation2D1D.txx +++ b/src/INTERP_KERNEL/Interpolation2D1D.txx @@ -21,21 +21,6 @@ #define __INTERPOLATION2D1D_TXX__ #include "Interpolation2D1D.hxx" -#include -#include "NormalizedUnstructuredMesh.hxx" -#include "PlanarIntersector.txx" -#include "Planar2D1DIntersectorP0P0.hxx" -#include "InterpolationOptions.hxx" -#include "Geometric2DIntersector.txx" -#include "InterpKernelException.hxx" -#include "BBTree.txx" -#include "InterpolationUtils.hxx" - -#include -#include -#include -#include -#include namespace INTERP_KERNEL { @@ -67,7 +52,7 @@ namespace INTERP_KERNEL typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; - long const global_start =clock(); + long global_start =clock(); std::size_t counter=0; /***********************************************************/ /* Check both meshes are made of triangles and quadrangles */ @@ -87,7 +72,7 @@ namespace INTERP_KERNEL } PlanarIntersector* intersector=0; - std::string const meth = InterpolationOptions::filterInterpolationMethod(method); + std::string meth = InterpolationOptions::filterInterpolationMethod(method); if(meth=="P0P0") { switch (InterpolationOptions::getIntersectionType()) @@ -112,23 +97,23 @@ namespace INTERP_KERNEL /* Instantiate the intersector and initialise the result vector */ /****************************************************************/ - long const start_filtering=clock(); + long start_filtering=clock(); std::vector bbox; intersector->createBoundingBoxes(myMeshS,bbox); // create the bounding boxes - const double *bboxPtr=nullptr; + const double *bboxPtr=0; if(nbMailleS>0) bboxPtr=&bbox[0]; BBTree my_tree(bboxPtr, 0, 0,nbMailleS, -getPrecision());//creating the search structure - long const end_filtering=clock(); + long end_filtering=clock(); result.resize(intersector->getNumberOfRowsOfResMatrix());//on initialise. /****************************************************/ /* Loop on the target cells - core of the algorithm */ /****************************************************/ - long const start_intersection=clock(); + long start_intersection=clock(); ConnType nbelem_type=myMeshT.getNumberOfElements(); const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr(); for(ConnType iT=0; iT=1) { - long const end_intersection=clock(); + long end_intersection=clock(); std::cout << "Filtering time= " << end_filtering-start_filtering << std::endl; std::cout << "Intersection time= " << end_intersection-start_intersection << std::endl; - long const global_end =clock(); + long global_end =clock(); std::cout << "Number of computed intersections = " << counter << std::endl; std::cout << "Global time= " << global_end - global_start << std::endl; } diff --git a/src/INTERP_KERNEL/Interpolation2D3D.cxx b/src/INTERP_KERNEL/Interpolation2D3D.cxx index 1583b8373..483d87382 100644 --- a/src/INTERP_KERNEL/Interpolation2D3D.cxx +++ b/src/INTERP_KERNEL/Interpolation2D3D.cxx @@ -18,7 +18,6 @@ // #include "Interpolation2D3D.hxx" -#include "InterpolationOptions.hxx" namespace INTERP_KERNEL { @@ -27,7 +26,8 @@ namespace INTERP_KERNEL * */ Interpolation2D3D::Interpolation2D3D() - = default; + { + } Interpolation2D3D::Interpolation2D3D(const InterpolationOptions& io):Interpolation(io) { } diff --git a/src/INTERP_KERNEL/Interpolation2D3D.hxx b/src/INTERP_KERNEL/Interpolation2D3D.hxx index dc1ba1e71..43e730440 100644 --- a/src/INTERP_KERNEL/Interpolation2D3D.hxx +++ b/src/INTERP_KERNEL/Interpolation2D3D.hxx @@ -20,17 +20,16 @@ #ifndef __INTERPOLATION2D3D_HXX__ #define __INTERPOLATION2D3D_HXX__ -#include #include #include #include "INTERPKERNELDefines.hxx" +#include "Interpolation.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "InterpolationOptions.hxx" #include "MCIdType.hxx" #include "Intersector3D.hxx" -#include "NormalizedGeometricTypes" -#include "Interpolation.hxx" -#include +#include namespace INTERP_KERNEL { @@ -46,7 +45,7 @@ namespace INTERP_KERNEL class Interpolation2D3D : public Interpolation { public: - using DuplicateFacesType = std::map>; + typedef std::map > DuplicateFacesType; INTERPKERNEL_EXPORT Interpolation2D3D(); INTERPKERNEL_EXPORT Interpolation2D3D(const InterpolationOptions& io); diff --git a/src/INTERP_KERNEL/Interpolation2D3D.txx b/src/INTERP_KERNEL/Interpolation2D3D.txx old mode 100644 new mode 100755 index 5dd719852..c7f8dca2c --- a/src/INTERP_KERNEL/Interpolation2D3D.txx +++ b/src/INTERP_KERNEL/Interpolation2D3D.txx @@ -19,23 +19,22 @@ #ifndef __INTERPOLATION2D3D_TXX__ #define __INTERPOLATION2D3D_TXX__ -#include "BBTreeStandAlone.txx" -#include "BoundingBox.hxx" #include "Interpolation2D3D.hxx" -// #include "Interpolation.txx" -#include "Intersector3D.txx" -#include "Log.hxx" -#include "InterpolationOptions.hxx" +#include "Interpolation.txx" #include "MeshElement.txx" -#include "NormalizedGeometricTypes" +#include "TransformedTriangle.hxx" #include "Polyhedron3D2DIntersectorP0P0.txx" +#include "PointLocator3DIntersectorP0P0.txx" +#include "PolyhedronIntersectorP0P1.txx" +#include "PointLocator3DIntersectorP0P1.txx" +#include "PolyhedronIntersectorP1P0.txx" +#include "PolyhedronIntersectorP1P0Bary.txx" +#include "PointLocator3DIntersectorP1P0.txx" +#include "PolyhedronIntersectorP1P1.txx" +#include "PointLocator3DIntersectorP1P1.txx" #include "InterpolationHelper.txx" -#include "InterpKernelException.hxx" -#include -#include -#include -#include +#include "BBTree.txx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/Interpolation2DCurve.cxx b/src/INTERP_KERNEL/Interpolation2DCurve.cxx index baabef9c2..ee38edea5 100644 --- a/src/INTERP_KERNEL/Interpolation2DCurve.cxx +++ b/src/INTERP_KERNEL/Interpolation2DCurve.cxx @@ -20,7 +20,6 @@ #include "Interpolation2DCurve.hxx" #include "InterpolationCurve.txx" -#include "InterpolationOptions.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/Interpolation2DCurve.hxx b/src/INTERP_KERNEL/Interpolation2DCurve.hxx index 99390cfca..9f6f908ba 100644 --- a/src/INTERP_KERNEL/Interpolation2DCurve.hxx +++ b/src/INTERP_KERNEL/Interpolation2DCurve.hxx @@ -21,9 +21,8 @@ #ifndef __INTERPOLATION2DCURVE_HXX__ #define __INTERPOLATION2DCURVE_HXX__ -#include "INTERPKERNELDefines.hxx" -#include "InterpolationOptions.hxx" #include "InterpolationCurve.hxx" +#include "InterpolationOptions.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/Interpolation3D.cxx b/src/INTERP_KERNEL/Interpolation3D.cxx index c79041fa0..530f2c45a 100644 --- a/src/INTERP_KERNEL/Interpolation3D.cxx +++ b/src/INTERP_KERNEL/Interpolation3D.cxx @@ -19,7 +19,7 @@ // Author : Anthony Geay (CEA/DEN) #include "Interpolation3D.hxx" -#include "InterpolationOptions.hxx" +#include "Interpolation3D.txx" namespace INTERP_KERNEL { @@ -28,7 +28,8 @@ namespace INTERP_KERNEL * */ Interpolation3D::Interpolation3D() - = default; + { + } Interpolation3D::Interpolation3D(const InterpolationOptions& io):Interpolation(io) { } diff --git a/src/INTERP_KERNEL/Interpolation3D.hxx b/src/INTERP_KERNEL/Interpolation3D.hxx old mode 100644 new mode 100755 index 8fce0d3ac..b7ff8abc4 --- a/src/INTERP_KERNEL/Interpolation3D.hxx +++ b/src/INTERP_KERNEL/Interpolation3D.hxx @@ -22,9 +22,9 @@ #define __INTERPOLATION3D_HXX__ #include "INTERPKERNELDefines.hxx" +#include "Interpolation.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "InterpolationOptions.hxx" -#include "Interpolation.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/Interpolation3D.txx b/src/INTERP_KERNEL/Interpolation3D.txx old mode 100644 new mode 100755 index ecee51b99..6668dab81 --- a/src/INTERP_KERNEL/Interpolation3D.txx +++ b/src/INTERP_KERNEL/Interpolation3D.txx @@ -22,13 +22,9 @@ #define __INTERPOLATION3D_TXX__ #include "Interpolation3D.hxx" - -#include "BBTreeStandAlone.txx" -#include "BoundingBox.hxx" -#include "InterpolationOptions.hxx" -#include "Intersector3D.hxx" +#include "Interpolation.txx" #include "MeshElement.txx" - +#include "TransformedTriangle.hxx" #include "PolyhedronIntersectorP0P0.txx" #include "PointLocator3DIntersectorP0P0.txx" #include "PolyhedronIntersectorP0P1.txx" @@ -41,10 +37,6 @@ #include "Barycentric3DIntersectorP1P1.txx" #include "MappedBarycentric3DIntersectorP1P1.txx" #include "Log.hxx" -#include "InterpKernelException.hxx" -#include -#include -#include // If defined, use recursion to traverse the binary search tree, else use the BBTree class //#define USE_RECURSIVE_BBOX_FILTER @@ -59,6 +51,7 @@ #endif +#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/Interpolation3D1D.cxx b/src/INTERP_KERNEL/Interpolation3D1D.cxx index 5d8fe5bef..05e08aa76 100644 --- a/src/INTERP_KERNEL/Interpolation3D1D.cxx +++ b/src/INTERP_KERNEL/Interpolation3D1D.cxx @@ -19,14 +19,11 @@ // Author : Adrien Bruneton (CEA/DEN) #include "Interpolation3D1D.hxx" -#include "InterpolationOptions.hxx" -#include -#include -#include +#include "Interpolation3D1D.txx" namespace INTERP_KERNEL { - Interpolation3D1D::Interpolation3D1D() = default; + Interpolation3D1D::Interpolation3D1D() { } Interpolation3D1D::Interpolation3D1D(const InterpolationOptions& io):Interpolation(io) { } @@ -36,13 +33,13 @@ namespace INTERP_KERNEL const double adj = getBoundingBoxAdjustmentAbs(); const double adjRel = getBoundingBoxAdjustment(); - std::size_t const size = sz/(2*SPACE_DIM); + std::size_t size = sz/(2*SPACE_DIM); for (std::size_t i=0; i::max(); for(int idim=0; idim -#include #include namespace INTERP_KERNEL diff --git a/src/INTERP_KERNEL/Interpolation3D1D.txx b/src/INTERP_KERNEL/Interpolation3D1D.txx old mode 100644 new mode 100755 index 094abc509..35e01c71c --- a/src/INTERP_KERNEL/Interpolation3D1D.txx +++ b/src/INTERP_KERNEL/Interpolation3D1D.txx @@ -20,22 +20,16 @@ #pragma once -#include "InterpKernelException.hxx" -#include "BBTreeStandAlone.txx" -#include "BoundingBox.hxx" #include "Interpolation3D1D.hxx" -#include "Intersector3D.hxx" -#include "MeshElement.hxx" -#include "PointLocator3DIntersectorP0P0.hxx" -#include "PointLocator3DIntersectorP0P1.hxx" -#include "PointLocator3DIntersectorP1P0.hxx" -#include "PointLocator3DIntersectorP1P1.hxx" +#include "Interpolation.txx" +#include "MeshElement.txx" +#include "PointLocator3DIntersectorP0P0.txx" +#include "PointLocator3DIntersectorP0P1.txx" +#include "PointLocator3DIntersectorP1P0.txx" +#include "PointLocator3DIntersectorP1P1.txx" #include "Log.hxx" #include "InterpolationHelper.txx" -#include -#include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/Interpolation3DSurf.cxx b/src/INTERP_KERNEL/Interpolation3DSurf.cxx index 308a88a79..8ad977928 100644 --- a/src/INTERP_KERNEL/Interpolation3DSurf.cxx +++ b/src/INTERP_KERNEL/Interpolation3DSurf.cxx @@ -19,13 +19,13 @@ // Author : Anthony Geay (CEA/DEN) #include "Interpolation3DSurf.hxx" -#include "InterpolationOptions.hxx" #include "InterpolationPlanar.txx" namespace INTERP_KERNEL { Interpolation3DSurf::Interpolation3DSurf() - = default; + { + } Interpolation3DSurf::Interpolation3DSurf(const InterpolationOptions& io):InterpolationPlanar(io) { @@ -51,8 +51,8 @@ namespace INTERP_KERNEL - Values: integer between 0 and 3. - Default: 0. */ - void Interpolation3DSurf::setOptions(double precision, int printLevel, double medianPlan, - IntersectionType intersectionType, bool doRotat, int orientation) + void Interpolation3DSurf::setOptions(double precision, int printLevel, double medianPlan, + IntersectionType intersectionType, bool doRotat, int orientation) { InterpolationPlanar::setOptions(precision,printLevel,intersectionType, orientation); InterpolationPlanar::setDoRotate(doRotat); diff --git a/src/INTERP_KERNEL/Interpolation3DSurf.hxx b/src/INTERP_KERNEL/Interpolation3DSurf.hxx index 8d4836001..ae8d1728e 100644 --- a/src/INTERP_KERNEL/Interpolation3DSurf.hxx +++ b/src/INTERP_KERNEL/Interpolation3DSurf.hxx @@ -21,11 +21,9 @@ #ifndef __INTERPOLATION3DSURF_HXX__ #define __INTERPOLATION3DSURF_HXX__ +#include "InterpolationPlanar.txx" #include "INTERPKERNELDefines.hxx" #include "InterpolationOptions.hxx" -#include "PlanarIntersector.hxx" -#include "InterpolationPlanar.txx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/InterpolationCC.hxx b/src/INTERP_KERNEL/InterpolationCC.hxx index db50aabd4..2af069f72 100644 --- a/src/INTERP_KERNEL/InterpolationCC.hxx +++ b/src/INTERP_KERNEL/InterpolationCC.hxx @@ -24,7 +24,6 @@ #ifndef __InterpolationCC_HXX__ #define __InterpolationCC_HXX__ -#include "InterpolationOptions.hxx" #include "Interpolation.hxx" namespace INTERP_KERNEL diff --git a/src/INTERP_KERNEL/InterpolationCC.txx b/src/INTERP_KERNEL/InterpolationCC.txx index 3c109bfce..954fdd74e 100644 --- a/src/INTERP_KERNEL/InterpolationCC.txx +++ b/src/INTERP_KERNEL/InterpolationCC.txx @@ -22,11 +22,7 @@ // #include "InterpolationCC.hxx" -#include "InterpolationOptions.hxx" #include "InterpolationUtils.hxx" -#include -#include -#include // convert index "From Mesh Index" #define _FMI(i) OTT::ind2C((i)) @@ -41,7 +37,8 @@ namespace INTERP_KERNEL */ //================================================================================ InterpolationCC::InterpolationCC() - = default; + { + } InterpolationCC::InterpolationCC(const InterpolationOptions& io):Interpolation(io) { @@ -220,12 +217,12 @@ namespace INTERP_KERNEL x2t = tgt_coords[ j ][ it+1 ]; x2s = src_coords[ j ][ is+1 ]; - double const x1 = std::max( x1s ,x1t ); - double const x2 = std::min( x2s ,x2t ); + double x1 = std::max( x1s ,x1t ); + double x2 = std::min( x2s ,x2t ); axis_interferences.push_back( Interference( is, it, x2 - x1 )); // to the next target and/or source cell - double const diff2 = x2s - x2t; + double diff2 = x2s - x2t; if ( diff2 > -eps ) intersection = ( ++it < tgt_nb_cells[j] ); if ( diff2 < eps ) diff --git a/src/INTERP_KERNEL/InterpolationCU.hxx b/src/INTERP_KERNEL/InterpolationCU.hxx index 96b211ebc..5a64bb87b 100644 --- a/src/INTERP_KERNEL/InterpolationCU.hxx +++ b/src/INTERP_KERNEL/InterpolationCU.hxx @@ -24,8 +24,9 @@ #ifndef __InterpolationCU_HXX__ #define __InterpolationCU_HXX__ -#include "InterpolationOptions.hxx" #include "Interpolation.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/InterpolationCU.txx b/src/INTERP_KERNEL/InterpolationCU.txx index 5db3a5fd9..9b8fc34ec 100644 --- a/src/INTERP_KERNEL/InterpolationCU.txx +++ b/src/INTERP_KERNEL/InterpolationCU.txx @@ -25,18 +25,12 @@ #include "InterpolationCU.hxx" -#include "InterpolationUtils.hxx" -#include "InterpolationOptions.hxx" -#include "IntersectorCU.txx" +#include "Interpolation.txx" #include "IntersectorCU1D.txx" #include "IntersectorCU2D.txx" #include "IntersectorCU3D.txx" -#include "NormalizedGeometricTypes" -#include "TargetIntersector.hxx" -#include -#include -#include +#include // // convert index "From Mesh Index" #define _FMIU(i) OTT::ind2C((i)) @@ -65,7 +59,8 @@ namespace INTERP_KERNEL //================================================================================ InterpolationCU::InterpolationCU() - = default; + { + } InterpolationCU::InterpolationCU(const InterpolationOptions & io) :Interpolation(io) @@ -228,7 +223,7 @@ namespace INTERP_KERNEL MatrixType revResult; CConnType sizeT = interpolateMeshes( meshT, meshS, revResult, method ); - auto sizeS = static_cast(revResult.size()); + UConnType sizeS = static_cast(revResult.size()); result.resize( sizeT ); for ( CConnType iS = 0; iS < sizeS; ++iS ) diff --git a/src/INTERP_KERNEL/InterpolationCurve.hxx b/src/INTERP_KERNEL/InterpolationCurve.hxx old mode 100644 new mode 100755 index c38ce7f52..37b3aca2b --- a/src/INTERP_KERNEL/InterpolationCurve.hxx +++ b/src/INTERP_KERNEL/InterpolationCurve.hxx @@ -27,8 +27,6 @@ #include "BBTree.txx" #include -#include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/InterpolationCurve.txx b/src/INTERP_KERNEL/InterpolationCurve.txx old mode 100644 new mode 100755 index bb0e5bf02..9cd3cbf21 --- a/src/INTERP_KERNEL/InterpolationCurve.txx +++ b/src/INTERP_KERNEL/InterpolationCurve.txx @@ -20,34 +20,24 @@ #ifndef __INTERPOLATIONCURVE_TXX__ #define __INTERPOLATIONCURVE_TXX__ -#include "Interpolation.txx" -#include "BBTree.txx" -#include "CurveIntersector.txx" +#include "InterpolationCurve.hxx" +#include "InterpolationOptions.hxx" #include "CurveIntersectorP0P0.txx" -#include "CurveIntersectorP0P1.txx" #include "CurveIntersectorP1P0.txx" +#include "CurveIntersectorP0P1.txx" #include "CurveIntersectorP1P1.txx" #include "CurveIntersectorP1P1PL.txx" -#include "InterpolationCurve.hxx" -#include "InterpolationOptions.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "InterpolationUtils.hxx" -#include -#include -#include -#include -#include #include #include -#include namespace INTERP_KERNEL { template InterpolationCurve::InterpolationCurve() - = default; + { + } template InterpolationCurve::InterpolationCurve (const InterpolationOptions& io) @@ -90,7 +80,7 @@ namespace INTERP_KERNEL typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol = MyMeshType::My_numPol; - long const global_start = clock(); + long global_start = clock(); std::size_t counter=0; ConnType nbMailleS = myMeshS.getNumberOfElements(); @@ -179,7 +169,7 @@ namespace INTERP_KERNEL /* Instantiate the intersector and initialise the result vector */ /****************************************************************/ - long const start_filtering=clock(); + long start_filtering=clock(); std::vector bbox; intersector->createBoundingBoxes(myMeshS,bbox); // create the bounding boxes @@ -187,14 +177,14 @@ namespace INTERP_KERNEL InterpolationOptions::getBoundingBoxAdjustmentAbs()); BBTree my_tree(&bbox[0], 0, 0, nbMailleS);//creating the search structure - long const end_filtering = clock(); + long end_filtering = clock(); result.resize(intersector->getNumberOfRowsOfResMatrix());//on initialise. /****************************************************/ /* Loop on the target cells - core of the algorithm */ /****************************************************/ - long const start_intersection = clock(); + long start_intersection = clock(); const ConnType *connIndxT = myMeshT.getConnectivityIndexPtr(); for(ConnType iT=0; iT= 1) { - long const end_intersection=clock(); + long end_intersection=clock(); std::cout << "Filtering time= " << end_filtering-start_filtering << std::endl; std::cout << "Intersection time= " << end_intersection-start_intersection << std::endl; - long const global_end =clock(); + long global_end =clock(); std::cout << "Number of computed intersections = " << counter << std::endl; std::cout << "Global time= " << global_end - global_start << std::endl; } diff --git a/src/INTERP_KERNEL/InterpolationHelper.txx b/src/INTERP_KERNEL/InterpolationHelper.txx old mode 100644 new mode 100755 index f0fead1c8..e2ca32318 --- a/src/INTERP_KERNEL/InterpolationHelper.txx +++ b/src/INTERP_KERNEL/InterpolationHelper.txx @@ -22,12 +22,10 @@ #include "BBTreeStandAlone.txx" #include "MeshElement.txx" -#include "BoundingBox.hxx" #include "Log.hxx" #include #include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/InterpolationOptions.cxx b/src/INTERP_KERNEL/InterpolationOptions.cxx index e89b6c070..540f50c0d 100644 --- a/src/INTERP_KERNEL/InterpolationOptions.cxx +++ b/src/INTERP_KERNEL/InterpolationOptions.cxx @@ -19,13 +19,10 @@ // Author : Anthony Geay (CEA/DEN) #include "InterpolationOptions.hxx" +#include "InterpKernelGeo2DPrecision.hxx" #include "InterpKernelException.hxx" -#include "NormalizedGeometricTypes" -#include -#include #include -#include const double INTERP_KERNEL::InterpolationOptions::DFT_MEDIAN_PLANE=0.5; @@ -168,7 +165,7 @@ bool INTERP_KERNEL::InterpolationOptions::setOptionInt(const std::string& key, i } else if(key==MEASURE_ABS_STR) { - bool const valBool=(value!=0); + bool valBool=(value!=0); setMeasureAbsStatus(valBool); return true; } diff --git a/src/INTERP_KERNEL/InterpolationOptions.hxx b/src/INTERP_KERNEL/InterpolationOptions.hxx index ff46b1e69..58e2f238d 100644 --- a/src/INTERP_KERNEL/InterpolationOptions.hxx +++ b/src/INTERP_KERNEL/InterpolationOptions.hxx @@ -22,7 +22,7 @@ #define __INTERPOLATIONOPTIONS_HXX__ #include "INTERPKERNELDefines.hxx" -#include "NormalizedGeometricTypes" +#include "NormalizedUnstructuredMesh.hxx" #include diff --git a/src/INTERP_KERNEL/InterpolationPlanar.hxx b/src/INTERP_KERNEL/InterpolationPlanar.hxx old mode 100644 new mode 100755 index 60ca49ef2..afe8b72dc --- a/src/INTERP_KERNEL/InterpolationPlanar.hxx +++ b/src/INTERP_KERNEL/InterpolationPlanar.hxx @@ -23,9 +23,8 @@ #include "Interpolation.hxx" #include "PlanarIntersector.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "InterpolationOptions.hxx" -#include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/InterpolationPlanar.txx b/src/INTERP_KERNEL/InterpolationPlanar.txx old mode 100644 new mode 100755 index 29fe3fbc8..65ab44f9c --- a/src/INTERP_KERNEL/InterpolationPlanar.txx +++ b/src/INTERP_KERNEL/InterpolationPlanar.txx @@ -22,38 +22,31 @@ #define __INTERPOLATIONPLANAR_TXX__ #include "InterpolationPlanar.hxx" - #include "Interpolation.txx" #include "InterpolationOptions.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "InterpolationUtils.hxx" - -#include "PlanarIntersectorP0P0.hxx" -#include "PlanarIntersectorP1P0.hxx" -#include "PlanarIntersectorP0P1.hxx" -#include "PlanarIntersectorP1P1.hxx" -#include "PlanarIntersectorP0P1Bary.hxx" -#include "PlanarIntersectorP1P0Bary.hxx" - +#include "PlanarIntersector.hxx" #include "PlanarIntersector.txx" +#include "TriangulationIntersector.hxx" #include "TriangulationIntersector.txx" +#include "ConvexIntersector.hxx" #include "ConvexIntersector.txx" +#include "Geometric2DIntersector.hxx" #include "Geometric2DIntersector.txx" +#include "PointLocator2DIntersector.hxx" #include "PointLocator2DIntersector.txx" +#include "PlanarIntersectorP0P1PL.hxx" #include "PlanarIntersectorP0P1PL.txx" +#include "PlanarIntersectorP1P0PL.hxx" #include "PlanarIntersectorP1P0PL.txx" +#include "PlanarIntersectorP1P1PL.hxx" #include "PlanarIntersectorP1P1PL.txx" +#include "MappedBarycentric2DIntersectorP1P1.hxx" #include "MappedBarycentric2DIntersectorP1P1.txx" #include "VectorUtils.hxx" #include "BBTree.txx" -#include -#include -#include #include -#include #include -#include namespace INTERP_KERNEL { @@ -120,7 +113,7 @@ namespace INTERP_KERNEL typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; - long const global_start =clock(); + long global_start =clock(); std::size_t counter=0; /***********************************************************/ /* Check both meshes are made of triangles and quadrangles */ @@ -379,24 +372,24 @@ namespace INTERP_KERNEL /* Instantiate the intersector and initialise the result vector */ /****************************************************************/ - long const start_filtering=clock(); + long start_filtering=clock(); std::vector bbox; intersector->createBoundingBoxes(myMeshS,bbox); // create the bounding boxes performAdjustmentOfBB(intersector,bbox); - const double *bboxPtr=nullptr; + const double *bboxPtr=0; if(nbMailleS>0) bboxPtr=&bbox[0]; BBTree my_tree(bboxPtr, 0, 0,nbMailleS);//creating the search structure - long const end_filtering=clock(); + long end_filtering=clock(); result.resize(intersector->getNumberOfRowsOfResMatrix());//on initialise. /****************************************************/ /* Loop on the target cells - core of the algorithm */ /****************************************************/ - long const start_intersection=clock(); + long start_intersection=clock(); ConnType nbelem_type=myMeshT.getNumberOfElements(); const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr(); for(ConnType iT=0; iT=1) { - long const end_intersection=clock(); + long end_intersection=clock(); std::cout << "Filtering time= " << end_filtering-start_filtering << std::endl; std::cout << "Intersection time= " << end_intersection-start_intersection << std::endl; - long const global_end =clock(); + long global_end =clock(); std::cout << "Number of computed intersections = " << counter << std::endl; std::cout << "Global time= " << global_end - global_start << std::endl; } diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index c51c43b9f..901b27a23 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -21,19 +21,16 @@ #ifndef __INTERPOLATIONUTILS_HXX__ #define __INTERPOLATIONUTILS_HXX__ +#include "INTERPKERNELDefines.hxx" #include "InterpKernelException.hxx" -#include "MCIdType.hxx" #include "VolSurfUser.hxx" -#include "NormalizedGeometricTypes" #include "NormalizedUnstructuredMesh.hxx" -#include #include -#include #include #include -#include +#include #include #include #include @@ -73,8 +70,8 @@ namespace INTERP_KERNEL inline double Surf_Tri(const double *P_1,const double *P_2,const double *P_3) { - double const A=(P_3[1]-P_1[1])*(P_2[0]-P_1[0])-(P_2[1]-P_1[1])*(P_3[0]-P_1[0]); - double const Surface = 0.5*fabs(A); + double A=(P_3[1]-P_1[1])*(P_2[0]-P_1[0])-(P_2[1]-P_1[1])*(P_3[0]-P_1[0]); + double Surface = 0.5*fabs(A); return Surface; } @@ -90,7 +87,7 @@ namespace INTERP_KERNEL const double *P_2, const double *P_3) { - double const mon_det=(P_1[0]-P_3[0])*(P_2[1]-P_3[1])-(P_2[0]-P_3[0])*(P_1[1]-P_3[1]); + double mon_det=(P_1[0]-P_3[0])*(P_2[1]-P_3[1])-(P_2[0]-P_3[0])*(P_1[1]-P_3[1]); return mon_det; } @@ -99,8 +96,8 @@ namespace INTERP_KERNEL inline double norme_vecteur(const double* P_1,const double* P_2) { - double const X=P_1[0]-P_2[0]; - double const Y=P_1[1]-P_2[1]; + double X=P_1[0]-P_2[0]; + double Y=P_1[1]-P_2[1]; return sqrt(X*X+Y*Y); } @@ -120,18 +117,18 @@ namespace INTERP_KERNEL { std::vector Vect; - double const P1_P2=norme_vecteur(P_1,P_2); - double const P2_P3=norme_vecteur(P_2,P_3); - double const P3_P1=norme_vecteur(P_3,P_1); + double P1_P2=norme_vecteur(P_1,P_2); + double P2_P3=norme_vecteur(P_2,P_3); + double P3_P1=norme_vecteur(P_3,P_1); - double const N=P1_P2*P1_P2+P3_P1*P3_P1-P2_P3*P2_P3; - double const D=2.0*P1_P2*P3_P1; + double N=P1_P2*P1_P2+P3_P1*P3_P1-P2_P3*P2_P3; + double D=2.0*P1_P2*P3_P1; double COS=N/D; if (COS>1.0) COS=1.0; if (COS<-1.0) COS=-1.0; Vect.push_back(COS); - double const V=mon_determinant(P_2,P_3,P_1); - double const D_1=P1_P2*P3_P1; + double V=mon_determinant(P_2,P_3,P_1); + double D_1=P1_P2*P3_P1; double SIN=V/D_1; if (SIN>1.0) SIN=1.0; if (SIN<-1.0) SIN=-1.0; @@ -200,7 +197,7 @@ namespace INTERP_KERNEL inline std::vector bary_poly(const std::vector& V) { std::vector Bary; - std::size_t const taille=V.size(); + std::size_t taille=V.size(); double x=0; double y=0; @@ -209,8 +206,8 @@ namespace INTERP_KERNEL x=x+V[2*i]; y=y+V[2*i+1]; } - double const A=2*x/(static_cast(taille)); - double const B=2*y/(static_cast(taille)); + double A=2*x/(static_cast(taille)); + double B=2*y/(static_cast(taille)); Bary.push_back(A);//taille vecteur=2*nb de points. Bary.push_back(B); @@ -291,7 +288,7 @@ namespace INTERP_KERNEL double max = std::fabs( M[ iR[i] ][i] ); for ( int r = i+1; r < (int)nbRow; ++r ) { - double const m = std::fabs( M[ iR[r] ][i] ); + double m = std::fabs( M[ iR[r] ][i] ); if ( m > max ) { max = m; @@ -308,7 +305,7 @@ namespace INTERP_KERNEL for ( int r = i+1; r < (int)nbRow; ++r ) { double* mRow = M[ iR[r] ]; - double const coef = mRow[ i ] / tUpRow[ i ]; + double coef = mRow[ i ] / tUpRow[ i ]; for ( int c = i+1; c < nbCol; ++c ) mRow[ c ] -= tUpRow[ c ] * coef; } @@ -407,7 +404,7 @@ namespace INTERP_KERNEL T11 = triaCoords[0]-triaCoords[2*SPACEDIM], T12 = triaCoords[SPACEDIM]-triaCoords[2*SPACEDIM], T21 = triaCoords[1]-triaCoords[2*SPACEDIM+1], T22 = triaCoords[SPACEDIM+1]-triaCoords[2*SPACEDIM+1]; // matrix determinant - double const Tdet = T11*T22 - T12*T21; + double Tdet = T11*T22 - T12*T21; if ( fabs( Tdet ) < std::numeric_limits::min() ) { bc[0]=1; bc[1]=0; bc[2]=0; return; @@ -424,7 +421,7 @@ namespace INTERP_KERNEL inline void barycentric_coords_seg2(const std::vector& n, const double *p, double *bc) { - double const delta=n[0][0]-n[1][0]; + double delta=n[0][0]-n[1][0]; bc[0]=fabs((*p-n[1][0])/delta); bc[1]=fabs((*p-n[0][0])/delta); } @@ -437,7 +434,7 @@ namespace INTERP_KERNEL T11 = n[0][_XX]-n[2][_XX], T12 = n[1][_XX]-n[2][_XX], T21 = n[0][_YY]-n[2][_YY], T22 = n[1][_YY]-n[2][_YY]; // matrix determinant - double const Tdet = T11*T22 - T12*T21; + double Tdet = T11*T22 - T12*T21; if ( (std::fabs( Tdet) ) < (std::numeric_limits::min()) ) { bc[0]=1; bc[1]=bc[2]=0; // no solution @@ -615,11 +612,11 @@ namespace INTERP_KERNEL inline bool IsPointOn3DSeg(const double segStart[3], const double segStop[3], const double point[3], double eps, double& bc0, double& bc1) { double AB[3]={segStop[0]-segStart[0],segStop[1]-segStart[1],segStop[2]-segStart[2]},AP[3]={point[0]-segStart[0],point[1]-segStart[1],point[2]-segStart[2]}; - double const l_AB(sqrt(AB[0]*AB[0]+AB[1]*AB[1]+AB[2]*AB[2])); + double l_AB(sqrt(AB[0]*AB[0]+AB[1]*AB[1]+AB[2]*AB[2])); double AP_dot_AB((AP[0]*AB[0]+AP[1]*AB[1]+AP[2]*AB[2])/(l_AB*l_AB)); - double const projOfPOnAB[3]={segStart[0]+AP_dot_AB*AB[0],segStart[1]+AP_dot_AB*AB[1],segStart[2]+AP_dot_AB*AB[2]}; - double const V_dist_P_AB[3]={point[0]-projOfPOnAB[0],point[1]-projOfPOnAB[1],point[2]-projOfPOnAB[2]}; - double const dist_P_AB(sqrt(V_dist_P_AB[0]*V_dist_P_AB[0]+V_dist_P_AB[1]*V_dist_P_AB[1]+V_dist_P_AB[2]*V_dist_P_AB[2])); + double projOfPOnAB[3]={segStart[0]+AP_dot_AB*AB[0],segStart[1]+AP_dot_AB*AB[1],segStart[2]+AP_dot_AB*AB[2]}; + double V_dist_P_AB[3]={point[0]-projOfPOnAB[0],point[1]-projOfPOnAB[1],point[2]-projOfPOnAB[2]}; + double dist_P_AB(sqrt(V_dist_P_AB[0]*V_dist_P_AB[0]+V_dist_P_AB[1]*V_dist_P_AB[1]+V_dist_P_AB[2]*V_dist_P_AB[2])); if(dist_P_AB>=eps) return false;//to far from segment [segStart,segStop] if(AP_dot_AB<-eps || AP_dot_AB>1.+eps) @@ -649,22 +646,22 @@ namespace INTERP_KERNEL */ inline void quad_mapped_coords(const std::vector& n, const double *p, double *bc) { - double const prec = 1.0e-14; + double prec = 1.0e-14; enum { _XX=0, _YY, _ZZ }; if(n.size() != 4) throw INTERP_KERNEL::Exception("INTERP_KERNEL::quad_mapped_coords : unrecognized geometric type! Only QUAD4 supported."); - double const A[2] = {n[1][_XX] - n[0][_XX], n[1][_YY] - n[0][_YY]}; - double const B[2] = {n[2][_XX] - n[0][_XX], n[2][_YY] - n[0][_YY]}; - double const C[2] = {n[3][_XX] - n[0][_XX], n[3][_YY] - n[0][_YY]}; - double const N[2] = {B[_XX] - A[_XX] - C[_XX], B[_YY] - A[_YY] - C[_YY]}; - double const P[2] = {p[_XX] - n[0][_XX], p[_YY] - n[0][_YY]}; + double A[2] = {n[1][_XX] - n[0][_XX], n[1][_YY] - n[0][_YY]}; + double B[2] = {n[2][_XX] - n[0][_XX], n[2][_YY] - n[0][_YY]}; + double C[2] = {n[3][_XX] - n[0][_XX], n[3][_YY] - n[0][_YY]}; + double N[2] = {B[_XX] - A[_XX] - C[_XX], B[_YY] - A[_YY] - C[_YY]}; + double P[2] = {p[_XX] - n[0][_XX], p[_YY] - n[0][_YY]}; // degenerated case: a rectangle: if (fabs(N[0]) < prec && fabs(N[1]) < prec) { - double const det = C[0]*A[1] -C[1]*A[0]; + double det = C[0]*A[1] -C[1]*A[0]; if (fabs(det) < prec) throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: quad_mapped_coords() has a degenerated 2x2 system!"); bc[0] = (P[0]*A[1]-P[1]*A[0])/det; @@ -686,7 +683,7 @@ namespace INTERP_KERNEL c = -P[0]*A[1] + P[1]*A[0]; cas1 = false; } - double const delta = b*b - 4.0*a*c; + double delta = b*b - 4.0*a*c; if (delta < 0.0) throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: quad_mapped_coords(): imaginary solutions!"); bc[1] = 0.5*(-b+sqrt(delta))/a; @@ -696,7 +693,7 @@ namespace INTERP_KERNEL throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: quad_mapped_coords(): point doesn't seem to be in quad4!"); if (cas1) { - double const denom = C[0]+bc[1]*N[0]; + double denom = C[0]+bc[1]*N[0]; if (fabs(denom) < prec) throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: quad_mapped_coords(): point doesn't seem to be in quad4!"); bc[0] = (P[0]-bc[1]*A[0])/denom; @@ -706,7 +703,7 @@ namespace INTERP_KERNEL else { bc[0] = bc[1]; - double const denom = A[1]+bc[0]*N[1]; + double denom = A[1]+bc[0]*N[1]; if (fabs(denom) < prec) throw INTERP_KERNEL::Exception("MappedBarycentric intersection type: cuboid_mapped_coord(): point doesn't seem to be in quad4!"); bc[1] = (P[1]-bc[0]*C[1])/denom; @@ -736,7 +733,7 @@ namespace INTERP_KERNEL inline void cuboid_mapped_coords(const std::vector& n, const double *p, double *bc) { - double const prec = 1.0e-14; + double prec = 1.0e-14; enum { _XX=0, _YY }; if (n.size() != 8) throw INTERP_KERNEL::Exception("INTERP_KERNEL::cuboid_mapped_coords: unrecognized geometric type! Only HEXA8 supported."); @@ -769,7 +766,7 @@ namespace INTERP_KERNEL double Surface=0; for(unsigned long i=0; i<(Poly.size())/2-2; i++) { - double const Surf=Surf_Tri( &Poly[0],&Poly[2*(i+1)],&Poly[2*(i+2)] ); + double Surf=Surf_Tri( &Poly[0],&Poly[2*(i+1)],&Poly[2*(i+2)] ); Surface=Surface + Surf ; } return Surface ; @@ -787,9 +784,9 @@ namespace INTERP_KERNEL { bool A=false; - double const det_1=mon_determinant(P_1,P_3,P_0); - double const det_2=mon_determinant(P_3,P_2,P_0); - double const det_3=mon_determinant(P_2,P_1,P_0); + double det_1=mon_determinant(P_1,P_3,P_0); + double det_2=mon_determinant(P_3,P_2,P_0); + double det_3=mon_determinant(P_2,P_1,P_0); if( (det_1>=-eps && det_2>=-eps && det_3>=-eps) || (det_1<=eps && det_2<=eps && det_3<=eps) ) { A=true; @@ -805,7 +802,7 @@ namespace INTERP_KERNEL inline void verif_point_dans_vect(const double* P, std::vector& V, double absolute_precision ) { - std::size_t const taille=V.size(); + std::size_t taille=V.size(); bool isPresent=false; for(std::size_t i=0;i& V, double dim_caracteristic, double precision) { - double const absolute_precision = precision*dim_caracteristic; - bool const A_1=INTERP_KERNEL::point_dans_triangle(P_1,P_4,P_5,P_6,absolute_precision); + double absolute_precision = precision*dim_caracteristic; + bool A_1=INTERP_KERNEL::point_dans_triangle(P_1,P_4,P_5,P_6,absolute_precision); if(A_1) verif_point_dans_vect(P_1,V,absolute_precision); - bool const A_2=INTERP_KERNEL::point_dans_triangle(P_2,P_4,P_5,P_6,absolute_precision); + bool A_2=INTERP_KERNEL::point_dans_triangle(P_2,P_4,P_5,P_6,absolute_precision); if(A_2) verif_point_dans_vect(P_2,V,absolute_precision); - bool const A_3=INTERP_KERNEL::point_dans_triangle(P_3,P_4,P_5,P_6,absolute_precision); + bool A_3=INTERP_KERNEL::point_dans_triangle(P_3,P_4,P_5,P_6,absolute_precision); if(A_3) verif_point_dans_vect(P_3,V,absolute_precision); } @@ -859,17 +856,17 @@ namespace INTERP_KERNEL double dim_caracteristic, double precision) { // calcul du determinant de P_1P_2 et P_3P_4. - double const det=(P_2[0]-P_1[0])*(P_4[1]-P_3[1])-(P_4[0]-P_3[0])*(P_2[1]-P_1[1]); + double det=(P_2[0]-P_1[0])*(P_4[1]-P_3[1])-(P_4[0]-P_3[0])*(P_2[1]-P_1[1]); - double const absolute_precision = dim_caracteristic*precision; + double absolute_precision = dim_caracteristic*precision; if(fabs(det)>absolute_precision) { - double const k_1=-((P_3[1]-P_4[1])*(P_3[0]-P_1[0])+(P_4[0]-P_3[0])*(P_3[1]-P_1[1]))/det; + double k_1=-((P_3[1]-P_4[1])*(P_3[0]-P_1[0])+(P_4[0]-P_3[0])*(P_3[1]-P_1[1]))/det; if (k_1 >= -absolute_precision && k_1 <= 1+absolute_precision) //if( k_1 >= -precision && k_1 <= 1+precision) { - double const k_2= ((P_1[1]-P_2[1])*(P_1[0]-P_3[0])+(P_2[0]-P_1[0])*(P_1[1]-P_3[1]))/det; + double k_2= ((P_1[1]-P_2[1])*(P_1[0]-P_3[0])+(P_2[0]-P_1[0])*(P_1[1]-P_3[1]))/det; if (k_2 >= -absolute_precision && k_2 <= 1+absolute_precision) //if( k_2 >= -precision && k_2 <= 1+precision) @@ -915,7 +912,7 @@ namespace INTERP_KERNEL inline void verif_maill_dans_vect(int Num, std::vector& V) { - std::size_t const taille=V.size(); + std::size_t taille=V.size(); int A=0; for(std::size_t i=0;itheta1, std::pair theta2) const { - double const norm1 = sqrt(theta1.first*theta1.first +theta1.second*theta1.second); - double const norm2 = sqrt(theta2.first*theta2.first +theta2.second*theta2.second); + double norm1 = sqrt(theta1.first*theta1.first +theta1.second*theta1.second); + double norm2 = sqrt(theta2.first*theta2.first +theta2.second*theta2.second); - double const epsilon = 1.e-12; + double epsilon = 1.e-12; if( norm1 < epsilon || norm2 < epsilon ) std::cout << "Warning InterpolationUtils.hxx: AngleLess : Vector with zero norm, cannot define the angle !!!! " << std::endl; @@ -958,7 +955,7 @@ namespace INTERP_KERNEL inline std::vector reconstruct_polygon(const std::vector& V) { - int const taille((int)V.size()); + int taille((int)V.size()); //VB : why 6 ? @@ -966,8 +963,8 @@ namespace INTERP_KERNEL {return V;} else { - auto *COS=new double[taille/2]; - auto *SIN=new double[taille/2]; + double *COS=new double[taille/2]; + double *SIN=new double[taille/2]; //double *angle=new double[taille/2]; std::vector Bary=bary_poly(V); COS[0]=1.0; @@ -1004,7 +1001,7 @@ namespace INTERP_KERNEL // } for(micossin=CosSin.begin();micossin!=CosSin.end();micossin++) { - int const j=(*micossin).second; + int j=(*micossin).second; Pt_ordonne.push_back(V[2*j]); Pt_ordonne.push_back(V[2*j+1]); } @@ -1027,9 +1024,9 @@ namespace INTERP_KERNEL for (int i=0; ibb[1])?x:bb[1]; bb[2]=(y sw(3,false); double inpVect2[3]; std::transform(inpVect,inpVect + 3,inpVect2,[](double c){return fabs(c);}); - std::size_t const posMin(std::distance(inpVect2,std::min_element(inpVect2,inpVect2+3))); + std::size_t posMin(std::distance(inpVect2,std::min_element(inpVect2,inpVect2+3))); sw[posMin]=true; std::size_t posMax(std::distance(inpVect2,std::max_element(inpVect2,inpVect2+3))); if(posMax==posMin) { posMax=(posMin+1)%3; } sw[posMax]=true; - std::size_t const posMid(std::distance(sw.begin(),std::find(sw.begin(),sw.end(),false))); + std::size_t posMid(std::distance(sw.begin(),std::find(sw.begin(),sw.end(),false))); outVect[posMin]=0.; outVect[posMid]=1.; outVect[posMax]=-inpVect[posMid]/inpVect[posMax]; } @@ -1157,7 +1154,7 @@ namespace INTERP_KERNEL /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/ /* Computes the geometric angle (in [0,Pi]) between two non zero vectors AB and AC */ /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/ - template inline double angle(const double * A, const double * B, const double * C, double * /*n*/) + template inline double angle(const double * A, const double * B, const double * C, double * n) { double AB[dim]; double AC[dim]; @@ -1173,7 +1170,7 @@ namespace INTERP_KERNEL double AB_dot_AC=dotprod(AB,AC); for(int idim =0; idim(orthAB); return 2*atan2(numer,denom); @@ -1302,13 +1299,13 @@ namespace INTERP_KERNEL */ inline double TripleProduct(const double *A, const double *B, const double *C, const double *X) { - double const XA[3]={ A[0]-X[0], A[1]-X[1], A[2]-X[2] }; - double const XB[3]={ B[0]-X[0], B[1]-X[1], B[2]-X[2] }; - double const XC[3]={ C[0]-X[0], C[1]-X[1], C[2]-X[2] }; + double XA[3]={ A[0]-X[0], A[1]-X[1], A[2]-X[2] }; + double XB[3]={ B[0]-X[0], B[1]-X[1], B[2]-X[2] }; + double XC[3]={ C[0]-X[0], C[1]-X[1], C[2]-X[2] }; - double const XA_cross_XB[3] = {XA[1]*XB[2]-XA[2]*XB[1], XA[2]*XB[0]-XA[0]*XB[2], XA[0]*XB[1]-XA[1]*XB[0]}; + double XA_cross_XB[3] = {XA[1]*XB[2]-XA[2]*XB[1], XA[2]*XB[0]-XA[0]*XB[2], XA[0]*XB[1]-XA[1]*XB[0]}; // norm is equal to double the area of the triangle - double const norm = std::sqrt(XA_cross_XB[0]*XA_cross_XB[0]+XA_cross_XB[1]*XA_cross_XB[1]+XA_cross_XB[2]*XA_cross_XB[2]); + double norm = std::sqrt(XA_cross_XB[0]*XA_cross_XB[0]+XA_cross_XB[1]*XA_cross_XB[1]+XA_cross_XB[2]*XA_cross_XB[2]); return ( XA_cross_XB[0]*XC[0]+ XA_cross_XB[1]*XC[1] + XA_cross_XB[2]*XC[2] ) / norm; } diff --git a/src/INTERP_KERNEL/Intersector3D.hxx b/src/INTERP_KERNEL/Intersector3D.hxx index cb58f752a..760cab8f5 100644 --- a/src/INTERP_KERNEL/Intersector3D.hxx +++ b/src/INTERP_KERNEL/Intersector3D.hxx @@ -21,9 +21,7 @@ #ifndef __INTERSECTOR3D_HXX__ #define __INTERSECTOR3D_HXX__ -#include "TargetIntersector.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include +#include "TargetIntersector.txx" namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: Intersector3D(const MyMeshType& targetMesh, const MyMeshType& srcMesh); diff --git a/src/INTERP_KERNEL/Intersector3D.txx b/src/INTERP_KERNEL/Intersector3D.txx index 34757cb8b..2bd2f3fe5 100644 --- a/src/INTERP_KERNEL/Intersector3D.txx +++ b/src/INTERP_KERNEL/Intersector3D.txx @@ -21,10 +21,8 @@ #define __INTERSECTOR3D_TXX__ #include "Intersector3D.hxx" -#include "InterpolationUtils.hxx" #include -#include namespace INTERP_KERNEL { @@ -41,7 +39,7 @@ namespace INTERP_KERNEL { ConnType nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT); coordsT.resize(SPACEDIM*nbNodesT); - auto iter=coordsT.begin(); + std::vector::iterator iter=coordsT.begin(); for (ConnType iT=0; iT::iterator iter=coordsS.begin(); for (ConnType iS=0; iS +#include "TargetIntersector.txx" +#include "NormalizedUnstructuredMesh.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/IntersectorCU.txx b/src/INTERP_KERNEL/IntersectorCU.txx index 7bb1e864f..ffe962629 100644 --- a/src/INTERP_KERNEL/IntersectorCU.txx +++ b/src/INTERP_KERNEL/IntersectorCU.txx @@ -24,9 +24,6 @@ #define __IntersectorCU_TXX__ #include "IntersectorCU.hxx" -#include "InterpolationUtils.hxx" -#include -#include // convert index "From Mesh Index" #define _FMIU(i) OTT::ind2C((i)) @@ -77,7 +74,8 @@ namespace INTERP_KERNEL _CU_TEMPLATE _INTERSECTOR_CU_::~IntersectorCU() - = default; + { + } //================================================================================ /*! @@ -102,7 +100,7 @@ namespace INTERP_KERNEL const double* coord_node=_coordsU+SPACEDIM*(_FMCOO( _connectU[_FMCON (_connIndexU[_FMIU(icell)]+i)])); for(int idim=0; idimbb[2*idim+1])?x:bb[2*idim+1]; } diff --git a/src/INTERP_KERNEL/IntersectorCU1D.hxx b/src/INTERP_KERNEL/IntersectorCU1D.hxx index 47dcbb592..bf116b7eb 100644 --- a/src/INTERP_KERNEL/IntersectorCU1D.hxx +++ b/src/INTERP_KERNEL/IntersectorCU1D.hxx @@ -25,7 +25,6 @@ #define __IntersectorCU1D_HXX__ #include "IntersectorCU.hxx" -#include namespace INTERP_KERNEL { @@ -33,8 +32,8 @@ namespace INTERP_KERNEL class IntersectorCU1D : public IntersectorCU > { public: - using UConnType = typename MyUMeshType::MyConnType; - using CConnType = typename MyCMeshType::MyConnType; + typedef typename MyUMeshType::MyConnType UConnType; + typedef typename MyCMeshType::MyConnType CConnType; public: IntersectorCU1D(const MyCMeshType& meshS, const MyUMeshType& meshT); ~IntersectorCU1D(); diff --git a/src/INTERP_KERNEL/IntersectorCU1D.txx b/src/INTERP_KERNEL/IntersectorCU1D.txx index 38a77306c..37cecba18 100644 --- a/src/INTERP_KERNEL/IntersectorCU1D.txx +++ b/src/INTERP_KERNEL/IntersectorCU1D.txx @@ -23,12 +23,8 @@ #ifndef __IntersectorCU1D_TXX__ #define __IntersectorCU1D_TXX__ -#include "IntersectorCU.hxx" #include "IntersectorCU1D.hxx" #include "IntersectorCU.txx" -#include "InterpKernelException.hxx" -#include -#include #define IntersectorCU1D_TEMPLATE template #define INTERSECTOR_CU1D IntersectorCU1D @@ -60,7 +56,8 @@ namespace INTERP_KERNEL IntersectorCU1D_TEMPLATE INTERSECTOR_CU1D::~IntersectorCU1D() - = default; + { + } //================================================================================ /*! @@ -78,7 +75,7 @@ namespace INTERP_KERNEL const double* coordsC = & _INTER_CU::_coordsC[0][ _FMIC(icellS[0]) ]; - double const res = std::min( coordsU[1], coordsC[1] ) - std::max( coordsU[0], coordsC[0] ); + double res = std::min( coordsU[1], coordsC[1] ) - std::max( coordsU[0], coordsC[0] ); return res; } } diff --git a/src/INTERP_KERNEL/IntersectorCU2D.hxx b/src/INTERP_KERNEL/IntersectorCU2D.hxx index b58e44ee1..17f79c9d9 100644 --- a/src/INTERP_KERNEL/IntersectorCU2D.hxx +++ b/src/INTERP_KERNEL/IntersectorCU2D.hxx @@ -25,9 +25,6 @@ #define __IntersectorCU2D_HXX__ #include "IntersectorCU.hxx" -#include "PlanarIntersectorP0P0.hxx" -#include "TriangulationIntersector.hxx" -#include namespace INTERP_KERNEL { @@ -35,8 +32,8 @@ namespace INTERP_KERNEL class IntersectorCU2D : public IntersectorCU > { public: - using UConnType = typename MyUMeshType::MyConnType; - using CConnType = typename MyCMeshType::MyConnType; + typedef typename MyUMeshType::MyConnType UConnType; + typedef typename MyCMeshType::MyConnType CConnType; public: IntersectorCU2D(const MyCMeshType& meshS, const MyUMeshType& meshT); double intersectGeometry(UConnType icellT, const std::vector& icellC); diff --git a/src/INTERP_KERNEL/IntersectorCU2D.txx b/src/INTERP_KERNEL/IntersectorCU2D.txx index eec35088e..90a0c06bd 100644 --- a/src/INTERP_KERNEL/IntersectorCU2D.txx +++ b/src/INTERP_KERNEL/IntersectorCU2D.txx @@ -23,13 +23,8 @@ #ifndef __IntersectorCU2D_TXX__ #define __IntersectorCU2D_TXX__ -#include "IntersectorCU.hxx" #include "IntersectorCU2D.hxx" #include "IntersectorCU.txx" -#include "InterpKernelException.hxx" -#include "CellModel.hxx" -#include "NormalizedGeometricTypes" -#include #define IntersectorCU2D_TEMPLATE template #define INTERSECTOR_CU2D IntersectorCU2D diff --git a/src/INTERP_KERNEL/IntersectorCU3D.hxx b/src/INTERP_KERNEL/IntersectorCU3D.hxx index db5fc510f..0b6259d3b 100644 --- a/src/INTERP_KERNEL/IntersectorCU3D.hxx +++ b/src/INTERP_KERNEL/IntersectorCU3D.hxx @@ -26,7 +26,6 @@ #include "IntersectorCU.hxx" #include "SplitterTetra.hxx" -#include namespace INTERP_KERNEL { @@ -36,8 +35,8 @@ namespace INTERP_KERNEL class IntersectorCU3D : public IntersectorCU > { public: - using UConnType = typename MyUMeshType::MyConnType; - using CConnType = typename MyCMeshType::MyConnType; + typedef typename MyUMeshType::MyConnType UConnType; + typedef typename MyCMeshType::MyConnType CConnType; public: IntersectorCU3D(const MyCMeshType& meshS, const MyUMeshType& meshT, SplittingPolicy splitting_policy); ~IntersectorCU3D(); @@ -45,8 +44,8 @@ namespace INTERP_KERNEL private: - using TSplitter = SplitterTetra2; - using TTetra = SplitterTetra<_Cartesian3D2UnstructHexMesh>; + typedef SplitterTetra2 TSplitter; + typedef SplitterTetra <_Cartesian3D2UnstructHexMesh > TTetra; _Cartesian3D2UnstructHexMesh* _uHexMesh; TSplitter* _split; }; diff --git a/src/INTERP_KERNEL/IntersectorCU3D.txx b/src/INTERP_KERNEL/IntersectorCU3D.txx index 22c00ac47..ae8801905 100644 --- a/src/INTERP_KERNEL/IntersectorCU3D.txx +++ b/src/INTERP_KERNEL/IntersectorCU3D.txx @@ -23,14 +23,9 @@ #ifndef __IntersectorCU3D_TXX__ #define __IntersectorCU3D_TXX__ -#include "IntersectorCU.hxx" #include "IntersectorCU3D.hxx" #include "IntersectorCU.txx" -#include "MCIdType.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "InterpKernelException.hxx" -#include "NormalizedGeometricTypes" -#include "BoundingBox.hxx" +#include "SplitterTetra.txx" #define IntersectorCU3D_TEMPLATE template #define INTERSECTOR_CU3D IntersectorCU3D @@ -50,7 +45,7 @@ namespace INTERP_KERNEL public: static const int MY_SPACEDIM=3; static const int MY_MESHDIM=3; - using MyConnType = mcIdType; + typedef mcIdType MyConnType; static const NumberingPolicy My_numPol=ALL_C_MODE; _Cartesian3D2UnstructHexMesh(const double * coords[3]): _coordsC(coords) {} @@ -85,8 +80,8 @@ namespace INTERP_KERNEL boundingBox[BoundingBox::ZMIN] = _coordsU[2]; boundingBox[BoundingBox::ZMAX] = _coordsU[2+4*MY_SPACEDIM]; } - NormalizedCellType getTypeOfElement(mcIdType /*eltId*/) const { return NORM_HEXA8; } - mcIdType getNumberOfNodesOfElement(mcIdType /*eltId*/) const { return 8; } + NormalizedCellType getTypeOfElement(mcIdType eltId) const { return NORM_HEXA8; } + mcIdType getNumberOfNodesOfElement(mcIdType eltId) const { return 8; } mcIdType getNumberOfElements() const { return 1; } mcIdType getNumberOfNodes() const { return 8; } const double *getCoordinatesPtr() const { return _coordsU; } @@ -125,7 +120,7 @@ namespace INTERP_KERNEL IntersectorCU3D_TEMPLATE INTERSECTOR_CU3D::~IntersectorCU3D() { - delete _uHexMesh; _uHexMesh=nullptr; + delete _uHexMesh; _uHexMesh=0; delete _split; _split=0; } diff --git a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelDenseMatrix.cxx b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelDenseMatrix.cxx index e0c8f7414..8c16a79c1 100644 --- a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelDenseMatrix.cxx +++ b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelDenseMatrix.cxx @@ -17,7 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "INTERPKERNELDefines.hxx" #include "InterpKernelDenseMatrix.txx" template class INTERPKERNEL_EXPORT INTERP_KERNEL::DenseMatrixT; diff --git a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelLUDecomp.cxx b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelLUDecomp.cxx index c357392d5..9dd92e327 100644 --- a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelLUDecomp.cxx +++ b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelLUDecomp.cxx @@ -20,12 +20,9 @@ // Implementation coming from Numerical Recipes in C of 1994 (version 2.04) #include "InterpKernelLUDecomp.hxx" -#include "InterpKernelDenseMatrix.hxx" #include "InterpKernelException.hxx" -#include "MCIdType.hxx" #include -#include #include using namespace INTERP_KERNEL; diff --git a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelLUDecomp.hxx b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelLUDecomp.hxx index 562a61475..b5b4e3d2a 100644 --- a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelLUDecomp.hxx +++ b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelLUDecomp.hxx @@ -19,9 +19,7 @@ #pragma once -#include "INTERPKERNELDefines.hxx" #include "InterpKernelDenseMatrix.hxx" -#include "MCIdType.hxx" #include namespace INTERP_KERNEL diff --git a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelQRDecomp.cxx b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelQRDecomp.cxx index 8ea8e8126..0e8b6be38 100644 --- a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelQRDecomp.cxx +++ b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelQRDecomp.cxx @@ -20,13 +20,9 @@ // Implementation coming from Numerical Recipes in C of 1994 (version 2.04) #include "InterpKernelQRDecomp.hxx" -#include "InterpKernelDenseMatrix.hxx" #include "InterpKernelException.hxx" -#include "MCIdType.hxx" #include -#include -#include using namespace INTERP_KERNEL; diff --git a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelQRDecomp.hxx b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelQRDecomp.hxx index f7a0849b3..b9963e990 100644 --- a/src/INTERP_KERNEL/LinearAlgebra/InterpKernelQRDecomp.hxx +++ b/src/INTERP_KERNEL/LinearAlgebra/InterpKernelQRDecomp.hxx @@ -22,7 +22,6 @@ #pragma once #include "InterpKernelDenseMatrix.hxx" -#include "MCIdType.hxx" #include namespace INTERP_KERNEL diff --git a/src/INTERP_KERNEL/MCIdType.hxx b/src/INTERP_KERNEL/MCIdType.hxx index 4cacee15d..4d87d60b9 100644 --- a/src/INTERP_KERNEL/MCIdType.hxx +++ b/src/INTERP_KERNEL/MCIdType.hxx @@ -32,14 +32,14 @@ typedef std::int32_t mcIdType; #else -using mcIdType = std::int64_t; +typedef std::int64_t mcIdType; #endif #ifdef WIN32 typedef long long mcPyPtrType; #else -using mcPyPtrType = long; +typedef long mcPyPtrType; #endif template inline std::size_t ToSizeT(T val) diff --git a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.hxx b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.hxx index 019fdb675..4a4737869 100644 --- a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.hxx @@ -21,9 +21,7 @@ #ifndef __MappedBarycenter2DIntersectorP1P1_HXX__ #define __MappedBarycenter2DIntersectorP1P1_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: MappedBarycentric2DIntersectorP1P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation); diff --git a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx index 9be695bcc..8dc1cc360 100644 --- a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx @@ -21,14 +21,12 @@ #ifndef __MappedBarycentric2DIntersectorP1P1_TXX__ #define __MappedBarycentric2DIntersectorP1P1_TXX__ -#include "InterpolationUtils.hxx" #include "MappedBarycentric2DIntersectorP1P1.hxx" -#include "PlanarIntersector.hxx" -#include "NormalizedGeometricTypes" -#include "InterpKernelUtilities.hxx" +#include "PlanarIntersector.txx" +#include "CellModel.hxx" #include "PointLocatorAlgos.txx" -#include +#include "MeshUtils.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.hxx b/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.hxx index 9fb9a02ff..77ac2fd77 100644 --- a/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.hxx @@ -23,7 +23,7 @@ #include "Intersector3DP1P1.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.txx b/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.txx index 99a6bef68..cc8fd2e83 100644 --- a/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.txx @@ -21,16 +21,9 @@ #ifndef __MAPPEDBARYCENTRIC3DINTERSECTORP1P1_TXX__ #define __MAPPEDBARYCENTRIC3DINTERSECTORP1P1_TXX__ -#include "Intersector3DP1P1.txx" -#include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" #include "MappedBarycentric3DIntersectorP1P1.hxx" -#include "NormalizedGeometricTypes" -#include "CellModel.hxx" -#include "PointLocatorAlgos.txx" -#include -#include -#include +#include "Intersector3DP1P1.txx" +#include "MeshUtils.hxx" namespace INTERP_KERNEL { @@ -49,7 +42,8 @@ namespace INTERP_KERNEL template MappedBarycentric3DIntersectorP1P1::~MappedBarycentric3DIntersectorP1P1() - = default; + { + } /** * @param targetCell in C mode. diff --git a/src/INTERP_KERNEL/MeshElement.cxx b/src/INTERP_KERNEL/MeshElement.cxx index cc8883fd9..981b206ea 100644 --- a/src/INTERP_KERNEL/MeshElement.cxx +++ b/src/INTERP_KERNEL/MeshElement.cxx @@ -18,7 +18,6 @@ // #include "MeshElement.hxx" -#include "BoundingBox.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/MeshElement.hxx b/src/INTERP_KERNEL/MeshElement.hxx index ba15d3422..200c59540 100644 --- a/src/INTERP_KERNEL/MeshElement.hxx +++ b/src/INTERP_KERNEL/MeshElement.hxx @@ -46,7 +46,7 @@ namespace INTERP_KERNEL template void assign(const ConnType index, const MyMeshType& mesh); - ~MeshElement() = default; + ~MeshElement() { } nbnodesincelltype getNumberOfNodes() const { return _number; } @@ -56,7 +56,7 @@ namespace INTERP_KERNEL private: /// disallow copying - MeshElement(const MeshElement& elem) = delete; + MeshElement(const MeshElement& elem); nbnodesincelltype _number; diff --git a/src/INTERP_KERNEL/MeshElement.txx b/src/INTERP_KERNEL/MeshElement.txx old mode 100644 new mode 100755 index 5f662e0a5..a83d3b5da --- a/src/INTERP_KERNEL/MeshElement.txx +++ b/src/INTERP_KERNEL/MeshElement.txx @@ -19,16 +19,16 @@ #ifndef __MESHELEMENT_TXX__ #define __MESHELEMENT_TXX__ -#include "InterpolationUtils.hxx" -#include "InterpKernelException.hxx" #include "MeshElement.hxx" +#include "TetraAffineTransform.hxx" +#include "TransformedTriangle.hxx" #include "MeshUtils.hxx" #include "BoundingBox.hxx" #include +#include #include #include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/MeshRegion.hxx b/src/INTERP_KERNEL/MeshRegion.hxx index 944eb2c49..f00d767b0 100644 --- a/src/INTERP_KERNEL/MeshRegion.hxx +++ b/src/INTERP_KERNEL/MeshRegion.hxx @@ -22,6 +22,7 @@ #include "MeshElement.hxx" #include "BoundingBox.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include diff --git a/src/INTERP_KERNEL/MeshRegion.txx b/src/INTERP_KERNEL/MeshRegion.txx index f6de59a56..4496d91ed 100644 --- a/src/INTERP_KERNEL/MeshRegion.txx +++ b/src/INTERP_KERNEL/MeshRegion.txx @@ -19,13 +19,10 @@ #ifndef __MESHREGION_TXX__ #define __MESHREGION_TXX__ -#include "MeshElement.hxx" -#include "InterpolationUtils.hxx" -#include "BoundingBox.hxx" #include "MeshRegion.hxx" +#include "MeshElement.txx" #include "MeshUtils.hxx" -#include namespace INTERP_KERNEL { @@ -35,7 +32,7 @@ namespace INTERP_KERNEL * */ template - MeshRegion::MeshRegion():_box(nullptr) + MeshRegion::MeshRegion():_box(0) { } @@ -66,9 +63,9 @@ namespace INTERP_KERNEL const unsigned char numNodes = element->getNumberOfNodes(); const ConnType elemIdx = element->getIndex(); - if(_box == nullptr) + if(_box == 0) { - const auto** pts = new const double*[numNodes]; + const double** pts = new const double*[numNodes]; // get coordinates of the nodes of the element for(unsigned char i = 0 ; i < numNodes ; ++i) diff --git a/src/INTERP_KERNEL/MeshUtils.hxx b/src/INTERP_KERNEL/MeshUtils.hxx index a7c877b2c..072f0fcae 100644 --- a/src/INTERP_KERNEL/MeshUtils.hxx +++ b/src/INTERP_KERNEL/MeshUtils.hxx @@ -21,9 +21,6 @@ #define __MESHUTILS_HXX__ #include "InterpolationUtils.hxx" -#include "NormalizedGeometricTypes" -#include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/OrientationInverter.cxx b/src/INTERP_KERNEL/OrientationInverter.cxx index aca70c2e4..8075c313c 100644 --- a/src/INTERP_KERNEL/OrientationInverter.cxx +++ b/src/INTERP_KERNEL/OrientationInverter.cxx @@ -21,11 +21,7 @@ #include "OrientationInverter.hxx" #include "InterpKernelException.hxx" #include "CellModel.hxx" -#include "NormalizedGeometricTypes" -#include "MCIdType.hxx" -#include -#include #include #include @@ -102,7 +98,7 @@ void OrientationInverter2DLinear::operateAndShutUp(mcIdType *beginPt) const void OrientationInverter2DQuadratic::operateAndShutUp(mcIdType *beginPt) const { - int const nbNodes(getNbNodes()); + int nbNodes(getNbNodes()); std::reverse(beginPt+1,beginPt+nbNodes/2); std::reverse(beginPt+nbNodes/2,beginPt+nbNodes); } @@ -114,7 +110,7 @@ void OrientationInverterPolygon::operate(mcIdType *beginPt, mcIdType *endPt) con void OrientationInverterQPolygon::operate(mcIdType *beginPt, mcIdType *endPt) const { - std::size_t const sz(std::distance(beginPt,endPt)); + std::size_t sz(std::distance(beginPt,endPt)); std::reverse(beginPt+1,beginPt+sz/2); std::reverse(beginPt+sz/2,endPt); } @@ -145,7 +141,7 @@ void OrientationInverterPyra13::operateAndShutUp(mcIdType *beginPt) const void OrientationInverter3DExtrusionLinear::operateAndShutUp(mcIdType *beginPt) const { - int const nbNodes(getNbNodes()); + int nbNodes(getNbNodes()); std::reverse(beginPt+1,beginPt+nbNodes/2); std::reverse(beginPt+nbNodes/2+1,beginPt+nbNodes); } diff --git a/src/INTERP_KERNEL/OrientationInverter.hxx b/src/INTERP_KERNEL/OrientationInverter.hxx index 868eea951..570d2356b 100644 --- a/src/INTERP_KERNEL/OrientationInverter.hxx +++ b/src/INTERP_KERNEL/OrientationInverter.hxx @@ -31,7 +31,7 @@ namespace INTERP_KERNEL { public: INTERPKERNEL_EXPORT static OrientationInverter *BuildInstanceFrom(NormalizedCellType gt); - INTERPKERNEL_EXPORT virtual ~OrientationInverter() = default; + INTERPKERNEL_EXPORT virtual ~OrientationInverter() { } INTERPKERNEL_EXPORT virtual void operate(mcIdType *beginPt, mcIdType *endPt) const = 0; }; @@ -39,7 +39,7 @@ namespace INTERP_KERNEL { public: OrientationInverterChecker(unsigned nbNodes):_nb_nodes(nbNodes) { } - void operate(mcIdType *beginPt, mcIdType *endPt) const override { check(beginPt,endPt); operateAndShutUp(beginPt); } + void operate(mcIdType *beginPt, mcIdType *endPt) const { check(beginPt,endPt); operateAndShutUp(beginPt); } virtual void operateAndShutUp(mcIdType *beginPt) const = 0; protected: unsigned getNbNodes() const { return _nb_nodes; } @@ -53,82 +53,82 @@ namespace INTERP_KERNEL { public: OrientationInverterSEG2():OrientationInverterChecker(2u) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterSEG3 : public OrientationInverterChecker { public: OrientationInverterSEG3():OrientationInverterChecker(3u) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverter2DLinear : public OrientationInverterChecker { public: OrientationInverter2DLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverter2DQuadratic : public OrientationInverterChecker { public: OrientationInverter2DQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterPolygon : public OrientationInverter { public: - void operate(mcIdType *beginPt, mcIdType *endPt) const override; + void operate(mcIdType *beginPt, mcIdType *endPt) const; }; class OrientationInverterQPolygon : public OrientationInverter { public: - void operate(mcIdType *beginPt, mcIdType *endPt) const override; + void operate(mcIdType *beginPt, mcIdType *endPt) const; }; class OrientationInverterTetra4 : public OrientationInverterChecker { public: OrientationInverterTetra4():OrientationInverterChecker(4u) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterTetra10 : public OrientationInverterChecker { public: OrientationInverterTetra10():OrientationInverterChecker(10u) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterPyra5 : public OrientationInverterChecker { public: OrientationInverterPyra5():OrientationInverterChecker(5u) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterPyra13 : public OrientationInverterChecker { public: OrientationInverterPyra13():OrientationInverterChecker(13u) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverter3DExtrusionLinear : public OrientationInverterChecker { public: OrientationInverter3DExtrusionLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverter3DExtrusionQuadratic : public OrientationInverterChecker { public: OrientationInverter3DExtrusionQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { } - void operateAndShutUp(mcIdType *beginPt) const override; + void operateAndShutUp(mcIdType *beginPt) const; }; } diff --git a/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.hxx b/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.hxx index 5a59eea4e..0ff8f2de0 100644 --- a/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.hxx +++ b/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.hxx @@ -21,9 +21,7 @@ #ifndef __PLANAR2D1DINTERSECTORP0P0_HXX__ #define __PLANAR2D1DINTERSECTORP0P0_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.txx b/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.txx index df496b097..7b7162da9 100644 --- a/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.txx @@ -21,10 +21,6 @@ #define __PLANAR2D1DINTERSECTORP0P0_TXX__ #include "Planar2D1DIntersectorP0P0.hxx" -#include "PlanarIntersector.hxx" -#include "InterpolationUtils.hxx" -#include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersector.hxx b/src/INTERP_KERNEL/PlanarIntersector.hxx index 6cc8670c3..273994eea 100644 --- a/src/INTERP_KERNEL/PlanarIntersector.hxx +++ b/src/INTERP_KERNEL/PlanarIntersector.hxx @@ -24,10 +24,8 @@ #include "TargetIntersector.txx" #include "NormalizedUnstructuredMesh.hxx" -#include #include #include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersector.txx b/src/INTERP_KERNEL/PlanarIntersector.txx index fc411856f..f96f14ce1 100644 --- a/src/INTERP_KERNEL/PlanarIntersector.txx +++ b/src/INTERP_KERNEL/PlanarIntersector.txx @@ -24,10 +24,8 @@ #include "InterpolationUtils.hxx" #include "TranslationRotationMatrix.hxx" -#include #include #include -#include namespace INTERP_KERNEL { @@ -47,7 +45,8 @@ namespace INTERP_KERNEL template PlanarIntersector::~PlanarIntersector() - = default; + { + } /*! \brief creates the bounding boxes for all the cells of mesh \a mesh @@ -84,7 +83,7 @@ namespace INTERP_KERNEL const double* coord_node=coords+SPACEDIM*OTT::coo2C(conn[OTT::conn2C(conn_index[icell]+j)]); for(int idim=0; idimx)?bbox[ibox*2*SPACEDIM + 2*idim+1]:x; } @@ -115,7 +114,7 @@ namespace INTERP_KERNEL const double* coord_node=coords+SPACEDIM*(OTT::coo2C(conn[OTT::conn2C(conn_index[OTT::ind2C(iP)]+i)])); for(int idim=0; idimbb[2*idim+1])?x:bb[2*idim+1]; @@ -311,7 +310,7 @@ namespace INTERP_KERNEL prodvect[0]=G1[1]*G2[2]-G1[2]*G2[1]; prodvect[1]=G1[2]*G2[0]-G1[0]*G2[2]; prodvect[2]=G1[0]*G2[1]-G1[1]*G2[0]; - double const prodscal=prodvect[0]*G3[0]+prodvect[1]*G3[1]+prodvect[2]*G3[2]; + double prodscal=prodvect[0]*G3[0]+prodvect[1]*G3[1]+prodvect[2]*G3[2]; if(fabs(prodscal)>md3DSurf) return 0; } diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx b/src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx index fc6883643..119507792 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx @@ -21,9 +21,7 @@ #ifndef __PLANARINTERSECTORP0P0_HXX__ #define __PLANARINTERSECTORP0P0_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; protected: PlanarIntersectorP0P0(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P0.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P0.txx index 312ce67fa..efc35d027 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P0.txx @@ -20,9 +20,7 @@ #ifndef __PLANARINTERSECTORP0P0_TXX__ #define __PLANARINTERSECTORP0P0_TXX__ -#include "PlanarIntersector.hxx" #include "PlanarIntersectorP0P0.hxx" -#include "InterpolationUtils.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx b/src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx index 7c2dedbd9..49cc7e947 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx @@ -21,9 +21,8 @@ #ifndef __PLANARINTERSECTORP0P1_HXX__ #define __PLANARINTERSECTORP0P1_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { @@ -33,7 +32,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; protected: PlanarIntersectorP0P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx index 66b6ca228..4913a5295 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx @@ -20,13 +20,9 @@ #ifndef __PLANARINTERSECTORP0P1_TXX__ #define __PLANARINTERSECTORP0P1_TXX__ -#include "PlanarIntersector.txx" -#include "InterpKernelUtilities.hxx" -#include "NormalizedGeometricTypes" #include "PlanarIntersectorP0P1.hxx" #include "InterpolationUtils.hxx" #include "CellModel.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.hxx b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.hxx index e79924ef0..70e8eb233 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.hxx @@ -21,9 +21,7 @@ #ifndef __PlanarIntersectorP0P1Bary_HXX__ #define __PlanarIntersectorP0P1Bary_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx old mode 100644 new mode 100755 index d1d4942c6..55b20556a --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx @@ -21,13 +21,8 @@ #ifndef __PlanarIntersectorP0P1Bary_TXX__ #define __PlanarIntersectorP0P1Bary_TXX__ -#include "NormalizedGeometricTypes" -#include "PlanarIntersector.hxx" #include "PlanarIntersectorP0P1Bary.hxx" #include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" -#include "CellModel.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx index fad08eaf5..0b81ba2a0 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx @@ -21,9 +21,7 @@ #ifndef __PLANARINTERSECTORP0P1PL_HXX__ #define __PLANARINTERSECTORP0P1PL_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx index 8d370645e..0bf10fce4 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx @@ -20,13 +20,11 @@ #ifndef __PLANARINTERSECTORP0P1PL_TXX__ #define __PLANARINTERSECTORP0P1PL_TXX__ -#include "PlanarIntersector.hxx" -#include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" #include "PlanarIntersectorP0P1PL.hxx" +#include "PlanarIntersector.txx" +#include "CellModel.hxx" #include "PointLocatorAlgos.txx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx index 4b64bee3c..c73cac216 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx @@ -21,9 +21,7 @@ #ifndef __PLANARINTERSECTORP1P0_HXX__ #define __PLANARINTERSECTORP1P0_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx index 319c209bf..8798ebedc 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx @@ -20,13 +20,8 @@ #ifndef __PLANARINTERSECTORP1P0_TXX__ #define __PLANARINTERSECTORP1P0_TXX__ -#include "NormalizedGeometricTypes" -#include "PlanarIntersector.txx" #include "PlanarIntersectorP1P0.hxx" #include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" -#include "CellModel.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.hxx index 43461984c..c592b128d 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.hxx @@ -21,9 +21,7 @@ #ifndef __PlanarIntersectorP1P0Bary_HXX__ #define __PlanarIntersectorP1P0Bary_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; protected: PlanarIntersectorP1P0Bary(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx old mode 100644 new mode 100755 index 2f6fd8c62..8407cd2b1 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx @@ -20,13 +20,8 @@ #ifndef __PlanarIntersectorP1P0Bary_TXX__ #define __PlanarIntersectorP1P0Bary_TXX__ -#include "NormalizedGeometricTypes" -#include "PlanarIntersector.hxx" #include "PlanarIntersectorP1P0Bary.hxx" #include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" -#include "CellModel.hxx" -#include #define PLAN_INTERSECTOR PlanarIntersectorP1P0Bary #define PLAN_INTER_TEMPLATE template diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx index d21bee2eb..c40ceb92d 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx @@ -21,9 +21,7 @@ #ifndef __PLANARINTERSECTORP1P0PL_HXX__ #define __PLANARINTERSECTORP1P0PL_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { @@ -33,7 +31,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: PlanarIntersectorP1P0PL(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx index 812282d71..9cc39fa84 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx @@ -20,16 +20,13 @@ #ifndef __PLANARINTERSECTORP1P0PL_TXX__ #define __PLANARINTERSECTORP1P0PL_TXX__ -#include "PlanarIntersector.txx" -#include "InterpolationUtils.hxx" -#include "NormalizedGeometricTypes" #include "PlanarIntersectorP1P0PL.hxx" -#include "InterpKernelUtilities.hxx" -#include "VolSurfFormulae.hxx" +#include "PlanarIntersector.txx" +#include "CellModel.hxx" #include "PointLocatorAlgos.txx" -#include -#include +#include "InterpKernelGeo2DQuadraticPolygon.hxx" +#include "MeshUtils.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx index d7b4834fc..0ca0fb682 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx @@ -21,9 +21,7 @@ #ifndef __PLANARINTERSECTORP1P1_HXX__ #define __PLANARINTERSECTORP1P1_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx index 6445ad357..83d159249 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx @@ -20,11 +20,9 @@ #ifndef __PLANARINTERSECTORP1P1_TXX__ #define __PLANARINTERSECTORP1P1_TXX__ -#include "PlanarIntersector.txx" #include "PlanarIntersectorP1P1.hxx" #include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" -#include +#include "CellModel.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx index 1609a1bd5..aa2b9ced2 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx @@ -21,9 +21,7 @@ #ifndef __PLANARINTERSECTORP1P1PL_HXX__ #define __PLANARINTERSECTORP1P1PL_HXX__ -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx index f57ac7739..45692ac88 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx @@ -20,15 +20,12 @@ #ifndef __PLANARINTERSECTORP1P1PL_TXX__ #define __PLANARINTERSECTORP1P1PL_TXX__ -#include "PlanarIntersector.txx" -#include "InterpolationUtils.hxx" -#include "NormalizedGeometricTypes" #include "PlanarIntersectorP1P1PL.hxx" -#include "InterpKernelUtilities.hxx" +#include "PlanarIntersector.txx" +#include "CellModel.hxx" #include "PointLocatorAlgos.txx" -#include -#include +#include "MeshUtils.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator2DIntersector.hxx b/src/INTERP_KERNEL/PointLocator2DIntersector.hxx index ba3f44431..b6e2af5b4 100644 --- a/src/INTERP_KERNEL/PointLocator2DIntersector.hxx +++ b/src/INTERP_KERNEL/PointLocator2DIntersector.hxx @@ -21,9 +21,11 @@ #ifndef __POINTLOCATORINTERSECTOR_HXX__ #define __POINTLOCATORINTERSECTOR_HXX__ -#include "NormalizedUnstructuredMesh.hxx" -#include "NormalizedGeometricTypes" -#include +#include "PlanarIntersectorP0P0.hxx" +#include "PlanarIntersectorP0P1.hxx" +#include "PlanarIntersectorP1P0.hxx" +#include "PlanarIntersectorP1P1.hxx" +#include "PlanarIntersectorP1P0Bary.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator2DIntersector.txx b/src/INTERP_KERNEL/PointLocator2DIntersector.txx index 1ec0e01aa..a1719a857 100644 --- a/src/INTERP_KERNEL/PointLocator2DIntersector.txx +++ b/src/INTERP_KERNEL/PointLocator2DIntersector.txx @@ -21,14 +21,15 @@ #define __POINTLOCATORINTERSECTOR_TXX__ #include "PointLocator2DIntersector.hxx" -#include "PlanarIntersector.hxx" +#include "PlanarIntersectorP0P0.txx" +#include "PlanarIntersectorP0P1.txx" +#include "PlanarIntersectorP1P0.txx" +#include "PlanarIntersectorP1P1.txx" +#include "PlanarIntersectorP1P0Bary.txx" #include "CellModel.hxx" -#include "PointLocatorAlgos.txx" -#include "NormalizedGeometricTypes" - -#include -#include +#include "InterpKernelGeo2DQuadraticPolygon.hxx" +#include "PointLocatorAlgos.txx" #define PTLOC2D_INTERSECTOR PointLocator2DIntersector #define INTERSECTOR_TEMPLATE template class InterpType> diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P0.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P0.hxx index e4cd815cd..3d08e602d 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P0.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P0.hxx @@ -23,7 +23,7 @@ #include "Intersector3DP0P0.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P0.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P0.txx index 736cd0923..d3d3cdb4b 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P0.txx @@ -20,16 +20,12 @@ #ifndef __POINTLOCATOR3DINTERSECTORP0P0_TXX__ #define __POINTLOCATOR3DINTERSECTORP0P0_TXX__ -#include "Intersector3DP0P0.txx" -#include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" -#include "NormalizedGeometricTypes" -#include "CellModel.hxx" #include "PointLocator3DIntersectorP0P0.hxx" -#include "VolSurfFormulae.hxx" +#include "Intersector3DP0P0.txx" +#include "MeshUtils.hxx" +#include "SplitterTetra.txx" #include "PointLocatorAlgos.txx" -#include namespace INTERP_KERNEL { @@ -46,7 +42,8 @@ namespace INTERP_KERNEL template PointLocator3DIntersectorP0P0::~PointLocator3DIntersectorP0P0() - = default; + { + } /** * diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx index b98ff5e1a..f850f55c5 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx @@ -23,7 +23,7 @@ #include "Intersector3DP0P1.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx index eeb577186..dde163aa9 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx @@ -20,15 +20,9 @@ #ifndef __POINTLOCATOR3DINTERSECTORP0P1_TXX__ #define __POINTLOCATOR3DINTERSECTORP0P1_TXX__ -#include "Intersector3DP0P1.txx" -#include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" -#include "NormalizedGeometricTypes" #include "PointLocator3DIntersectorP0P1.hxx" -#include "PointLocatorAlgos.txx" -#include "CellModel.hxx" -#include -#include +#include "Intersector3DP0P1.txx" +#include "MeshUtils.hxx" namespace INTERP_KERNEL { @@ -45,7 +39,8 @@ namespace INTERP_KERNEL template PointLocator3DIntersectorP0P1::~PointLocator3DIntersectorP0P1() - = default; + { + } /** * diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx index 7a7cedbdc..a251ea2aa 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx @@ -23,7 +23,7 @@ #include "Intersector3DP1P0.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { @@ -33,7 +33,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: PointLocator3DIntersectorP1P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh, double precision); diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx index 58253b1be..55598b2f8 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx @@ -20,16 +20,9 @@ #ifndef __POINTLOCATOR3DINTERSECTORP1P0_TXX__ #define __POINTLOCATOR3DINTERSECTORP1P0_TXX__ -#include "Intersector3DP1P0.txx" -#include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" -#include "NormalizedGeometricTypes" #include "PointLocator3DIntersectorP1P0.hxx" -#include "CellModel.hxx" -#include "PointLocatorAlgos.txx" -#include "VolSurfFormulae.hxx" -#include -#include +#include "Intersector3DP1P0.txx" +#include "MeshUtils.hxx" namespace INTERP_KERNEL { @@ -46,7 +39,8 @@ namespace INTERP_KERNEL template PointLocator3DIntersectorP1P0::~PointLocator3DIntersectorP1P0() - = default; + { + } /** * @param targetCell in C mode. diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx index 242818892..653c93267 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx @@ -23,7 +23,7 @@ #include "Intersector3DP1P1.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { @@ -33,7 +33,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: PointLocator3DIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, double precision); diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx index 8f8a8cba1..ccd3eab13 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx @@ -20,16 +20,9 @@ #ifndef __POINTLOCATOR3DINTERSECTORP1P1_TXX__ #define __POINTLOCATOR3DINTERSECTORP1P1_TXX__ -#include "Intersector3DP1P1.txx" -#include "InterpolationUtils.hxx" -#include "InterpKernelUtilities.hxx" -#include "NormalizedGeometricTypes" #include "PointLocator3DIntersectorP1P1.hxx" -#include "CellModel.hxx" -#include "PointLocatorAlgos.txx" -#include -#include -#include +#include "Intersector3DP1P1.txx" +#include "MeshUtils.hxx" namespace INTERP_KERNEL { @@ -48,7 +41,8 @@ namespace INTERP_KERNEL template PointLocator3DIntersectorP1P1::~PointLocator3DIntersectorP1P1() - = default; + { + } /** * @param targetCell in C mode. diff --git a/src/INTERP_KERNEL/PointLocatorAlgos.txx b/src/INTERP_KERNEL/PointLocatorAlgos.txx index 00b02460c..95b616b33 100644 --- a/src/INTERP_KERNEL/PointLocatorAlgos.txx +++ b/src/INTERP_KERNEL/PointLocatorAlgos.txx @@ -20,7 +20,6 @@ #ifndef __POINTLOCATORALGOS_TXX__ #define __POINTLOCATORALGOS_TXX__ -#include "InterpKernelGeo2DPrecision.hxx" #include "InterpolationUtils.hxx" #include "CellModel.hxx" #include "BBTree.txx" @@ -28,12 +27,7 @@ #include "InterpKernelGeo2DNode.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" -#include "MCIdType.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "NormalizedGeometricTypes" -#include -#include #include #include #include @@ -45,7 +39,7 @@ namespace INTERP_KERNEL class GenericPointLocatorAlgos { public: - virtual ~GenericPointLocatorAlgos() = default; + virtual ~GenericPointLocatorAlgos() { } virtual std::list locates(const double* x, double eps) = 0; }; @@ -90,7 +84,7 @@ namespace INTERP_KERNEL _tree=new BBTree(_bb,0,0,nelem); } - ~PointLocatorAlgos() override + ~PointLocatorAlgos() { delete[] _bb; delete _tree; @@ -98,7 +92,7 @@ namespace INTERP_KERNEL //returns the list of elements that contains //the point pointed to by x - std::list locates(const double* x, double eps) override + std::list locates(const double* x, double eps) { typedef typename MyMeshType::MyConnType ConnType; const NumberingPolicy numPol=MyMeshType::My_numPol; @@ -127,12 +121,12 @@ namespace INTERP_KERNEL here XA^XC and XC^XB have different signs*/ const int SPACEDIM=MyMeshType::MY_SPACEDIM; - std::unique_ptr const sign( new char[nbEdges] ); + std::unique_ptr sign( new char[nbEdges] ); for (mcIdType iedge=0; iedgeeps) @@ -147,7 +141,7 @@ namespace INTERP_KERNEL // Same as isElementContainsPointAlg2DSimple() with a different input format ... static bool isElementContainsPointAlgo2DSimple2(const double *ptToTest, NormalizedCellType type, const double *coords, const typename MyMeshType::MyConnType *conn_elem, - typename MyMeshType::MyConnType /*conn_elem_sz*/, double eps) + typename MyMeshType::MyConnType conn_elem_sz, double eps) { const int SPACEDIM=MyMeshType::MY_SPACEDIM; typedef typename MyMeshType::MyConnType ConnType; @@ -156,8 +150,8 @@ namespace INTERP_KERNEL const CellModel& cmType=CellModel::GetCellModel(type); bool ret=false; - int const nbEdges=cmType.getNumberOfSons(); - auto *pts = new double[nbEdges*SPACEDIM]; + int nbEdges=cmType.getNumberOfSons(); + double *pts = new double[nbEdges*SPACEDIM]; for (int iedge=0; iedge::ind2C(conn_elem[iedge])); @@ -173,14 +167,14 @@ namespace INTERP_KERNEL typename MyMeshType::MyConnType conn_elem_sz, double eps) { // Override precision for this method only: - INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps); + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); const int SPACEDIM=MyMeshType::MY_SPACEDIM; typedef typename MyMeshType::MyConnType ConnType; const NumberingPolicy numPol=MyMeshType::My_numPol; std::vector nodes(conn_elem_sz); - INTERP_KERNEL::QuadraticPolygon *pol(nullptr); + INTERP_KERNEL::QuadraticPolygon *pol(0); for(mcIdType j=0;j::ind2C(conn_elem[j])); @@ -190,10 +184,10 @@ namespace INTERP_KERNEL pol=INTERP_KERNEL::QuadraticPolygon::BuildLinearPolygon(nodes); else pol=INTERP_KERNEL::QuadraticPolygon::BuildArcCirclePolygon(nodes); - auto *n(new INTERP_KERNEL::Node(ptToTest[0],ptToTest[1])); + INTERP_KERNEL::Node *n(new INTERP_KERNEL::Node(ptToTest[0],ptToTest[1])); double a(0.),b(0.),c(0.); a=pol->normalizeMe(b,c); n->applySimilarity(b,c,a); - bool const ret=pol->isInOrOut2(n); + bool ret=pol->isInOrOut2(n); delete pol; n->decrRef(); return ret; } @@ -205,9 +199,9 @@ namespace INTERP_KERNEL const NumberingPolicy numPol=MyMeshType::My_numPol; int nbfaces = cmType.getNumberOfSons2(conn_elem,conn_elem_sz); - std::unique_ptr const sign( new char[nbfaces] ); + std::unique_ptr sign( new char[nbfaces] ); std::unique_ptr connOfSon( new ConnType[conn_elem_sz] ); - std::unique_ptr const ptsOfTetrahedrizedPolyhedron( new double[3*3*nbfaces] ); + std::unique_ptr ptsOfTetrahedrizedPolyhedron( new double[3*3*nbfaces] ); for (int iface=0; iface::ind2C(conn_elem[0]))]; double p2=coords[(OTT::ind2C(conn_elem[1]))]; - double const delta=fabs(p1-p2)+eps; - double const val=*ptToTest-std::min(p1,p2); + double delta=fabs(p1-p2)+eps; + double val=*ptToTest-std::min(p1,p2); return val>-eps && val #include #include #include diff --git a/src/INTERP_KERNEL/PolygonAlgorithms.txx b/src/INTERP_KERNEL/PolygonAlgorithms.txx index b7fff36db..aad88b083 100644 --- a/src/INTERP_KERNEL/PolygonAlgorithms.txx +++ b/src/INTERP_KERNEL/PolygonAlgorithms.txx @@ -21,14 +21,9 @@ #include "PolygonAlgorithms.hxx" #include "InterpolationUtils.hxx" -#include -#include -#include #include #include #include -#include -#include namespace INTERP_KERNEL { @@ -175,7 +170,7 @@ namespace INTERP_KERNEL /* i is the local index of the current vertex */ /*************************************************************/ template - inline void PolygonAlgorithms::addNewVertex( int i, int i_glob, int i_next_glob, int /*i_prev_glob*/, + inline void PolygonAlgorithms::addNewVertex( int i, int i_glob, int i_next_glob, int i_prev_glob, const double * P) { /* Question:Should we add vertex i to the front or back ? */ @@ -249,8 +244,8 @@ namespace INTERP_KERNEL //fifth and sixth arguments are useless here { /* Updating _End_segments */ - std::pair< int,int > const i_i_next = std::make_pair(i, i_next); - std::pair< int,int > const j_j_next = std::make_pair(j, j_next); + std::pair< int,int > i_i_next = std::make_pair(i, i_next); + std::pair< int,int > j_j_next = std::make_pair(j, j_next); if( _End_segments[0] == i_i_next) { for(int idim=DIM-1;idim>-1;idim--) _Inter.push_front(ABCD[idim]); @@ -265,7 +260,7 @@ namespace INTERP_KERNEL /* Updating _Status */ _Status.insert(make_pair(i_next,std::make_pair(i, false))); - auto mi =_Status.find(j_next); + std::multimap< int, std::pair< int,bool> >::iterator mi =_Status.find(j_next); ((* mi).second).second= !((* mi).second).second; } else _Status.insert(std::make_pair(i_next,std::make_pair(i,true))); @@ -338,7 +333,7 @@ namespace INTERP_KERNEL int& j3, int& j3_glob, int& j4, int& j4_glob, int& i_glob, int& i_next_glob, int& i_prev_glob, const double * P_1, const double * P_2, - int N1, int N2, int /*sign*/) + int N1, int N2, int sign) { int N0, shift; if(i_glob < N1) @@ -348,7 +343,7 @@ namespace INTERP_KERNEL Poly1 = P_1; Poly2 = P_2; - auto mi1=_Status.rbegin(); + std::multimap< int, std::pair< int,bool> >::reverse_iterator mi1=_Status.rbegin(); j1_glob=((*mi1).second).first; j1=j1_glob-N1; j2_glob=(*mi1).first; @@ -366,7 +361,7 @@ namespace INTERP_KERNEL Poly1 = P_2; Poly2 = P_1; - auto mi2= _Status.begin(); + std::multimap< int, std::pair< int,bool> >::iterator mi2= _Status.begin(); j1_glob=((*mi2).second).first; j1=j1_glob; j2_glob=(*mi2).first; @@ -423,7 +418,7 @@ namespace INTERP_KERNEL /******** Treatment of the first vertex ********/ mi1=events.begin(); i_glob = (* mi1).second; - bool const which_start = i_glob < N1; + bool which_start = i_glob < N1; if(i_glob < N1){ i_next_glob = (i_glob +1)%N1; i_prev_glob = (i_glob -1+N1)%N1;} else{ i_next_glob = (i_glob-N1+1)%N2 + N1;i_prev_glob = (i_glob-N1-1+N2)%N2 + N1;} _Status.insert(std::make_pair(i_next_glob,std::make_pair(i_glob, false))); @@ -626,12 +621,12 @@ namespace INTERP_KERNEL which_is_inside[inside_j2] = std::make_pair(j1_glob,j2_glob); which_is_inside[inside_j4] = std::make_pair(j3_glob,j4_glob); - auto const min = which_is_inside.begin(); - auto minext = min; + std::map >::iterator min = which_is_inside.begin(); + std::map >::iterator minext = min; minext++; - auto const max = which_is_inside.rbegin(); - auto j2_in_status = _Status.find(((*min).second).second); - auto j4_in_status = _Status.find(((*minext).second).second); + std::map >::reverse_iterator max = which_is_inside.rbegin(); + std::multimap< int, std::pair< int,bool> >::iterator j2_in_status = _Status.find(((*min).second).second); + std::multimap< int, std::pair< int,bool> >::iterator j4_in_status = _Status.find(((*minext).second).second); if((*min).first < -_epsilon) //there is someone clearly inside { @@ -684,24 +679,24 @@ namespace INTERP_KERNEL /* in the end, subP contains only the elements belonging to the convex hull, and not_in_hull the others */ /**************************************************************************/ template - inline void PolygonAlgorithms::convHull(const double *P, int /*N*/, double * normal, + inline void PolygonAlgorithms::convHull(const double *P, int N, double * normal, std::map< int,int >& subP, std::map< int,int >& not_in_hull, int& NsubP, const double epsilon) { if(NsubP>3) { - auto mi_prev = subP.begin(); - auto mi = mi_prev; + std::map< int,int >::iterator mi_prev = subP.begin(); + std::map< int,int >::iterator mi = mi_prev; mi++; - auto mi_next = mi; + std::map< int,int >::iterator mi_next = mi; mi_next++; double directframe=0.; /* Check if the polygon subP is positively oriented */ - auto mi1=mi; + std::map< int,int >::iterator mi1=mi; while(mi1 != subP.end() && distance2(&P[DIM*(*subP.begin()).second],&P[DIM*(*mi1).second])< epsilon) mi1++; - auto mi2=mi1; + std::map< int,int >::iterator mi2=mi1; while(mi2 != subP.end() && fabs(directframe)(&P[DIM* (*mi1).second], diff --git a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.hxx b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.hxx index ea6332dc4..9c826bd15 100644 --- a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.hxx +++ b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.hxx @@ -21,12 +21,8 @@ #define __POLYHEDRON3D2DINTERSECTORP0P0_HXX__ #include "Intersector3DP0P0.hxx" -#include "MCIdType.hxx" #include "SplitterTetra.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include -#include -#include namespace INTERP_KERNEL { @@ -40,12 +36,12 @@ namespace INTERP_KERNEL template class Polyhedron3D2DIntersectorP0P0 : public Intersector3DP0P0 { - using DuplicateFacesType = typename std::map>; + typedef typename std::map > DuplicateFacesType; public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: diff --git a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx index 2c4b4b556..a63fe24a2 100644 --- a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx @@ -19,18 +19,11 @@ #ifndef __POLYHEDRON3D2DINTERSECTORP0P0_TXX__ #define __POLYHEDRON3D2DINTERSECTORP0P0_TXX__ -#include "NormalizedGeometricTypes" -#include "Intersector3DP0P0.txx" -#include "Intersector3D.hxx" -#include "InterpolationUtils.hxx" -#include "CellModel.hxx" -#include "MCIdType.hxx" #include "Polyhedron3D2DIntersectorP0P0.hxx" +#include "Intersector3DP0P0.txx" #include "MeshUtils.hxx" -#include -#include "SplitterTetra.txx" -#include +#include "SplitterTetra.txx" namespace INTERP_KERNEL { @@ -111,8 +104,8 @@ namespace INTERP_KERNEL const CellModel& cellModelCell=CellModel::GetCellModel(normCellType); const MyMeshType& src_mesh = Intersector3D::_src_mesh; ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes(); - auto *polyNodes=new mcIdType[nbOfNodes4Type]; - auto **polyCoords = new double*[nbOfNodes4Type]; + mcIdType *polyNodes=new mcIdType[nbOfNodes4Type]; + double **polyCoords = new double*[nbOfNodes4Type]; for(int i = 0;i<(int)nbOfNodes4Type;++i) { // we could store mapping local -> global numbers too, but not sure it is worth it @@ -153,7 +146,7 @@ namespace INTERP_KERNEL if (isSrcFaceColinearWithFaceOfTetraTargetCell) { - auto intersectFacesIter = _intersect_faces.find(cellSrcIdx); + DuplicateFacesType::iterator intersectFacesIter = _intersect_faces.find(cellSrcIdx); if (intersectFacesIter != _intersect_faces.end()) { intersectFacesIter->second.insert(targetCell); diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.hxx b/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.hxx index 3b4d6f798..389256e26 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.hxx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.hxx @@ -24,7 +24,6 @@ #include "Intersector3DP0P0.hxx" #include "SplitterTetra.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { @@ -41,7 +40,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.txx index 8ab82512a..6e3cdda1a 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.txx @@ -21,12 +21,9 @@ #define __POLYHEDRONINTERSECTORP0P0_TXX__ #include "PolyhedronIntersectorP0P0.hxx" - -#include - -#include "NormalizedGeometricTypes" #include "Intersector3DP0P0.txx" -#include "InterpolationUtils.hxx" +#include "MeshUtils.hxx" + #include "SplitterTetra.txx" namespace INTERP_KERNEL diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.hxx b/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.hxx index 2734090e7..666fe3bad 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.hxx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.hxx @@ -24,7 +24,6 @@ #include "Intersector3DP0P1.hxx" #include "SplitterTetra.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx index f0c8106ee..a1fa4c494 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx @@ -20,14 +20,11 @@ #ifndef __POLYHEDRONINTERSECTORP0P1_TXX__ #define __POLYHEDRONINTERSECTORP0P1_TXX__ -#include "NormalizedGeometricTypes" -#include "Intersector3DP0P1.txx" -#include "InterpolationUtils.hxx" #include "PolyhedronIntersectorP0P1.hxx" +#include "Intersector3DP0P1.txx" +#include "MeshUtils.hxx" -#include "SplitterTetra.hxx" -#include -#include +#include "SplitterTetra.txx" namespace INTERP_KERNEL { @@ -88,8 +85,9 @@ namespace INTERP_KERNEL for(typename std::vector*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter) { (*iter)->splitIntoDualCells(subTetras); - for(auto tmp : subTetras) + for(int i=0;i<24;i++) { + SplitterTetra *tmp=subTetras[i]; double volume = tmp->intersectSourceCell(*iterCellS); if(volume!=0.) { diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.hxx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.hxx index 8881b966a..5d1d6967d 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.hxx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.hxx @@ -24,7 +24,6 @@ #include "Intersector3DP1P0.hxx" #include "SplitterTetra.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { @@ -41,7 +40,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx index f51bccf04..57c93bf15 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx @@ -20,15 +20,11 @@ #ifndef __POLYHEDRONINTERSECTORP1P0_TXX__ #define __POLYHEDRONINTERSECTORP1P0_TXX__ -#include "NormalizedGeometricTypes" -#include "Intersector3DP1P0.txx" -#include "InterpKernelException.hxx" -#include "InterpolationUtils.hxx" -#include "Intersector3D.txx" #include "PolyhedronIntersectorP1P0.hxx" +#include "Intersector3DP1P0.txx" +#include "MeshUtils.hxx" #include "SplitterTetra.txx" -#include namespace INTERP_KERNEL { @@ -118,8 +114,9 @@ namespace INTERP_KERNEL { (*iter)->splitIntoDualCells(subTetras); double vol2 = 0.; - for(auto tmp : subTetras) + for(int i=0;i<24;i++) { + SplitterTetra *tmp=subTetras[i]; double volume = tmp->intersectSourceCell(targetCell); vol2 += volume; ConnType sourceNode=tmp->getId(0); diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.hxx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.hxx index 7f2187e42..7944b9715 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.hxx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.hxx @@ -24,7 +24,6 @@ #include "Intersector3DP1P0Bary.hxx" #include "SplitterTetra.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include namespace INTERP_KERNEL { @@ -41,7 +40,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx old mode 100644 new mode 100755 index 03d55d5d3..b10fc9bfd --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx @@ -20,15 +20,11 @@ #ifndef __PolyhedronIntersectorP1P0Bary_TXX__ #define __PolyhedronIntersectorP1P0Bary_TXX__ -#include "NormalizedGeometricTypes" -#include "Intersector3DP1P0Bary.txx" -#include "InterpolationUtils.hxx" -#include "Intersector3D.txx" #include "PolyhedronIntersectorP1P0Bary.hxx" -// #include "MeshUtils.hxx" +#include "Intersector3DP1P0Bary.txx" +#include "MeshUtils.hxx" #include "SplitterTetra.txx" -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.hxx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.hxx index e1f4e36eb..489093e0a 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.hxx @@ -22,9 +22,8 @@ #define __PolyhedronIntersectorP1P1_HXX__ #include "Intersector3DP1P1.hxx" +#include "SplitterTetra.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include "NormalizedGeometricTypes" -#include namespace INTERP_KERNEL { @@ -41,7 +40,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx old mode 100644 new mode 100755 index b303c65e2..7420a06f8 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx @@ -21,16 +21,10 @@ #define __PolyhedronIntersectorP1P1_TXX__ #include "PolyhedronIntersectorP1P1.hxx" - -#include "NormalizedGeometricTypes" #include "Intersector3DP1P1.txx" -#include "InterpolationUtils.hxx" -#include "Intersector3D.txx" -// #include "MeshUtils.hxx" +#include "MeshUtils.hxx" #include "SplitterTetra.txx" -#include -#include namespace INTERP_KERNEL { @@ -43,7 +37,7 @@ namespace INTERP_KERNEL * @param policy splitting policy to be used */ template - PolyhedronIntersectorP1P1::PolyhedronIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy /*policy*/):Intersector3DP1P1(targetMesh,srcMesh) + PolyhedronIntersectorP1P1::PolyhedronIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy):Intersector3DP1P1(targetMesh,srcMesh) { // SPEC: // "Limitation. Concerning P1P1 3D improvement only tetrahedron will be supported. @@ -68,7 +62,8 @@ namespace INTERP_KERNEL */ template PolyhedronIntersectorP1P1::~PolyhedronIntersectorP1P1() - = default; + { + } /** * Calculates the volume of intersection of an element in the source mesh and the target element @@ -108,17 +103,18 @@ namespace INTERP_KERNEL srcTetra.splitIntoDualCells(subTetrasS); // intersect each target subTetra with each source one - for(auto tmp : subTetrasS) + for(int i=0;i<24;i++) { + SplitterTetra *tmp=subTetrasS[i]; ConnType sourceNode=OTT::indFC(tmp->getId(0)); - for(auto & subTetraNode : subTetraNodes) + for(int j=0;j<24;j++) { - const double* tetraNodes12 = &subTetraNode.second[0]; + const double* tetraNodes12 = &subTetraNodes[j].second[0]; const double* tetraNodesT[4]={ tetraNodes12, tetraNodes12+3, tetraNodes12+6, tetraNodes12+9 }; double volume = tmp->intersectTetra( tetraNodesT ); if(volume!=0.) { - ConnType tgtNode=subTetraNode.first; + ConnType tgtNode=subTetraNodes[j].first; typename MyMatrix::value_type& resRow = res[tgtNode]; typename MyMatrix::value_type::const_iterator iterRes=resRow.find( sourceNode ); if(iterRes!=resRow.end()) diff --git a/src/INTERP_KERNEL/RegionNode.hxx b/src/INTERP_KERNEL/RegionNode.hxx index 7ddb130a8..091ab4739 100644 --- a/src/INTERP_KERNEL/RegionNode.hxx +++ b/src/INTERP_KERNEL/RegionNode.hxx @@ -35,9 +35,9 @@ namespace INTERP_KERNEL { public: - RegionNode() = default; + RegionNode() { } - ~RegionNode() = default; + ~RegionNode() { } /** * Accessor to source region diff --git a/src/INTERP_KERNEL/SplitterTetra.cxx b/src/INTERP_KERNEL/SplitterTetra.cxx index 66ab579ab..6fb3fe332 100644 --- a/src/INTERP_KERNEL/SplitterTetra.cxx +++ b/src/INTERP_KERNEL/SplitterTetra.cxx @@ -19,11 +19,6 @@ // Author : Anthony Geay (CEA/DEN) #include "SplitterTetra.hxx" -#include "MCIdType.hxx" -#include "InterpKernelException.hxx" -#include -#include -#include namespace INTERP_KERNEL { @@ -71,7 +66,7 @@ namespace INTERP_KERNEL tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.; for(int j=0;j<4;j++,conn+=4) { - mcIdType const tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]); + mcIdType tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]); tmp2[0]+=coords[3*tmp3+0]; tmp2[1]+=coords[3*tmp3+1]; tmp2[2]+=coords[3*tmp3+2]; @@ -131,7 +126,7 @@ namespace INTERP_KERNEL { case NORM_TETRA4: { - std::size_t const sz(std::distance(nodalConnBg,nodalConnEnd)); + std::size_t sz(std::distance(nodalConnBg,nodalConnEnd)); if(sz!=4) throw INTERP_KERNEL::Exception("SplitIntoTetras : input tetra do not have 4 nodes !"); tetrasNodalConn.insert(tetrasNodalConn.end(),nodalConnBg,nodalConnEnd); @@ -208,12 +203,12 @@ namespace INTERP_KERNEL conn[0]=work[j]; conn[1]=work[(j+1)%nbOfNodesOfFace]; conn[2]=-(i+1); conn[3]=ToIdType(-(nbOfFaces+1)); tmp[0]+=coords[3*work[j]+0]; tmp[1]+=coords[3*work[j]+1]; tmp[2]+=coords[3*work[j]+2]; } - auto const nbNF = (double)nbOfNodesOfFace; + double nbNF = (double)nbOfNodesOfFace; tmp[0]/=nbNF; tmp[1]/=nbNF; tmp[2]/=nbNF; tmp2[0]+=tmp[0]; tmp2[1]+=tmp[1]; tmp2[2]+=tmp[2]; work+=nbOfNodesOfFace+1; } - auto const nbF = (double)nbOfFaces; + double nbF = (double)nbOfFaces; tmp2[0]/=nbF; tmp2[1]/=nbF; tmp2[2]/=nbF; return ; } diff --git a/src/INTERP_KERNEL/SplitterTetra.hxx b/src/INTERP_KERNEL/SplitterTetra.hxx index 806f4e4aa..80f704873 100644 --- a/src/INTERP_KERNEL/SplitterTetra.hxx +++ b/src/INTERP_KERNEL/SplitterTetra.hxx @@ -21,18 +21,18 @@ #define __SPLITTERTETRA_HXX__ #include "INTERPKERNELDefines.hxx" -#include "InterpKernelHashFun.hxx" #include "TransformedTriangle.hxx" #include "TetraAffineTransform.hxx" +#include "InterpolationOptions.hxx" +#include "InterpKernelException.hxx" #include "InterpKernelHashMap.hxx" #include "VectorUtils.hxx" #include "MCIdType.hxx" -#include "NormalizedGeometricTypes" #include -#include #include #include +#include #include namespace INTERP_KERNEL @@ -362,7 +362,7 @@ namespace INTERP_KERNEL class SplitterTetra { public: - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId); @@ -370,7 +370,7 @@ namespace INTERP_KERNEL ~SplitterTetra(); - double intersectSourceCell(typename MyMeshType::MyConnType srcCell, double* baryCentre=nullptr); + double intersectSourceCell(typename MyMeshType::MyConnType srcCell, double* baryCentre=0); double intersectSourceFace(const NormalizedCellType polyType, const ConnType polyNodesNbr, const ConnType *const polyNodes, @@ -483,7 +483,7 @@ namespace INTERP_KERNEL inline void SplitterTetra::calculateNode(typename MyMeshType::MyConnType globalNodeNum) { const double* node = _src_mesh.getCoordinatesPtr()+MyMeshType::MY_SPACEDIM*globalNodeNum; - auto* transformedNode = new double[MyMeshType::MY_SPACEDIM]; + double* transformedNode = new double[MyMeshType::MY_SPACEDIM]; assert(transformedNode != 0); _t->apply(transformedNode, node); _nodes[globalNodeNum] = transformedNode; @@ -503,7 +503,7 @@ namespace INTERP_KERNEL template inline void SplitterTetra::calculateNode2(typename MyMeshType::MyConnType globalNodeNum, const double* node) { - auto* transformedNode = new double[MyMeshType::MY_SPACEDIM]; + double* transformedNode = new double[MyMeshType::MY_SPACEDIM]; assert(transformedNode != 0); _t->apply(transformedNode, node); _nodes[globalNodeNum] = transformedNode; diff --git a/src/INTERP_KERNEL/SplitterTetra.txx b/src/INTERP_KERNEL/SplitterTetra.txx index ed9901e3e..9b631fd7b 100644 --- a/src/INTERP_KERNEL/SplitterTetra.txx +++ b/src/INTERP_KERNEL/SplitterTetra.txx @@ -19,10 +19,6 @@ #ifndef __SPLITTERTETRA_TXX__ #define __SPLITTERTETRA_TXX__ -#include "InterpKernelHashMap.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "NormalizedGeometricTypes" -#include "InterpolationUtils.hxx" #include "SplitterTetra.hxx" #include "TetraAffineTransform.hxx" @@ -36,10 +32,8 @@ #include #include -#include -#include -#include -#include +#include +#include #include namespace INTERP_KERNEL @@ -80,7 +74,7 @@ namespace INTERP_KERNEL */ template SplitterTetra::SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId) - : _t(nullptr), _src_mesh(srcMesh) + : _t(0), _src_mesh(srcMesh) { std::copy(nodesId,nodesId+4,_conn); _coords[0]=tetraCorners[0][0]; _coords[1]=tetraCorners[0][1]; _coords[2]=tetraCorners[0][2]; @@ -105,7 +99,7 @@ namespace INTERP_KERNEL * \param [in] tetraCorners array 4*3 doubles containing corners of input tetrahedron (P0X,P0Y,P0Y,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z). */ template - SplitterTetra::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn): _t(nullptr),_src_mesh(srcMesh) + SplitterTetra::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn): _t(0),_src_mesh(srcMesh) { if(!conn) { _conn[0]=0; _conn[1]=1; _conn[2]=2; _conn[3]=3; } @@ -149,12 +143,12 @@ namespace INTERP_KERNEL void SplitterTetra::splitMySelfForDual(double* output, int i, typename MyMeshType::MyConnType& nodeId) { double *tmp[4]; - int const offset=i/6; + int offset=i/6; nodeId=_conn[offset]; tmp[0]=_coords+3*offset; tmp[1]=_coords+((offset+1)%4)*3; tmp[2]=_coords+((offset+2)%4)*3; tmp[3]=_coords+((offset+3)%4)*3; - int const caseToTreat=i%6; - int const case1=caseToTreat/2; - int const case2=caseToTreat%2; + int caseToTreat=i%6; + int case1=caseToTreat/2; + int case2=caseToTreat%2; const int tab[3][2]={{1,2},{3,2},{1,3}}; const int *curTab=tab[case1]; double pt0[3]; pt0[0]=(tmp[curTab[case2]][0]+tmp[0][0])/2.; pt0[1]=(tmp[curTab[case2]][1]+tmp[0][1])/2.; pt0[2]=(tmp[curTab[case2]][2]+tmp[0][2])/2.; @@ -203,7 +197,7 @@ namespace INTERP_KERNEL bool isTargetOutside = false; // calculate the coordinates of the nodes - auto *cellNodes=new ConnType[nbOfNodes4Type]; + ConnType *cellNodes=new ConnType[nbOfNodes4Type]; for(ConnType i = 0;i global numbers too, but not sure it is worth it @@ -221,8 +215,8 @@ namespace INTERP_KERNEL // halfspace filtering check // NB : might not be beneficial for caching of triangles - for(bool const i : isOutside) - if(i) + for(int i = 0; i < 8; ++i) + if(isOutside[i]) isTargetOutside = true; double totalVolume = 0.0; @@ -504,7 +498,7 @@ namespace INTERP_KERNEL // Map 2D intersections back to the 3D triangle space. if (maxNormal == 0) { - double const invNX = ((double) 1.) / planeNormal[0]; + double invNX = ((double) 1.) / planeNormal[0]; for (i = 0; i < nb_inter; i++) { inter3[3 * i + 1] = inter2[2 * i]; @@ -514,7 +508,7 @@ namespace INTERP_KERNEL } else if (maxNormal == 1) { - double const invNY = ((double) 1.) / planeNormal[1]; + double invNY = ((double) 1.) / planeNormal[1]; for (i = 0; i < nb_inter; i++) { inter3[3 * i] = inter2[2 * i]; @@ -524,7 +518,7 @@ namespace INTERP_KERNEL } else { - double const invNZ = ((double) 1.) / planeNormal[2]; + double invNZ = ((double) 1.) / planeNormal[2]; for (i = 0; i < nb_inter; i++) { inter3[3 * i] = inter2[2 * i]; @@ -654,8 +648,9 @@ namespace INTERP_KERNEL { 0, 3, 1 }, { 1, 2, 3 } }; double planeNormal[3]; - for (auto tetraFaceNodesConn : tetraFacesNodesConn) + for (int iTetraFace = 0; iTetraFace < 4; ++iTetraFace) { + const int * const tetraFaceNodesConn = tetraFacesNodesConn[iTetraFace]; TriangleFaceKey key = TriangleFaceKey(_conn[tetraFaceNodesConn[0]], _conn[tetraFaceNodesConn[1]], _conn[tetraFaceNodesConn[2]]); @@ -668,20 +663,20 @@ namespace INTERP_KERNEL const double normOfTetraTriNormal = norm(planeNormal); if (epsilonEqual(normOfTetraTriNormal, 0.)) { - for (double & i : planeNormal) + for (int i = 0; i < 3; ++i) { - i = 0.; + planeNormal[i] = 0.; } } else { const double invNormOfTetraTriNormal = 1. / normOfTetraTriNormal; - for (double & i : planeNormal) + for (int i = 0; i < 3; ++i) { - i *= invNormOfTetraTriNormal; + planeNormal[i] *= invNormOfTetraTriNormal; } } - double const planeConstant = dot(planeNormal, coordsTetraTriNode1); + double planeConstant = dot(planeNormal, coordsTetraTriNode1); if (IsFacesCoplanar(planeNormal, planeConstant, polyCoords, precision)) { ConnType nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles @@ -853,9 +848,9 @@ namespace INTERP_KERNEL // halfspace filtering check // NB : might not be beneficial for caching of triangles - for(bool const i : isOutside) + for(int i = 0; i < 8; ++i) { - if(i) + if(isOutside[i]) { isTargetOutside = true; } @@ -873,7 +868,7 @@ namespace INTERP_KERNEL cellModelCell.fillSonCellNodalConnectivity(ii,cellNodes,faceNodes); TransformedTriangle tri(nodes[faceNodes[0]], nodes[faceNodes[1]], nodes[faceNodes[2]]); - double const vol = tri.calculateIntersectionVolume(); + double vol = tri.calculateIntersectionVolume(); LOG(1, "ii = " << ii << " Volume=" << vol) totalVolume += vol; } @@ -912,8 +907,8 @@ namespace INTERP_KERNEL // free potential sub-mesh nodes that have been allocated if(_nodes.size()>=/*8*/_node_ids.size()) { - auto nbOfNodesT = static_cast(_node_ids.size()); - auto iter = _nodes.begin() + /*8*/nbOfNodesT; + typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast(_node_ids.size()); + std::vector::iterator iter = _nodes.begin() + /*8*/nbOfNodesT; while(iter != _nodes.end()) { delete[] *iter; @@ -988,7 +983,7 @@ namespace INTERP_KERNEL nodes[node]=getCoordsOfNode2(node, OTT::indFC(targetCell),_target_mesh,conn[node]); } std::copy(conn,conn+4,_node_ids.begin()); - auto* t = new SplitterTetra(_src_mesh, nodes,conn); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); tetra.push_back(t); return ; } @@ -1071,7 +1066,7 @@ namespace INTERP_KERNEL nodes[j] = getCoordsOfSubNode2(conn[j],realConn); conn[j] = realConn; } - auto* t = new SplitterTetra(_src_mesh, nodes,conn); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); tetra.push_back(t); } } @@ -1106,7 +1101,7 @@ namespace INTERP_KERNEL conn[j] = subZone[SPLIT_NODES_6[4*i+j]]; func(*this,conn[j],nodes[j]); } - auto* t = new SplitterTetra(_src_mesh, nodes,conn); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); tetra.push_back(t); } } @@ -1167,7 +1162,7 @@ namespace INTERP_KERNEL conn[2] = TETRA_EDGES_GENERAL_24[2*row]; conn[3] = TETRA_EDGES_GENERAL_24[2*row + 1]; func(*this,conn,nodes); - auto* t = new SplitterTetra(_src_mesh, nodes, conn); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes, conn); tetra.push_back(t); } } @@ -1211,11 +1206,11 @@ namespace INTERP_KERNEL // create tetrahedra const double* nodes[4]; typename MyMeshTypeS::MyConnType conn[4]; - for(auto i : SPLIT_PYPA5) + for(int i = 0; i < 2; ++i) { for(int j = 0; j < 4; ++j) - nodes[j] = getCoordsOfSubNode2(i[j],conn[j]); - auto* t = new SplitterTetra(_src_mesh, nodes,conn); + nodes[j] = getCoordsOfSubNode2(SPLIT_PYPA5[i][j],conn[j]); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); tetra.push_back(t); } } @@ -1265,7 +1260,7 @@ namespace INTERP_KERNEL if ( normCellType != NORM_POLYHED ) cellModelCell.fillSonCellNodalConnectivity(ii,&allNodeIndices[0],faceNodes); - int const nbTetra = nbFaceNodes - 2; // split polygon into nbTetra triangles + int nbTetra = nbFaceNodes - 2; // split polygon into nbTetra triangles // create tetrahedra for(int i = 0; i < nbTetra; ++i) @@ -1273,7 +1268,7 @@ namespace INTERP_KERNEL nodes[0] = getCoordsOfSubNode2( faceNodes[0], conn[0]); nodes[1] = getCoordsOfSubNode2( faceNodes[1+i],conn[1]); nodes[2] = getCoordsOfSubNode2( faceNodes[2+i],conn[2]); - auto* t = new SplitterTetra(_src_mesh, nodes,conn); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); tetra.push_back(t); } @@ -1297,7 +1292,7 @@ namespace INTERP_KERNEL { // retrieve real mesh nodes - auto nbOfNodesT = static_cast(_node_ids.size());// Issue 0020634. _node_ids.resize(8); + typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast(_node_ids.size());// Issue 0020634. _node_ids.resize(8); for(int node = 0; node < nbOfNodesT ; ++node) { // calculate only normal nodes @@ -1315,7 +1310,7 @@ namespace INTERP_KERNEL { for(int i = 0; i < 7; ++i) { - auto* barycenter = new double[3]; + double* barycenter = new double[3]; calcBarycenter(4, barycenter, &GENERAL_24_SUB_NODES[4*i]); _nodes.push_back(barycenter); } @@ -1326,7 +1321,7 @@ namespace INTERP_KERNEL { for(int i = 0; i < 19; ++i) { - auto* barycenter = new double[3]; + double* barycenter = new double[3]; calcBarycenter(2, barycenter, &GENERAL_48_SUB_NODES[2*i]); _nodes.push_back(barycenter); } @@ -1346,7 +1341,7 @@ namespace INTERP_KERNEL // add barycenter of a cell std::vector allIndices(nbOfNodesT); for ( int i = 0; i < nbOfNodesT; ++i ) allIndices[i] = i; - auto* barycenter = new double[3]; + double* barycenter = new double[3]; calcBarycenter(nbOfNodesT, barycenter, &allIndices[0]); _nodes.push_back(barycenter); } diff --git a/src/INTERP_KERNEL/TargetIntersector.hxx b/src/INTERP_KERNEL/TargetIntersector.hxx index e2ccc2487..49cf7f148 100644 --- a/src/INTERP_KERNEL/TargetIntersector.hxx +++ b/src/INTERP_KERNEL/TargetIntersector.hxx @@ -21,8 +21,8 @@ #ifndef __TARGETINTERSECTOR__HXX__ #define __TARGETINTERSECTOR__HXX__ +#include "INTERPKERNELDefines.hxx" -#include #include namespace INTERP_KERNEL @@ -37,7 +37,7 @@ namespace INTERP_KERNEL { public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; public: /*! * Tool for cell intersection, result is always positive. @@ -50,7 +50,7 @@ namespace INTERP_KERNEL virtual ConnType getNumberOfRowsOfResMatrix() const = 0; virtual ConnType getNumberOfColsOfResMatrix() const = 0; - virtual ~TargetIntersector() = default; + virtual ~TargetIntersector() { } void adjustBoundingBoxes(std::vector& bbox, double adjustmentEps, double adjustmentEpsAbs); void adjustBoundingBoxes(double *bbox, std::size_t sz, double adjustmentEps, double adjustmentEpsAbs); }; diff --git a/src/INTERP_KERNEL/TargetIntersector.txx b/src/INTERP_KERNEL/TargetIntersector.txx index a9484c726..f9d55cdee 100644 --- a/src/INTERP_KERNEL/TargetIntersector.txx +++ b/src/INTERP_KERNEL/TargetIntersector.txx @@ -22,9 +22,7 @@ #define __TARGETINTERSECTOR__TXX__ #include "TargetIntersector.hxx" -#include #include -#include namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/TetraAffineTransform.cxx b/src/INTERP_KERNEL/TetraAffineTransform.cxx index 9f28bf8c9..0d64ca9fc 100644 --- a/src/INTERP_KERNEL/TetraAffineTransform.cxx +++ b/src/INTERP_KERNEL/TetraAffineTransform.cxx @@ -337,7 +337,7 @@ namespace INTERP_KERNEL } // swap rows in index vector - int const tmp = idx[k]; + int tmp = idx[k]; idx[k] = idx[row]; idx[row] = tmp; diff --git a/src/INTERP_KERNEL/TransformedTriangle.cxx b/src/INTERP_KERNEL/TransformedTriangle.cxx index 599028b8a..ac83c338f 100644 --- a/src/INTERP_KERNEL/TransformedTriangle.cxx +++ b/src/INTERP_KERNEL/TransformedTriangle.cxx @@ -18,14 +18,14 @@ // #include "TransformedTriangle.hxx" -#include "Log.hxx" #include "VectorUtils.hxx" #include "TetraAffineTransform.hxx" -#include -#include #include +#include #include #include +#include +#include #include #include @@ -188,7 +188,7 @@ namespace INTERP_KERNEL // }; // double sign = uv_xy[0] * uv_xy[3] - uv_xy[1] * uv_xy[2]; - int const sign = isTriangleInclinedToFacet( OXY ); + int sign = isTriangleInclinedToFacet( OXY ); if(sign == 0 ) { @@ -314,13 +314,13 @@ namespace INTERP_KERNEL { if(testSurfaceEdgeIntersection(edge)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; calcIntersectionPtSurfaceEdge(edge, ptA); _polygonA.push_back(ptA); LOG(3,"Surface-edge (edge " << strTE(edge) << "): " << vToStr(ptA) << " added to A "); if(edge >= XY) { - auto* ptB = new double[3]; + double* ptB = new double[3]; copyVector3(ptA, ptB); _polygonB.push_back(ptB); LOG(3,"Surface-edge (edge " << strTE(edge) << "): " << vToStr(ptB) << " added to B "); @@ -334,7 +334,7 @@ namespace INTERP_KERNEL { if(testSurfaceRayIntersection(corner)) { - auto* ptB = new double[3]; + double* ptB = new double[3]; copyVector3(&COORDS_TET_CORNER[3 * corner], ptB); _polygonB.push_back(ptB); LOG(3,"Surface-ray (corner " << strTC(corner) << "): " << vToStr(ptB) << " added to B"); @@ -362,13 +362,13 @@ namespace INTERP_KERNEL if(doTest && testSegmentFacetIntersection(seg, facet)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; calcIntersectionPtSegmentFacet(seg, facet, ptA); _polygonA.push_back(ptA); LOG(3,"Segment-facet (facet " << strTF(facet) << ", seg " << strTriS(seg) << "): " << vToStr(ptA) << " added to A"); if(facet == XYZ) { - auto* ptB = new double[3]; + double* ptB = new double[3]; copyVector3(ptA, ptB); _polygonB.push_back(ptB); LOG(3,"Segment-facet (facet " << strTF(facet) << ", seg " << strTriS(seg) << "): " << vToStr(ptB) << " added to B"); @@ -380,17 +380,17 @@ namespace INTERP_KERNEL // segment - edge for(TetraEdge edge = OX ; edge <= ZX ; edge = TetraEdge(edge + 1)) { - const auto edge_dp = DoubleProduct(edge); + const DoubleProduct edge_dp = DoubleProduct(edge); if(isZero[edge_dp] && testSegmentEdgeIntersection(seg, edge)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; calcIntersectionPtSegmentEdge(seg, edge, ptA); _polygonA.push_back(ptA); LOG(3,"Segment-edge (edge " << strTE(edge) << ", seg " << strTriS(seg) << "): " << vToStr(ptA) << " added to A"); if(edge >= XY) { - auto* ptB = new double[3]; + double* ptB = new double[3]; copyVector3(ptA, ptB); _polygonB.push_back(ptB); LOG(3,"Segment-edge (edge " << strTE(edge) << ", seg " << strTriS(seg) << "): " << vToStr(ptA) << " added to B"); @@ -408,13 +408,13 @@ namespace INTERP_KERNEL if(doTest && testSegmentCornerIntersection(seg, corner)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; copyVector3(&COORDS_TET_CORNER[3 * corner], ptA); _polygonA.push_back(ptA); LOG(3,"Segment-corner (corner " << strTC(corner) << ", seg " << strTriS(seg) << "): " << vToStr(ptA) << " added to A"); if(corner != O) { - auto* ptB = new double[3]; + double* ptB = new double[3]; _polygonB.push_back(ptB); copyVector3(&COORDS_TET_CORNER[3 * corner], ptB); LOG(3,"Segment-corner (corner " << strTC(corner) << ", seg " << strTriS(seg) << "): " << vToStr(ptB) << " added to B"); @@ -427,7 +427,7 @@ namespace INTERP_KERNEL { if(isZero[DP_SEGMENT_RAY_INTERSECTION[7*(corner-1)]] && testSegmentRayIntersection(seg, corner)) { - auto* ptB = new double[3]; + double* ptB = new double[3]; copyVector3(&COORDS_TET_CORNER[3 * corner], ptB); _polygonB.push_back(ptB); LOG(3,"Segment-ray (corner " << strTC(corner) << ", seg " << strTriS(seg) << "): " << vToStr(ptB) << " added to B"); @@ -449,7 +449,7 @@ namespace INTERP_KERNEL #endif if(testSegmentHalfstripIntersection(seg, edge)) { - auto* ptB = new double[3]; + double* ptB = new double[3]; calcIntersectionPtSegmentHalfstrip(seg, edge, ptB); _polygonB.push_back(ptB); LOG(3,"Segment-halfstrip : " << vToStr(ptB) << " added to B"); @@ -464,7 +464,7 @@ namespace INTERP_KERNEL // tetrahedron if(testCornerInTetrahedron(corner)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; copyVector3(&_coords[5*corner], ptA); _polygonA.push_back(ptA); LOG(3,"Inclusion tetrahedron (corner " << strTriC(corner) << "): " << vToStr(ptA) << " added to A"); @@ -473,7 +473,7 @@ namespace INTERP_KERNEL // XYZ - plane if(testCornerOnXYZFacet(corner)) { - auto* ptB = new double[3]; + double* ptB = new double[3]; copyVector3(&_coords[5*corner], ptB); _polygonB.push_back(ptB); LOG(3,"Inclusion XYZ-plane (corner " << strTriC(corner) << "): " << vToStr(ptB) << " added to B"); @@ -482,7 +482,7 @@ namespace INTERP_KERNEL // projection on XYZ - facet if(testCornerAboveXYZFacet(corner)) { - auto* ptB = new double[3]; + double* ptB = new double[3]; copyVector3(&_coords[5*corner], ptB); ptB[2] = 1 - ptB[0] - ptB[1]; // lower z to project on XYZ assert(epsilonEqual(ptB[0]+ptB[1]+ptB[2] - 1, 0.0)); @@ -513,7 +513,7 @@ namespace INTERP_KERNEL { if(testSurfaceEdgeIntersection(edge)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; calcIntersectionPtSurfaceEdge(edge, ptA); _polygonA.push_back(ptA); LOG(3,"Surface-edge : " << vToStr(ptA) << " added to A "); @@ -542,7 +542,7 @@ namespace INTERP_KERNEL if(doTest && testSegmentFacetIntersection(seg, facet)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; calcIntersectionPtSegmentFacet(seg, facet, ptA); _polygonA.push_back(ptA); LOG(3,"Segment-facet : " << vToStr(ptA) << " added to A"); @@ -552,11 +552,11 @@ namespace INTERP_KERNEL // segment - edge for(TetraEdge edge = OX ; edge <= ZX ; edge = TetraEdge(edge + 1)) { - const auto edge_dp = DoubleProduct(edge); + const DoubleProduct edge_dp = DoubleProduct(edge); if(isZero[edge_dp] && testSegmentEdgeIntersection(seg, edge)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; calcIntersectionPtSegmentEdge(seg, edge, ptA); _polygonA.push_back(ptA); LOG(3,"Segment-edge : " << vToStr(ptA) << " added to A"); @@ -573,7 +573,7 @@ namespace INTERP_KERNEL if(doTest && testSegmentCornerIntersection(seg, corner)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; copyVector3(&COORDS_TET_CORNER[3 * corner], ptA); _polygonA.push_back(ptA); LOG(3,"Segment-corner : " << vToStr(ptA) << " added to A"); @@ -589,7 +589,7 @@ namespace INTERP_KERNEL // tetrahedron if(testCornerInTetrahedron(corner)) { - auto* ptA = new double[3]; + double* ptA = new double[3]; copyVector3(&_coords[5*corner], ptA); _polygonA.push_back(ptA); LOG(3,"Inclusion tetrahedron : " << vToStr(ptA) << " added to A"); @@ -699,7 +699,7 @@ namespace INTERP_KERNEL } // create order object - SortOrder const order(barycenter, type); + SortOrder order(barycenter, type); // sort vector with this object // NB : do not change place of first object, with respect to which the order diff --git a/src/INTERP_KERNEL/TransformedTriangle.hxx b/src/INTERP_KERNEL/TransformedTriangle.hxx index 17edca9b7..14d396597 100644 --- a/src/INTERP_KERNEL/TransformedTriangle.hxx +++ b/src/INTERP_KERNEL/TransformedTriangle.hxx @@ -24,9 +24,6 @@ #include "VectorUtils.hxx" #include "assert.h" -#include -#include -#include #include // Levels : @@ -439,9 +436,9 @@ namespace INTERP_KERNEL _coords[5*corner + 3] // z }; - for(double const i : pt) + for(int i = 0 ; i < 4 ; ++i) { - if(i < 0.0 || i > 1.0) + if(pt[i] < 0.0 || pt[i] > 1.0) { return false; } diff --git a/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx b/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx index c7805b819..36727ef26 100644 --- a/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx +++ b/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx @@ -17,10 +17,12 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "Log.hxx" #include "TransformedTriangle.hxx" +#include +#include #include #include +#include "VectorUtils.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/TransformedTriangleMath.cxx b/src/INTERP_KERNEL/TransformedTriangleMath.cxx index 3e8ff13b3..7b3eba4e8 100644 --- a/src/INTERP_KERNEL/TransformedTriangleMath.cxx +++ b/src/INTERP_KERNEL/TransformedTriangleMath.cxx @@ -17,14 +17,13 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "Log.hxx" #include "TransformedTriangle.hxx" -#include +#include +#include #include #include #include #include -#include #include #include "VectorUtils.hxx" @@ -248,8 +247,8 @@ namespace INTERP_KERNEL double TransformedTriangle::calculateDistanceCornerSegment(const TetraCorner corner, const TriSegment seg) const { // NB uses fact that TriSegment <=> TriCorner that is first point of segment (PQ <=> P) - const auto ptP_idx = TriCorner(seg); - const auto ptQ_idx = TriCorner( (seg + 1) % 3); + const TriCorner ptP_idx = TriCorner(seg); + const TriCorner ptQ_idx = TriCorner( (seg + 1) % 3); const double ptP[3] = { _coords[5*ptP_idx], _coords[5*ptP_idx + 1], _coords[5*ptP_idx + 2] }; const double ptQ[3] = { _coords[5*ptQ_idx], _coords[5*ptQ_idx + 1], _coords[5*ptQ_idx + 2] }; @@ -305,7 +304,7 @@ namespace INTERP_KERNEL const DoubleProduct dp = DP_FOR_DETERMINANT_EXPANSION[3*corner + (row - 1)]; // get edge by using correspondence between Double Product and Edge - auto const edge = TetraEdge(dp); + TetraEdge edge = TetraEdge(dp); // use edge only if it is surrounded by the surface if( _triangleSurroundsEdgeCache[edge] ) diff --git a/src/INTERP_KERNEL/TranslationRotationMatrix.hxx b/src/INTERP_KERNEL/TranslationRotationMatrix.hxx index a307de0ba..648059251 100644 --- a/src/INTERP_KERNEL/TranslationRotationMatrix.hxx +++ b/src/INTERP_KERNEL/TranslationRotationMatrix.hxx @@ -85,12 +85,12 @@ namespace INTERP_KERNEL void rotate_x (double* P) { _rotation_coeffs[0]=1.0; - double const r_sqr = P[1]*P[1]+P[2]*P[2]; + double r_sqr = P[1]*P[1]+P[2]*P[2]; if (r_sqr < EPS) {_rotation_coeffs[4]=1.0; _rotation_coeffs[8]=1.0; return;} - double const r = sqrt(r_sqr); - double const cos =P[1]/r; - double const sin =P[2]/r; + double r = sqrt(r_sqr); + double cos =P[1]/r; + double sin =P[2]/r; _rotation_coeffs[4]=cos; _rotation_coeffs[5]=sin; @@ -104,12 +104,12 @@ namespace INTERP_KERNEL void rotate_z (double* P) { _rotation_coeffs[8]=1.0; - double const r_sqr = P[0]*P[0]+P[1]*P[1]; + double r_sqr = P[0]*P[0]+P[1]*P[1]; if (r_sqr < EPS) {_rotation_coeffs[4]=1.0; _rotation_coeffs[0]=1.0; return;} - double const r = sqrt(r_sqr); - double const cos =P[0]/r; - double const sin =P[1]/r; + double r = sqrt(r_sqr); + double cos =P[0]/r; + double sin =P[1]/r; _rotation_coeffs[0]=cos; _rotation_coeffs[1]=sin; diff --git a/src/INTERP_KERNEL/TriangulationIntersector.hxx b/src/INTERP_KERNEL/TriangulationIntersector.hxx index 6afe43ffa..3b84a72a4 100644 --- a/src/INTERP_KERNEL/TriangulationIntersector.hxx +++ b/src/INTERP_KERNEL/TriangulationIntersector.hxx @@ -21,8 +21,11 @@ #ifndef __TRIANGULATIONINTERSECTOR_HXX__ #define __TRIANGULATIONINTERSECTOR_HXX__ -#include "NormalizedUnstructuredMesh.hxx" -#include +#include "PlanarIntersectorP0P0.hxx" +#include "PlanarIntersectorP0P1.hxx" +#include "PlanarIntersectorP1P0.hxx" +#include "PlanarIntersectorP1P1.hxx" +#include "PlanarIntersectorP1P0Bary.hxx" namespace INTERP_KERNEL { @@ -32,7 +35,7 @@ namespace INTERP_KERNEL public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; static const int MESHDIM=MyMeshType::MY_MESHDIM; - using ConnType = typename MyMeshType::MyConnType; + typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; public: TriangulationIntersector(const MyMeshType& meshT, const MyMeshType& meshS, diff --git a/src/INTERP_KERNEL/TriangulationIntersector.txx b/src/INTERP_KERNEL/TriangulationIntersector.txx index a15de1a0b..985c20109 100644 --- a/src/INTERP_KERNEL/TriangulationIntersector.txx +++ b/src/INTERP_KERNEL/TriangulationIntersector.txx @@ -20,15 +20,16 @@ #ifndef __TRIANGULATIONINTERSECTOR_TXX__ #define __TRIANGULATIONINTERSECTOR_TXX__ -#include "InterpKernelUtilities.hxx" #include "TriangulationIntersector.hxx" -#include "PlanarIntersector.hxx" +#include "PlanarIntersectorP0P0.txx" +#include "PlanarIntersectorP0P1.txx" +#include "PlanarIntersectorP1P0.txx" +#include "PlanarIntersectorP1P0Bary.txx" + #include "InterpolationUtils.hxx" +#include "PlanarIntersector.hxx" #include -#include - - #define TRI_INTERSECTOR TriangulationIntersector #define TRI_INTER_TEMPLATE template -#include -#include -#include #define NB_TETRA_SIDES 4 #define NB_TETRA_NODES 4 @@ -108,7 +103,7 @@ namespace INTERP_KERNEL } // check if polygon orientation is same as the one of triangle - auto p = pPolygonA->begin(), pEnd = pPolygonA->end(); + std::vector::const_iterator p = pPolygonA->begin(), pEnd = pPolygonA->end(); #ifdef DMP_UNITTETRAINTERSECTIONBARY std::cout.precision(18); std::cout << "**** int polygon() " << std::endl; @@ -232,7 +227,7 @@ namespace INTERP_KERNEL baryCenter[0] = baryCenter[1] = baryCenter[2] = 0.; - auto f = _faces.begin(), fEnd = _faces.end(); + std::list< std::vector< double* > >::iterator f = _faces.begin(), fEnd = _faces.end(); double * PP = f->at(0); for ( ++f; f != fEnd; ++f ) @@ -242,7 +237,7 @@ namespace INTERP_KERNEL continue; bool pBelongsToPoly = false; - auto v = polygon.begin(), vEnd = polygon.end(); + std::vector::iterator v = polygon.begin(), vEnd = polygon.end(); for ( ; !pBelongsToPoly && v != vEnd; ++v ) pBelongsToPoly = samePoint( PP, *v ); if ( pBelongsToPoly ) @@ -315,13 +310,14 @@ namespace INTERP_KERNEL bool sideAdded[NB_TETRA_SIDES] = { false, false, false, false }; int nbAddedSides = 0; - auto f = _faces.begin(), fEnd = _faces.end(); + std::list< std::vector< double* > >::iterator f = _faces.begin(), fEnd = _faces.end(); for ( ; f != fEnd; ++f ) { - std::vector< double* > const& polygon = *f; + std::vector< double* >& polygon = *f; double coordSum[3] = {0,0,0}; - for (auto p : polygon) + for ( int i = 0; i < (int)polygon.size(); ++i ) { + double* p = polygon[i]; coordSum[0] += p[0]; coordSum[1] += p[1]; coordSum[2] += p[2]; @@ -342,12 +338,12 @@ namespace INTERP_KERNEL // Add segments of already added polygons to future polygonal faces on sides of tetra // --------------------------------------------------------------------------------- - std::size_t const nbIntersectPolygs = _faces.size(); + std::size_t nbIntersectPolygs = _faces.size(); std::vector< double* > * sideFaces[ 4 ]; // future polygons on sides of tetra for ( int i = 0; i < NB_TETRA_SIDES; ++i ) { - sideFaces[ i ]=nullptr; + sideFaces[ i ]=0; if ( !sideAdded[ i ] ) { _faces.push_back( std::vector< double* > () ); @@ -440,7 +436,7 @@ namespace INTERP_KERNEL if ( ic ) corner2Poly[ ic-1 ] -= 1.0; // _polyNormals are outside of a tetrahedron - double const dot = dotprod<3>( corner2Poly, &_polyNormals[iF][0] ); + double dot = dotprod<3>( corner2Poly, &_polyNormals[iF][0] ); if ( dot < -DEFAULT_ABS_TOL*DEFAULT_ABS_TOL ) { #ifdef DMP_UNITTETRAINTERSECTIONBARY @@ -458,7 +454,7 @@ namespace INTERP_KERNEL if ( !sideFaces[i] ) continue; std::vector< double* >& sideFace = *sideFaces[i]; - std::size_t const nbPoints = sideFace.size(); + std::size_t nbPoints = sideFace.size(); if ( nbPoints == 0 ) continue; // not intersected face at all - no cut off corners can be detected @@ -468,10 +464,10 @@ namespace INTERP_KERNEL bool isSegmentOnEdge=false; for ( std::size_t ip = 0; ip < nbPoints; ++ip ) { - std::size_t const isSegmentEnd = ( ip % 2 ); + std::size_t isSegmentEnd = ( ip % 2 ); double* p = sideFace[ ip ]; - double* p2 = isSegmentEnd ? nullptr : sideFace[ip+1]; + double* p2 = isSegmentEnd ? 0 : sideFace[ip+1]; if ( !isSegmentEnd ) isSegmentOnEdge = false; // initialize @@ -586,7 +582,7 @@ namespace INTERP_KERNEL if ( !sideFaces[ i ] ) continue; std::vector< double* >& sideFace = *sideFaces[i]; - int const excludeCorner = (i + 1) % NB_TETRA_NODES; + int excludeCorner = (i + 1) % NB_TETRA_NODES; for ( int ic = 0; ic < NB_TETRA_NODES; ++ic ) { if ( !cutOffCorners[ ic ] && ic != excludeCorner ) @@ -647,7 +643,7 @@ namespace INTERP_KERNEL sortIntersectionPolygon( A, _barycenterA ); } // exclude equal points - auto v = _polygonA.begin(), vEnd = _polygonA.end(); + std::vector< double* >::iterator v = _polygonA.begin(), vEnd = _polygonA.end(); face.push_back( *v ); *v = 0; for ( ++v; v != vEnd; ++v ) @@ -716,14 +712,14 @@ namespace INTERP_KERNEL void UnitTetraIntersectionBary::clearPolygons(bool andFaces) { - for(auto & it : _polygonA) - { delete[] it; - it = nullptr; + for(std::vector::iterator it = _polygonA.begin() ; it != _polygonA.end() ; ++it) + { delete[] *it; + *it = 0; } - for(auto & it : _polygonB) + for(std::vector::iterator it = _polygonB.begin() ; it != _polygonB.end() ; ++it) { - delete[] it; - it = nullptr; + delete[] *it; + *it = 0; } _polygonA.clear(); @@ -731,14 +727,14 @@ namespace INTERP_KERNEL if ( andFaces ) { - auto f = this->_faces.begin(), fEnd = this->_faces.end(); + std::list< std::vector< double* > >::iterator f = this->_faces.begin(), fEnd = this->_faces.end(); for ( ; f != fEnd; ++f ) { std::vector< double* >& polygon = *f; - for(auto & it : polygon) + for(std::vector::iterator it = polygon.begin() ; it != polygon.end() ; ++it) { - delete[] it; - it = nullptr; + delete[] *it; + *it = 0; } } this->_faces.clear(); diff --git a/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx b/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx index 1bf5b78f6..cf7e84ff8 100644 --- a/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx +++ b/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx @@ -21,6 +21,7 @@ #ifndef __VTKNORMALIZEDUNSTRUCTUREDMESH_HXX__ #define __VTKNORMALIZEDUNSTRUCTUREDMESH_HXX__ +#include "NormalizedUnstructuredMesh.hxx" #include "vtkType.h" diff --git a/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.txx b/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.txx index 571680a2b..7e8fd1c16 100644 --- a/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.txx +++ b/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.txx @@ -20,6 +20,7 @@ #ifndef __VTKNORMALIZEDUNSTRUCTUREDMESH_TXX__ #define __VTKNORMALIZEDUNSTRUCTUREDMESH_TXX__ +#include "VTKNormalizedUnstructuredMesh.hxx" #include "vtkUnstructuredGrid.h" #include "vtkCellArray.h" diff --git a/src/INTERP_KERNEL/VectorUtils.hxx b/src/INTERP_KERNEL/VectorUtils.hxx index 446358ac7..4d626c334 100644 --- a/src/INTERP_KERNEL/VectorUtils.hxx +++ b/src/INTERP_KERNEL/VectorUtils.hxx @@ -21,11 +21,12 @@ #define __VECTORUTILS_HXX__ #include -#include #include #include +#include #include #include +#include namespace INTERP_KERNEL @@ -224,7 +225,7 @@ namespace INTERP_KERNEL */ inline double normInf(const double mat[9]) { - double const ret(std::max(sumOfAbsoluteValues(mat),sumOfAbsoluteValues(mat+3))); + double ret(std::max(sumOfAbsoluteValues(mat),sumOfAbsoluteValues(mat+3))); return std::max(ret,sumOfAbsoluteValues(mat+6)); } diff --git a/src/INTERP_KERNEL/VolSurfFormulae.hxx b/src/INTERP_KERNEL/VolSurfFormulae.hxx index ad529a898..8d51d48f5 100644 --- a/src/INTERP_KERNEL/VolSurfFormulae.hxx +++ b/src/INTERP_KERNEL/VolSurfFormulae.hxx @@ -21,18 +21,15 @@ #ifndef __VOLSURFFORMULAE_HXX__ #define __VOLSURFFORMULAE_HXX__ -#include "InterpKernelGeo2DNode.hxx" #include "InterpolationUtils.hxx" #include "InterpKernelException.hxx" +#include "InterpKernelGeo2DEdgeLin.hxx" +#include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" #include "MCIdType.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include -#include #include #include -#include namespace INTERP_KERNEL { @@ -64,7 +61,7 @@ namespace INTERP_KERNEL if(spaceDim==2) { Edge *ed=Edge::BuildEdgeFrom3Points(begin,middle,end); - double const ret=ed->getCurveLength(); ed->decrRef(); + double ret=ed->getCurveLength(); ed->decrRef(); return ret; } else @@ -216,7 +213,7 @@ namespace INTERP_KERNEL calculateBarycenterDyn(coords,nbOfPtsInPolygs,spaceDim,coordOfBary); for ( mcIdType i=0; igetArea(); + double ret=pol->getArea(); delete pol; return -ret; } @@ -301,19 +298,19 @@ namespace INTERP_KERNEL double f1 = (p1[0]-p3[0])/2.0, f2 = (p1[1]-p3[1])/2.0, f3 = (p1[2]-p3[2])/2.0; double h1 = (p4[0]-p6[0])/2.0, h2 = (p4[1]-p6[1])/2.0, h3 = (p4[2]-p6[2])/2.0; - double const A = a1*c2*f3 - a1*c3*f2 - a2*c1*f3 + a2*c3*f1 + a3*c1*f2 - a3*c2*f1; - double const B = b1*c2*h3 - b1*c3*h2 - b2*c1*h3 + b2*c3*h1 + b3*c1*h2 - b3*c2*h1; - double const C = (a1*c2*h3 + b1*c2*f3) - (a1*c3*h2 + b1*c3*f2) + double A = a1*c2*f3 - a1*c3*f2 - a2*c1*f3 + a2*c3*f1 + a3*c1*f2 - a3*c2*f1; + double B = b1*c2*h3 - b1*c3*h2 - b2*c1*h3 + b2*c3*h1 + b3*c1*h2 - b3*c2*h1; + double C = (a1*c2*h3 + b1*c2*f3) - (a1*c3*h2 + b1*c3*f2) - (a2*c1*h3 + b2*c1*f3) + (a2*c3*h1 + b2*c3*f1) + (a3*c1*h2 + b3*c1*f2) - (a3*c2*h1 + b3*c2*f1); - double const D = a1*d2*f3 - a1*d3*f2 - a2*d1*f3 + a2*d3*f1 + a3*d1*f2 - a3*d2*f1; - double const E = b1*d2*h3 - b1*d3*h2 - b2*d1*h3 + b2*d3*h1 + b3*d1*h2 - b3*d2*h1; - double const F = (a1*d2*h3 + b1*d2*f3) - (a1*d3*h2 + b1*d3*f2) + double D = a1*d2*f3 - a1*d3*f2 - a2*d1*f3 + a2*d3*f1 + a3*d1*f2 - a3*d2*f1; + double E = b1*d2*h3 - b1*d3*h2 - b2*d1*h3 + b2*d3*h1 + b3*d1*h2 - b3*d2*h1; + double F = (a1*d2*h3 + b1*d2*f3) - (a1*d3*h2 + b1*d3*f2) - (a2*d1*h3 + b2*d1*f3) + (a2*d3*h1 + b2*d3*f1) + (a3*d1*h2 + b3*d1*f2) - (a3*d2*h1 + b3*d2*f1); - double const G = a1*e2*f3 - a1*e3*f2 - a2*e1*f3 + a2*e3*f1 + a3*e1*f2 - a3*e2*f1; - double const H = b1*e2*h3 - b1*e3*h2 - b2*e1*h3 + b2*e3*h1 + b3*e1*h2 - b3*e2*h1; - double const P = (a1*e2*h3 + b1*e2*f3) - (a1*e3*h2 + b1*e3*f2) + double G = a1*e2*f3 - a1*e3*f2 - a2*e1*f3 + a2*e3*f1 + a3*e1*f2 - a3*e2*f1; + double H = b1*e2*h3 - b1*e3*h2 - b2*e1*h3 + b2*e3*h1 + b3*e1*h2 - b3*e2*h1; + double P = (a1*e2*h3 + b1*e2*f3) - (a1*e3*h2 + b1*e3*f2) - (a2*e1*h3 + b2*e1*f3) + (a2*e3*h1 + b2*e3*f1) + (a3*e1*h2 + b3*e1*f2) - (a3*e2*h1 + b3*e2*f1); @@ -341,87 +338,87 @@ namespace INTERP_KERNEL double s1=(pt2[0]-pt6[0])/8.0, s2=(pt2[1]-pt6[1])/8.0, s3=(pt2[2]-pt6[2])/8.0; double t1=(pt1[0]-pt5[0])/8.0, t2=(pt1[1]-pt5[1])/8.0, t3=(pt1[2]-pt5[2])/8.0; - double const A = a1*e2*q3 - a1*e3*q2 - a2*e1*q3 + a2*e3*q1 + a3*e1*q2 - a3*e2*q1; - double const B = c1*h2*q3 - c1*h3*q2 - c2*h1*q3 + c2*h3*q1 + c3*h1*q2 - c3*h2*q1; - double const C = (a1*h2 + c1*e2)*q3 - (a1*h3 + c1*e3)*q2 + double A = a1*e2*q3 - a1*e3*q2 - a2*e1*q3 + a2*e3*q1 + a3*e1*q2 - a3*e2*q1; + double B = c1*h2*q3 - c1*h3*q2 - c2*h1*q3 + c2*h3*q1 + c3*h1*q2 - c3*h2*q1; + double C = (a1*h2 + c1*e2)*q3 - (a1*h3 + c1*e3)*q2 - (a2*h1 + c2*e1)*q3 + (a2*h3 + c2*e3)*q1 + (a3*h1 + c3*e1)*q2 - (a3*h2 + c3*e2)*q1; - double const D = b1*e2*s3 - b1*e3*s2 - b2*e1*s3 + b2*e3*s1 + b3*e1*s2 - b3*e2*s1; - double const E = d1*h2*s3 - d1*h3*s2 - d2*h1*s3 + d2*h3*s1 + d3*h1*s2 - d3*h2*s1; - double const F = (b1*h2 + d1*e2)*s3 - (b1*h3 + d1*e3)*s2 + double D = b1*e2*s3 - b1*e3*s2 - b2*e1*s3 + b2*e3*s1 + b3*e1*s2 - b3*e2*s1; + double E = d1*h2*s3 - d1*h3*s2 - d2*h1*s3 + d2*h3*s1 + d3*h1*s2 - d3*h2*s1; + double F = (b1*h2 + d1*e2)*s3 - (b1*h3 + d1*e3)*s2 - (b2*h1 + d2*e1)*s3 + (b2*h3 + d2*e3)*s1 + (b3*h1 + d3*e1)*s2 - (b3*h2 + d3*e2)*s1; - double const G = (a1*e2*s3 + b1*e2*q3) - (a1*e3*s2 + b1*e3*q2) + double G = (a1*e2*s3 + b1*e2*q3) - (a1*e3*s2 + b1*e3*q2) - (a2*e1*s3 + b2*e1*q3) + (a2*e3*s1 + b2*e3*q1) + (a3*e1*s2 + b3*e1*q2) - (a3*e2*s1 + b3*e2*q1); - double const H = (c1*h2*s3 + d1*h2*q3) - (c1*h3*s2 + d1*h3*q2) + double H = (c1*h2*s3 + d1*h2*q3) - (c1*h3*s2 + d1*h3*q2) - (c2*h1*s3 + d2*h1*q3) + (c2*h3*s1 + d2*h3*q1) + (c3*h1*s2 + d3*h1*q2) - (c3*h2*s1 + d3*h2*q1); - double const I = ((a1*h2 + c1*e2)*s3 + (b1*h2 + d1*e2)*q3) + double I = ((a1*h2 + c1*e2)*s3 + (b1*h2 + d1*e2)*q3) - ((a1*h3 + c1*e3)*s2 + (b1*h3 + d1*e3)*q2) - ((a2*h1 + c2*e1)*s3 + (b2*h1 + d2*e1)*q3) + ((a2*h3 + c2*e3)*s1 + (b2*h3 + d2*e3)*q1) + ((a3*h1 + c3*e1)*s2 + (b3*h1 + d3*e1)*q2) - ((a3*h2 + c3*e2)*s1 + (b3*h2 + d3*e2)*q1); - double const J = a1*f2*r3 - a1*f3*r2 - a2*f1*r3 + a2*f3*r1 + a3*f1*r2 - a3*f2*r1; - double const K = c1*p2*r3 - c1*p3*r2 - c2*p1*r3 + c2*p3*r1 + c3*p1*r2 - c3*p2*r1; - double const L = (a1*p2 + c1*f2)*r3 - (a1*p3 + c1*f3)*r2 + double J = a1*f2*r3 - a1*f3*r2 - a2*f1*r3 + a2*f3*r1 + a3*f1*r2 - a3*f2*r1; + double K = c1*p2*r3 - c1*p3*r2 - c2*p1*r3 + c2*p3*r1 + c3*p1*r2 - c3*p2*r1; + double L = (a1*p2 + c1*f2)*r3 - (a1*p3 + c1*f3)*r2 - (a2*p1 + c2*f1)*r3 + (a2*p3 + c2*f3)*r1 + (a3*p1 + c3*f1)*r2 - (a3*p2 + c3*f2)*r1; - double const M = b1*f2*t3 - b1*f3*t2 - b2*f1*t3 + b2*f3*t1 + b3*f1*t2 - b3*f2*t1; - double const N = d1*p2*t3 - d1*p3*t2 - d2*p1*t3 + d2*p3*t1 + d3*p1*t2 - d3*p2*t1; - double const O = (b1*p2 + d1*f2)*t3 - (b1*p3 + d1*f3)*t2 + double M = b1*f2*t3 - b1*f3*t2 - b2*f1*t3 + b2*f3*t1 + b3*f1*t2 - b3*f2*t1; + double N = d1*p2*t3 - d1*p3*t2 - d2*p1*t3 + d2*p3*t1 + d3*p1*t2 - d3*p2*t1; + double O = (b1*p2 + d1*f2)*t3 - (b1*p3 + d1*f3)*t2 - (b2*p1 + d2*f1)*t3 + (b2*p3 + d2*f3)*t1 + (b3*p1 + d3*f1)*t2 - (b3*p2 + d3*f2)*t1; - double const P = (a1*f2*t3 + b1*f2*r3) - (a1*f3*t2 + b1*f3*r2) + double P = (a1*f2*t3 + b1*f2*r3) - (a1*f3*t2 + b1*f3*r2) - (a2*f1*t3 + b2*f1*r3) + (a2*f3*t1 + b2*f3*r1) + (a3*f1*t2 + b3*f1*r2) - (a3*f2*t1 + b3*f2*r1); - double const Q = (c1*p2*t3 + d1*p2*r3) - (c1*p3*t2 + d1*p3*r2) + double Q = (c1*p2*t3 + d1*p2*r3) - (c1*p3*t2 + d1*p3*r2) - (c2*p1*t3 + d2*p1*r3) + (c2*p3*t1 + d2*p3*r1) + (c3*p1*t2 + d3*p1*r2) - (c3*p2*t1 + d3*p2*r1); - double const R = ((a1*p2 + c1*f2)*t3 + (b1*p2 + d1*f2)*r3) + double R = ((a1*p2 + c1*f2)*t3 + (b1*p2 + d1*f2)*r3) - ((a1*p3 + c1*f3)*t2 + (b1*p3 + d1*f3)*r2) - ((a2*p1 + c2*f1)*t3 + (b2*p1 + d2*f1)*r3) + ((a2*p3 + c2*f3)*t1 + (b2*p3 + d2*f3)*r1) + ((a3*p1 + c3*f1)*t2 + (b3*p1 + d3*f1)*r2) - ((a3*p2 + c3*f2)*t1 + (b3*p2 + d3*f2)*r1); - double const S = (a1*e2*r3 + a1*f2*q3) - (a1*e3*r2 + a1*f3*q2) + double S = (a1*e2*r3 + a1*f2*q3) - (a1*e3*r2 + a1*f3*q2) - (a2*e1*r3 + a2*f1*q3) + (a2*e3*r1 + a2*f3*q1) + (a3*e1*r2 + a3*f1*q2) - (a3*e2*r1 + a3*f2*q1); - double const T = (c1*h2*r3 + c1*p2*q3) - (c1*h3*r2 + c1*p3*q2) + double T = (c1*h2*r3 + c1*p2*q3) - (c1*h3*r2 + c1*p3*q2) - (c2*h1*r3 + c2*p1*q3) + (c2*h3*r1 + c2*p3*q1) + (c3*h1*r2 + c3*p1*q2) - (c3*h2*r1 + c3*p2*q1); - double const U = ((a1*h2 + c1*e2)*r3 + (a1*p2 + c1*f2)*q3) + double U = ((a1*h2 + c1*e2)*r3 + (a1*p2 + c1*f2)*q3) - ((a1*h3 + c1*e3)*r2 + (a1*p3 + c1*f3)*q2) - ((a2*h1 + c2*e1)*r3 + (a2*p1 + c2*f1)*q3) + ((a2*h3 + c2*e3)*r1 + (a2*p3 + c2*f3)*q1) + ((a3*h1 + c3*e1)*r2 + (a3*p1 + c3*f1)*q2) - ((a3*h2 + c3*e2)*r1 + (a3*p2 + c3*f2)*q1); - double const V = (b1*e2*t3 + b1*f2*s3) - (b1*e3*t2 + b1*f3*s2) + double V = (b1*e2*t3 + b1*f2*s3) - (b1*e3*t2 + b1*f3*s2) - (b2*e1*t3 + b2*f1*s3) + (b2*e3*t1 + b2*f3*s1) + (b3*e1*t2 + b3*f1*s2) - (b3*e2*t1 + b3*f2*s1); - double const W = (d1*h2*t3 + d1*p2*s3) - (d1*h3*t2 + d1*p3*s2) + double W = (d1*h2*t3 + d1*p2*s3) - (d1*h3*t2 + d1*p3*s2) - (d2*h1*t3 + d2*p1*s3) + (d2*h3*t1 + d2*p3*s1) + (d3*h1*t2 + d3*p1*s2) - (d3*h2*t1 + d3*p2*s1); - double const X = ((b1*h2 + d1*e2)*t3 + (b1*p2 + d1*f2)*s3) + double X = ((b1*h2 + d1*e2)*t3 + (b1*p2 + d1*f2)*s3) - ((b1*h3 + d1*e3)*t2 + (b1*p3 + d1*f3)*s2) - ((b2*h1 + d2*e1)*t3 + (b2*p1 + d2*f1)*s3) + ((b2*h3 + d2*e3)*t1 + (b2*p3 + d2*f3)*s1) + ((b3*h1 + d3*e1)*t2 + (b3*p1 + d3*f1)*s2) - ((b3*h2 + d3*e2)*t1 + (b3*p2 + d3*f2)*s1); - double const Y = (a1*e2*t3 + a1*f2*s3 + b1*e2*r3 + b1*f2*q3) + double Y = (a1*e2*t3 + a1*f2*s3 + b1*e2*r3 + b1*f2*q3) - (a1*e3*t2 + a1*f3*s2 + b1*e3*r2 + b1*f3*q2) - (a2*e1*t3 + a2*f1*s3 + b2*e1*r3 + b2*f1*q3) + (a2*e3*t1 + a2*f3*s1 + b2*e3*r1 + b2*f3*q1) + (a3*e1*t2 + a3*f1*s2 + b3*e1*r2 + b3*f1*q2) - (a3*e2*t1 + a3*f2*s1 + b3*e2*r1 + b3*f2*q1); - double const Z = (c1*h2*t3 + c1*p2*s3 + d1*h2*r3 + d1*p2*q3) + double Z = (c1*h2*t3 + c1*p2*s3 + d1*h2*r3 + d1*p2*q3) - (c1*h3*t2 + c1*p3*s2 + d1*h3*r2 + d1*p3*q2) - (c2*h1*t3 + c2*p1*s3 + d2*h1*r3 + d2*p1*q3) + (c2*h3*t1 + c2*p3*s1 + d2*h3*r1 + d2*p3*q1) + (c3*h1*t2 + c3*p1*s2 + d3*h1*r2 + d3*p1*q2) - (c3*h2*t1 + c3*p2*s1 + d3*h2*r1 + d3*p2*q1); - double const AA = ((a1*h2 + c1*e2)*t3 + (a1*p2 + c1*f2)*s3 + double AA = ((a1*h2 + c1*e2)*t3 + (a1*p2 + c1*f2)*s3 +(b1*h2 + d1*e2)*r3 + (b1*p2 + d1*f2)*q3) - ((a1*h3 + c1*e3)*t2 + (a1*p3 + c1*f3)*s2 +(b1*h3 + d1*e3)*r2 + (b1*p3 + d1*f3)*q2) @@ -538,11 +535,11 @@ namespace INTERP_KERNEL coords[3*OTT::coo2C(connec[i+1])+2])/3.; ConnType tmpConn[3]={connec[0],connec[i],connec[i+1]}; areaVectorOfPolygon(tmpConn,3,coords,tmpArea); - double const norm2=sqrt(tmpArea[0]*tmpArea[0]+tmpArea[1]*tmpArea[1]+tmpArea[2]*tmpArea[2]); + double norm2=sqrt(tmpArea[0]*tmpArea[0]+tmpArea[1]*tmpArea[1]+tmpArea[2]*tmpArea[2]); if(norm2>1e-12) { tmpArea[0]/=norm2; tmpArea[1]/=norm2; tmpArea[2]/=norm2; - double const signOfArea=area[0]*tmpArea[0]+area[1]*tmpArea[1]+area[2]*tmpArea[2]; + double signOfArea=area[0]*tmpArea[0]+area[1]*tmpArea[1]+area[2]*tmpArea[2]; res[0]+=signOfArea*norm2*v[0]/norm; res[1]+=signOfArea*norm2*v[1]/norm; res[2]+=signOfArea*norm2*v[2]/norm; } } @@ -604,13 +601,13 @@ namespace INTERP_KERNEL // projection to (u,v) of each faces of polyh to compute integral(x^2/2) on each faces. double normal[3]; areaVectorOfPolygon(work,nbOfNodesOfCurFace,coords,normal); - double const normOfNormal=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]); + double normOfNormal=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]); if(normOfNormal::min()) continue; normal[0]/=normOfNormal; normal[1]/=normOfNormal; normal[2]/=normOfNormal; double u[2]={normal[1],-normal[0]}; - double const s=sqrt(u[0]*u[0]+u[1]*u[1]); - double const c=normal[2]; + double s=sqrt(u[0]*u[0]+u[1]*u[1]); + double c=normal[2]; if(fabs(s)>1e-12) { u[0]/=std::abs(s); u[1]/=std::abs(s); @@ -622,30 +619,30 @@ namespace INTERP_KERNEL normal[1]*coords[3*OTT::coo2C(work[0])+1]+ normal[2]*coords[3*OTT::coo2C(work[0])+2]; // A,B,D,F,G,H,L,M,N coeffs of rotation matrix defined by (u,c,s) - double const A=u[0]*u[0]*(1-c)+c; - double const B=u[0]*u[1]*(1-c); - double const D=u[1]*s; - double const F=B; - double const G=u[1]*u[1]*(1-c)+c; - double const H=-u[0]*s; - double const L=-u[1]*s; - double const M=u[0]*s; - double const N=c; - double const CX=-w*D; - double const CY=-w*H; - double const CZ=-w*N; + double A=u[0]*u[0]*(1-c)+c; + double B=u[0]*u[1]*(1-c); + double D=u[1]*s; + double F=B; + double G=u[1]*u[1]*(1-c)+c; + double H=-u[0]*s; + double L=-u[1]*s; + double M=u[0]*s; + double N=c; + double CX=-w*D; + double CY=-w*H; + double CZ=-w*N; for(int j=0;j::coo2C(work[j]); const double *p2=coords+3*OTT::coo2C(work[(j+1)%nbOfNodesOfCurFace]); - double const u1=A*p1[0]+B*p1[1]+D*p1[2]; - double const u2=A*p2[0]+B*p2[1]+D*p2[2]; - double const v1=F*p1[0]+G*p1[1]+H*p1[2]; - double const v2=F*p2[0]+G*p2[1]+H*p2[2]; + double u1=A*p1[0]+B*p1[1]+D*p1[2]; + double u2=A*p2[0]+B*p2[1]+D*p2[2]; + double v1=F*p1[0]+G*p1[1]+H*p1[2]; + double v2=F*p2[0]+G*p2[1]+H*p2[2]; // - double const gx=integrationOverA3DLine(u1,v1,u2,v2,A,B,CX); - double const gy=integrationOverA3DLine(u1,v1,u2,v2,F,G,CY); - double const gz=integrationOverA3DLine(u1,v1,u2,v2,L,M,CZ); + double gx=integrationOverA3DLine(u1,v1,u2,v2,A,B,CX); + double gy=integrationOverA3DLine(u1,v1,u2,v2,F,G,CY); + double gz=integrationOverA3DLine(u1,v1,u2,v2,L,M,CZ); res[0]+=gx*normal[0]; res[1]+=gy*normal[1]; res[2]+=gz*normal[2]; @@ -668,7 +665,7 @@ namespace INTERP_KERNEL int nbOfNodesOfCurFace=(int)std::distance(work,work2); double normal[3]; areaVectorOfPolygon(work,nbOfNodesOfCurFace,coords,normal); - double const normOfNormal=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]); + double normOfNormal=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]); if(normOfNormal::min()) continue; sum+=normOfNormal; @@ -793,7 +790,7 @@ namespace INTERP_KERNEL res[0]=0.; res[1]=0.; for(mcIdType i=0;i inline void computePolygonBarycenter2D(const ConnType *connec, mcIdType lgth, const double *coords, double *res) { - auto **coords2=new double *[lgth]; + double **coords2=new double *[lgth]; for(mcIdType i=0;i(coords+2*OTT::coo2C(connec[i])); computePolygonBarycenter2DEngine(coords2,lgth,res); diff --git a/src/INTERP_KERNEL/VolSurfUser.cxx b/src/INTERP_KERNEL/VolSurfUser.cxx index 5d7aaa170..52d594b04 100644 --- a/src/INTERP_KERNEL/VolSurfUser.cxx +++ b/src/INTERP_KERNEL/VolSurfUser.cxx @@ -21,11 +21,9 @@ #include "VolSurfUser.hxx" #include "InterpKernelAutoPtr.hxx" #include "InterpolationUtils.hxx" -#include "MCIdType.hxx" +#include "VectorUtils.hxx" #include -#include -#include #include #include #include @@ -37,29 +35,29 @@ namespace INTERP_KERNEL */ double OrthoDistanceFromPtToPlaneInSpaceDim3(const double *p, const double *p1, const double *p2, const double *p3) { - double const prec = 1.0e-14; - double const T[2][3] = {{p1[0] - p2[0], p1[1] - p2[1], p1[2] - p2[2]}, + double prec = 1.0e-14; + double T[2][3] = {{p1[0] - p2[0], p1[1] - p2[1], p1[2] - p2[2]}, {p3[0] - p2[0], p3[1] - p2[1], p3[2] - p2[2]}}; - double const N[3] = {T[0][1]*T[1][2]-T[0][2]*T[1][1], + double N[3] = {T[0][1]*T[1][2]-T[0][2]*T[1][1], T[0][2]*T[1][0]-T[0][0]*T[1][2], T[0][0]*T[1][1]-T[0][1]*T[1][0]}; - double const norm2 = N[0]*N[0] + N[1]*N[1] + N[2]*N[2]; + double norm2 = N[0]*N[0] + N[1]*N[1] + N[2]*N[2]; if (norm2 < prec) throw INTERP_KERNEL::Exception("OrthoDistanceFromPtToPlaneInSpaceDim3: degenerated normal vector!"); - double const num = N[0]*(p[0]-p1[0]) + N[1]*(p[1]-p1[1]) + N[2]*(p[2]-p1[2]); + double num = N[0]*(p[0]-p1[0]) + N[1]*(p[1]-p1[1]) + N[2]*(p[2]-p1[2]); return num/sqrt(norm2); } double SquareDistanceFromPtToSegInSpaceDim2(const double *pt, const double *pt0Seg2, const double *pt1Seg2, std::size_t &nbOfHint) { double dx=pt1Seg2[0]-pt0Seg2[0],dy=pt1Seg2[1]-pt0Seg2[1]; - double const norm=sqrt(dx*dx+dy*dy); + double norm=sqrt(dx*dx+dy*dy); if(norm==0.) return (pt[0]-pt0Seg2[0])*(pt[0]-pt0Seg2[0])+(pt[1]-pt0Seg2[1])*(pt[1]-pt0Seg2[1]);//return std::numeric_limits::max(); dx/=norm; dy/=norm; double dx2=pt[0]-pt0Seg2[0],dy2=pt[1]-pt0Seg2[1]; - double const dotP=(dx2*dx+dy2*dy); + double dotP=(dx2*dx+dy2*dy); if(dotP<0. || dotP>norm) return dotP<0.?(pt[0]-pt0Seg2[0])*(pt[0]-pt0Seg2[0])+(pt[1]-pt0Seg2[1])*(pt[1]-pt0Seg2[1]):(pt[0]-pt1Seg2[0])*(pt[0]-pt1Seg2[0])+(pt[1]-pt1Seg2[1])*(pt[1]-pt1Seg2[1]); nbOfHint++; @@ -78,17 +76,17 @@ namespace INTERP_KERNEL w[i] = pt[i] - pt0Seg2[i]; } - double const c1 = dotprod<3>(w,v); + double c1 = dotprod<3>(w,v); if ( c1 <= 0 ) return norm<3>(w); - double const c2 = dotprod<3>(v,v); + double c2 = dotprod<3>(v,v); if ( c2 <= c1 ) { for(int i=0; i < 3; i++) w[i] = pt[i] - pt1Seg2[i]; return norm<3>(w); } - double const b = c1 / c2; + double b = c1 / c2; for(int i=0; i < 3; i++) w[i] = pt0Seg2[i] + b * v[i] - pt[i]; return norm<3>(w); @@ -145,7 +143,7 @@ namespace INTERP_KERNEL double a00=dotprod<3>(edge0, edge0), a01=dotprod<3>(edge0,edge1), a11=dotprod<3>(edge1,edge1); double b0=dotprod<3>(diff, edge0), b1=dotprod<3>(diff, edge1), c=dotprod<3>(diff, diff); - double const det = fabs(a00*a11 - a01*a01); + double det = fabs(a00*a11 - a01*a01); double s = a01*b1 - a11*b0, t = a01*b0 - a00*b1; double sDist; @@ -173,13 +171,13 @@ namespace INTERP_KERNEL { // points are colinear (degenerated triangle) // => Compute distance between segments - double const distance = std::min(DistanceFromPtToSegInSpaceDim3(pt, pt0Tri3, pt1Tri3), + double distance = std::min(DistanceFromPtToSegInSpaceDim3(pt, pt0Tri3, pt1Tri3), DistanceFromPtToSegInSpaceDim3(pt, pt1Tri3, pt2Tri3)); return distance; } // else we can divide by non-zero - double const invDet = 1 / det; + double invDet = 1 / det; s *= invDet; t *= invDet; sDist = s*(a00*s + a01*t + 2*b0) + t*(a01*s + a11*t + 2*b1) + c; } @@ -193,11 +191,11 @@ namespace INTERP_KERNEL if (t < 0.0) // region 6 sDist = _HelperDistancePtToTri3D_2(a01, a11, a00, b1, b0, c); else { // region 1 - double const numer = a11 + b1 - a01 - b0; + double numer = a11 + b1 - a01 - b0; if (numer <= 0.0) sDist = a11 + 2*b1 + c; else { - double const denom = a00 - 2*a01 + a11; + double denom = a00 - 2*a01 + a11; if (numer >= denom) sDist = a00 + 2*b0 + c; else { @@ -217,7 +215,7 @@ namespace INTERP_KERNEL double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const mcIdType *connOfPolygonBg, const mcIdType *connOfPolygonEnd, const double *coords) { - std::size_t const nbOfEdges=std::distance(connOfPolygonBg,connOfPolygonEnd); + std::size_t nbOfEdges=std::distance(connOfPolygonBg,connOfPolygonEnd); if(nbOfEdges<3) throw INTERP_KERNEL::Exception("DistanceFromPtToPolygonInSpaceDim3 : trying to compute a distance to a polygon containing less than 3 edges !"); double baryOfNodes[3]={0.,0.,0.}; @@ -235,12 +233,12 @@ namespace INTERP_KERNEL ptXY[2*i+1]=matrix[4]*coords[3*connOfPolygonBg[i]]+matrix[5]*coords[3*connOfPolygonBg[i]+1]+matrix[6]*coords[3*connOfPolygonBg[i]+2]+matrix[7]; } double xy[2]={matrix[0]*pt[0]+matrix[1]*pt[1]+matrix[2]*pt[2]+matrix[3],matrix[4]*pt[0]+matrix[5]*pt[1]+matrix[6]*pt[2]+matrix[7]}; - double const z=matrix[8]*pt[0]+matrix[9]*pt[1]+matrix[10]*pt[2]+matrix[11]; + double z=matrix[8]*pt[0]+matrix[9]*pt[1]+matrix[10]*pt[2]+matrix[11]; double ret=std::numeric_limits::max(); std::size_t nbOfHint=0; for(std::size_t i=0;i namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/VolSurfUser.txx b/src/INTERP_KERNEL/VolSurfUser.txx index 988a1db84..93a10c660 100644 --- a/src/INTERP_KERNEL/VolSurfUser.txx +++ b/src/INTERP_KERNEL/VolSurfUser.txx @@ -20,18 +20,12 @@ #ifndef __VOLSURFUSER_TXX__ #define __VOLSURFUSER_TXX__ -#include "NormalizedGeometricTypes" -#include "NormalizedUnstructuredMesh.hxx" -#include "MCIdType.hxx" -#include "InterpKernelGeo2DEdge.hxx" #include "VolSurfUser.hxx" #include "VolSurfFormulae.hxx" #include "InterpolationUtils.hxx" #include "VectorUtils.hxx" #include -#include -#include namespace INTERP_KERNEL { @@ -111,7 +105,7 @@ namespace INTERP_KERNEL break; case INTERP_KERNEL::NORM_POLYGON : { - const auto **pts=new const double *[lgth]; + const double **pts=new const double *[lgth]; for(int inod=0;inod::coo2C(connec[inod]); double val=INTERP_KERNEL::calculateAreaForPolyg(pts,lgth,SPACEDIM); @@ -121,7 +115,7 @@ namespace INTERP_KERNEL break; case INTERP_KERNEL::NORM_QPOLYG : { - const auto **pts=new const double *[lgth]; + const double **pts=new const double *[lgth]; for(int inod=0;inod::coo2C(connec[inod]); double val=INTERP_KERNEL::calculateAreaForQPolyg(pts,lgth,SPACEDIM); @@ -342,7 +336,7 @@ namespace INTERP_KERNEL { if(SPACEDIM==2) { - auto **pts=new double *[lgth]; + double **pts=new double *[lgth]; for(int i=0;i(coords+2*OTT::coo2C(connec[i])); computeQPolygonBarycenter2D(pts,lgth,2,res); @@ -449,8 +443,8 @@ namespace INTERP_KERNEL double AB = getDistanceBtw2Pts(PA,PB); double maxLength = AB; double BC = getDistanceBtw2Pts(PB,PC); if (BC > maxLength) maxLength = BC; double CA = getDistanceBtw2Pts(PC,PA); if (CA > maxLength) maxLength = CA; - double const perim( (AB+BC+CA)*0.5 ); - double const num( 2*sqrt(perim*(perim-AB)*(perim-BC)*(perim-CA)) ); + double perim( (AB+BC+CA)*0.5 ); + double num( 2*sqrt(perim*(perim-AB)*(perim-BC)*(perim-CA)) ); res[0] = num/AB; res[1] = num/BC; res[2] = num/CA; if (AB/maxLength <= EPS) res[0] = BC; diff --git a/src/INTERP_KERNELTest/BBTreeTest.cxx b/src/INTERP_KERNELTest/BBTreeTest.cxx index 9bb30e3fc..0ef5bf90b 100644 --- a/src/INTERP_KERNELTest/BBTreeTest.cxx +++ b/src/INTERP_KERNELTest/BBTreeTest.cxx @@ -18,9 +18,8 @@ // #include "BBTreeTest.hxx" -#include +#include #include -#include "BBTree.txx" #include "DirectedBoundingBox.hxx" namespace INTERP_TEST @@ -47,7 +46,7 @@ namespace INTERP_TEST void BBTreeTest::test_BBTree() { //bbox tree creation const int N=10; - auto* bbox=new double[4*N*N]; + double* bbox=new double[4*N*N]; for (int i=0; i const tree(bbox,nullptr,0,N*N); + BBTree<2> tree(bbox,0,0,N*N); std::vector elems; //box outside the tree @@ -130,10 +129,10 @@ namespace INTERP_TEST 0,-3,0, 2,-3,0, 2,-2,0, 0,-2,0, 10,-3,10, 12,-3,10, 12,-2,10, 10,-2,10 }; - INTERP_KERNEL::DirectedBoundingBox const shiftedBB_x( shifted_x, nbP, dim); - INTERP_KERNEL::DirectedBoundingBox const shiftedBB_X( shifted_X, nbP, dim); - INTERP_KERNEL::DirectedBoundingBox const shiftedBB_y( shifted_y, nbP, dim); - INTERP_KERNEL::DirectedBoundingBox const shiftedBB_Y( shifted_Y, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox shiftedBB_x( shifted_x, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox shiftedBB_X( shifted_X, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox shiftedBB_y( shifted_y, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox shiftedBB_Y( shifted_Y, nbP, dim); CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_x )); CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_X )); @@ -146,7 +145,7 @@ namespace INTERP_TEST 0,0,0, 2,0,0, 2,1,0, 0,1,0, 0,0,2, 2,0,2, 2,1,2, 0,1,2 }; - INTERP_KERNEL::DirectedBoundingBox const ibb( inters_coords, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox ibb( inters_coords, nbP, dim); CPPUNIT_ASSERT( !bb.isDisjointWith( ibb )); // overlapping non-directed BB @@ -205,8 +204,8 @@ namespace INTERP_TEST -3,0, -1,0, 7,10, 9,10, }; - INTERP_KERNEL::DirectedBoundingBox const shiftedBB_x( shifted_x, nbP, dim); - INTERP_KERNEL::DirectedBoundingBox const shiftedBB_X( shifted_X, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox shiftedBB_x( shifted_x, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox shiftedBB_X( shifted_X, nbP, dim); CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_x )); CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_X )); @@ -217,7 +216,7 @@ namespace INTERP_TEST 0,0, 2,0, 0,2, 2,2 }; - INTERP_KERNEL::DirectedBoundingBox const ibb( inters_coords, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox ibb( inters_coords, nbP, dim); CPPUNIT_ASSERT( !bb.isDisjointWith( ibb )); // overlapping non-directed BB @@ -271,8 +270,8 @@ namespace INTERP_TEST { -3.0, -0.001 }; - INTERP_KERNEL::DirectedBoundingBox const shiftedBB_x( shifted_x, nbP, dim); - INTERP_KERNEL::DirectedBoundingBox const shiftedBB_X( shifted_X, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox shiftedBB_x( shifted_x, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox shiftedBB_X( shifted_X, nbP, dim); CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_x )); CPPUNIT_ASSERT( bb.isDisjointWith( shiftedBB_X )); @@ -282,7 +281,7 @@ namespace INTERP_TEST { -2,2 }; - INTERP_KERNEL::DirectedBoundingBox const ibb( inters_coords, nbP, dim); + INTERP_KERNEL::DirectedBoundingBox ibb( inters_coords, nbP, dim); CPPUNIT_ASSERT( !bb.isDisjointWith( ibb )); // overlapping non-directed BB diff --git a/src/INTERP_KERNELTest/BBTreeTest.hxx b/src/INTERP_KERNELTest/BBTreeTest.hxx index 341d109d1..ff12e0191 100644 --- a/src/INTERP_KERNELTest/BBTreeTest.hxx +++ b/src/INTERP_KERNELTest/BBTreeTest.hxx @@ -20,11 +20,10 @@ #ifndef __TU_BB_TREE_HXX__ #define __TU_BB_TREE_HXX__ -#include #include -#include "BBTree.txx" #include "InterpKernelTestExport.hxx" +#include "BBTree.txx" namespace INTERP_TEST { diff --git a/src/INTERP_KERNELTest/BasicMainTest.hxx b/src/INTERP_KERNELTest/BasicMainTest.hxx index 2ee9a7d70..876f2f097 100644 --- a/src/INTERP_KERNELTest/BasicMainTest.hxx +++ b/src/INTERP_KERNELTest/BasicMainTest.hxx @@ -21,12 +21,13 @@ #define _BASICMAINTEST_HXX_ #include -#include #include #include #include +#include #include #include +#include #include #include @@ -42,7 +43,7 @@ */ // ============================================================================ -int main(int /*argc*/, char* /*argv*/[]) +int main(int argc, char* argv[]) { #if !defined WIN32 && !defined __APPLE__ fpu_control_t cw = _FPU_DEFAULT & ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM); @@ -84,7 +85,7 @@ int main(int /*argc*/, char* /*argv*/[]) // --- Run the tests. - bool const wasSucessful = result.wasSuccessful(); + bool wasSucessful = result.wasSuccessful(); testFile.close(); // --- Return error code 1 if the one of test failed. diff --git a/src/INTERP_KERNELTest/CppUnitTest.cxx b/src/INTERP_KERNELTest/CppUnitTest.cxx index 616ae4cb0..8f2ec3987 100644 --- a/src/INTERP_KERNELTest/CppUnitTest.cxx +++ b/src/INTERP_KERNELTest/CppUnitTest.cxx @@ -17,3 +17,4 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#include "CppUnitTest.hxx" diff --git a/src/INTERP_KERNELTest/CppUnitTest.hxx b/src/INTERP_KERNELTest/CppUnitTest.hxx index af297c132..23c4bd973 100644 --- a/src/INTERP_KERNELTest/CppUnitTest.hxx +++ b/src/INTERP_KERNELTest/CppUnitTest.hxx @@ -20,8 +20,6 @@ #ifndef __TU_TEST_CPPUNIT_HXX__ #define __TU_TEST_CPPUNIT_HXX__ -#include -#include #include #include "InterpKernelTestExport.hxx" @@ -54,11 +52,11 @@ class INTERPKERNELTEST_EXPORT TestBogusClass : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: - void setUp() override { + void setUp() { obj = new BogusClass(3.14); } - void tearDown() override { + void tearDown() { delete obj; } diff --git a/src/INTERP_KERNELTest/ExprEvalInterpTest.cxx b/src/INTERP_KERNELTest/ExprEvalInterpTest.cxx index dc74f82d4..875fe0e6f 100644 --- a/src/INTERP_KERNELTest/ExprEvalInterpTest.cxx +++ b/src/INTERP_KERNELTest/ExprEvalInterpTest.cxx @@ -19,16 +19,10 @@ // Author : Anthony Geay (CEA/DEN) #include "ExprEvalInterpTest.hxx" -#include "InterpKernelException.hxx" #include "InterpKernelExprParser.hxx" -#include "InterpKernelUnit.hxx" -#include -#include #include -#include -#include -#include +#include using namespace INTERP_TEST; @@ -357,35 +351,35 @@ void ExprEvalInterpTest::testInterpreterUnit0() void ExprEvalInterpTest::testInterpreterUnit1() { - INTERP_KERNEL::Unit const unit1("m/s"); - INTERP_KERNEL::Unit const unit2("km/h"); + INTERP_KERNEL::Unit unit1("m/s"); + INTERP_KERNEL::Unit unit2("km/h"); CPPUNIT_ASSERT(unit1.isCompatibleWith(unit2) && unit2.isCompatibleWith(unit1)); CPPUNIT_ASSERT_DOUBLES_EQUAL(360,unit1.convert(unit2,100.),1e-10); - INTERP_KERNEL::Unit const unit3("J/s"); - INTERP_KERNEL::Unit const unit4("kW"); + INTERP_KERNEL::Unit unit3("J/s"); + INTERP_KERNEL::Unit unit4("kW"); CPPUNIT_ASSERT(unit3.isCompatibleWith(unit4) && unit4.isCompatibleWith(unit3)); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,unit3.convert(unit4,1000.),1e-10); CPPUNIT_ASSERT(unit4.getCoarseRepr()=="kW"); - INTERP_KERNEL::Unit const unit5("kpT"); + INTERP_KERNEL::Unit unit5("kpT"); CPPUNIT_ASSERT(!unit5.isInterpretationOK()); CPPUNIT_ASSERT(unit5.getCoarseRepr()=="kpT"); - INTERP_KERNEL::Unit const unit6("m*kpT"); + INTERP_KERNEL::Unit unit6("m*kpT"); CPPUNIT_ASSERT(!unit6.isInterpretationOK()); - INTERP_KERNEL::Unit const unit7("m*s^-1"); + INTERP_KERNEL::Unit unit7("m*s^-1"); CPPUNIT_ASSERT(unit7.isCompatibleWith(unit2) && unit2.isCompatibleWith(unit7)); CPPUNIT_ASSERT_DOUBLES_EQUAL(360,unit7.convert(unit2,100.),1e-10); const char unit8C[3]={-0x50,0x43,0x0}; - INTERP_KERNEL::Unit const unit8(unit8C); - INTERP_KERNEL::Unit const unit9("K"); + INTERP_KERNEL::Unit unit8(unit8C); + INTERP_KERNEL::Unit unit9("K"); CPPUNIT_ASSERT(unit9.isCompatibleWith(unit8) && unit8.isCompatibleWith(unit9)); CPPUNIT_ASSERT_DOUBLES_EQUAL(335.15,unit8.convert(unit9,62.),1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(-16.37,unit9.convert(unit8,256.78),1e-10); - INTERP_KERNEL::Unit const unit10("m"); - INTERP_KERNEL::Unit const unit11("cm"); + INTERP_KERNEL::Unit unit10("m"); + INTERP_KERNEL::Unit unit11("cm"); CPPUNIT_ASSERT(unit10.isCompatibleWith(unit11) && unit11.isCompatibleWith(unit10)); CPPUNIT_ASSERT_DOUBLES_EQUAL(6200.,unit10.convert(unit11,62.),1e-8); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.62,unit11.convert(unit10,62.),1e-15); - INTERP_KERNEL::Unit const unit12("m-m"); + INTERP_KERNEL::Unit unit12("m-m"); CPPUNIT_ASSERT(!unit12.isInterpretationOK()); } @@ -597,7 +591,7 @@ void ExprEvalInterpTest::testInterpreter6() INTERP_KERNEL::ExprParser expr5("x-2*cos(y/3.)"); expr5.parse(); expr5.prepareFastEvaluator(); - auto *aa(new double[2]); + double *aa(new double[2]); std::vector vv(2); vv[0]="x"; vv[1]="y"; expr5.prepareExprEvaluationDouble(vv,2,1,0,aa,aa+2); expr5.prepareFastEvaluator(); diff --git a/src/INTERP_KERNELTest/ExprEvalInterpTest.hxx b/src/INTERP_KERNELTest/ExprEvalInterpTest.hxx index f82a071e9..94478f852 100644 --- a/src/INTERP_KERNELTest/ExprEvalInterpTest.hxx +++ b/src/INTERP_KERNELTest/ExprEvalInterpTest.hxx @@ -21,7 +21,6 @@ #ifndef _EXPREVALINTERPTEST_HXX_ #define _EXPREVALINTERPTEST_HXX_ -#include #include #include "InterpKernelTestExport.hxx" diff --git a/src/INTERP_KERNELTest/HexaTests.hxx b/src/INTERP_KERNELTest/HexaTests.hxx index cb9d71030..d74580ae7 100644 --- a/src/INTERP_KERNELTest/HexaTests.hxx +++ b/src/INTERP_KERNELTest/HexaTests.hxx @@ -21,7 +21,6 @@ #define __HEXA_TESTS_HXX_ #include "InterpolationTestSuite.hxx" -#include namespace INTERP_TEST { diff --git a/src/INTERP_KERNELTest/Interpolation3DTest.cxx b/src/INTERP_KERNELTest/Interpolation3DTest.cxx index 2ffaa3a70..d77c47cdd 100644 --- a/src/INTERP_KERNELTest/Interpolation3DTest.cxx +++ b/src/INTERP_KERNELTest/Interpolation3DTest.cxx @@ -20,20 +20,14 @@ #include "Interpolation3DTest.hxx" #include "MEDFileMesh.hxx" -#include "MCAuto.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MeshTestToolkit.hxx" -#include -#include -#include #include -#include +#include +#include #include #include -#include -#include #include "VectorUtils.hxx" diff --git a/src/INTERP_KERNELTest/Interpolation3DTest.hxx b/src/INTERP_KERNELTest/Interpolation3DTest.hxx index a04326a75..9b80371bb 100644 --- a/src/INTERP_KERNELTest/Interpolation3DTest.hxx +++ b/src/INTERP_KERNELTest/Interpolation3DTest.hxx @@ -20,11 +20,9 @@ #ifndef __TU_INTERPOLATION_3D_TEST_HXX__ #define __TU_INTERPOLATION_3D_TEST_HXX__ -#include "MeshTestToolkit.hxx" +#include #include "Interpolation3D.hxx" -#include - #define ERR_TOL 1.0e-8 /// \brief OBSOLETE - renamed Interpolation3DTestSuite diff --git a/src/INTERP_KERNELTest/InterpolationOptionsTest.cxx b/src/INTERP_KERNELTest/InterpolationOptionsTest.cxx index 9bcceed07..7e2268a57 100644 --- a/src/INTERP_KERNELTest/InterpolationOptionsTest.cxx +++ b/src/INTERP_KERNELTest/InterpolationOptionsTest.cxx @@ -17,18 +17,16 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MEDCouplingUMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingNormalizedUnstructuredMesh.txx" -#include "Interpolation2D.hxx" #include "MEDFileMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "InterpolationOptionsTest.hxx" +#include "MEDCouplingNormalizedUnstructuredMesh.txx" +#include "Interpolation2D.txx" #include "TestInterpKernelUtils.hxx" -#include +#include +#include using namespace MEDCoupling; @@ -53,10 +51,10 @@ namespace INTERP_TEST */ void InterpolationOptionsTest::test_InterpolationOptions() { - std::string const sourcename=INTERP_TEST::getResourceFile("square1.med"); + std::string sourcename=INTERP_TEST::getResourceFile("square1.med"); MEDFileUMesh *source_mesh=MEDFileUMesh::New(sourcename.c_str(),"Mesh_2"); - std::string const targetname=INTERP_TEST::getResourceFile("square2.med"); + std::string targetname=INTERP_TEST::getResourceFile("square2.med"); MEDFileUMesh *target_mesh=MEDFileUMesh::New(targetname.c_str(),"Mesh_3"); MEDCouplingUMesh *source_mesh_mc=source_mesh->getMeshAtLevel(0); @@ -77,8 +75,8 @@ namespace INTERP_TEST targetvalue[i]=0.0; // Ok at this point we have our mesh in MED-Memory format. // Go to wrap med_source_mesh and med_target_mesh. - MEDCouplingNormalizedUnstructuredMesh<2,2> const wrap_source_mesh(source_mesh_mc); - MEDCouplingNormalizedUnstructuredMesh<2,2> const wrap_target_mesh(target_mesh_mc); + MEDCouplingNormalizedUnstructuredMesh<2,2> wrap_source_mesh(source_mesh_mc); + MEDCouplingNormalizedUnstructuredMesh<2,2> wrap_target_mesh(target_mesh_mc); // Go for interpolation... INTERP_KERNEL::Interpolation2D myInterpolator; //optional call to parametrize your interpolation. First precision, tracelevel, intersector wanted. diff --git a/src/INTERP_KERNELTest/InterpolationOptionsTest.hxx b/src/INTERP_KERNELTest/InterpolationOptionsTest.hxx index 10474aa8d..9f2ff04b8 100644 --- a/src/INTERP_KERNELTest/InterpolationOptionsTest.hxx +++ b/src/INTERP_KERNELTest/InterpolationOptionsTest.hxx @@ -20,7 +20,6 @@ #ifndef __TU_INTERPOLATIONOPTIONS_HXX__ #define __TU_INTERPOLATIONOPTIONS_HXX__ -#include #include #include "InterpKernelTestExport.hxx" diff --git a/src/INTERP_KERNELTest/InterpolationPlanarTestSuite.hxx b/src/INTERP_KERNELTest/InterpolationPlanarTestSuite.hxx index 2e2ab3f2f..d6ae1d76a 100644 --- a/src/INTERP_KERNELTest/InterpolationPlanarTestSuite.hxx +++ b/src/INTERP_KERNELTest/InterpolationPlanarTestSuite.hxx @@ -20,12 +20,10 @@ #ifndef __TU_INTERPOLATION_PLANAR_TEST_SUITE_HXX__ #define __TU_INTERPOLATION_PLANAR_TEST_SUITE_HXX__ -#include -#include +#include #include #include #include -#include namespace INTERP_TEST { @@ -45,12 +43,12 @@ namespace INTERP_TEST * Sets up the test suite. * */ - void setUp() override + void setUp() { _Epsilon = 1.e-6; _Precision = 1.e-6; } - void tearDown() override {} + void tearDown() {} // bool checkDequesEqual(std::deque< double > deque1, std::deque< double > deque2, double epsilon); // bool checkVectorsEqual(std::vector< double > Vect1, std::vector< double > Vect2, double epsilon); @@ -61,8 +59,8 @@ namespace INTERP_TEST bool checkDequesEqual(std::deque< double > deque1, std::deque< double > deque2, double epsilon) { - std::size_t const size1 = deque1.size(); - std::size_t const size2 = deque2.size(); + std::size_t size1 = deque1.size(); + std::size_t size2 = deque2.size(); bool are_equal = size1 == size2; if(are_equal) @@ -74,8 +72,8 @@ namespace INTERP_TEST bool checkVectorsEqual(std::vector< double > vect1, std::vector< double > vect2, double epsilon) { - std::size_t const size1 = vect1.size(); - std::size_t const size2 = vect2.size(); + std::size_t size1 = vect1.size(); + std::size_t size2 = vect2.size(); bool are_equal = size1 == size2; if(are_equal) @@ -86,17 +84,17 @@ namespace INTERP_TEST } void dequePrintOut(std::deque< double > deque1) { - for(double const i : deque1) + for(std::size_t i = 0; i< deque1.size(); i++) { - std::cerr << i << " "; + std::cerr << deque1[i] << " "; } std::cerr<< std::endl; } void vectPrintOut(std::vector< double > vect) { - for(double const i : vect) + for(std::size_t i = 0; i< vect.size(); i++) { - std::cerr << i << " "; + std::cerr << vect[i] << " "; } std::cerr<< std::endl; } diff --git a/src/INTERP_KERNELTest/InterpolationTestSuite.hxx b/src/INTERP_KERNELTest/InterpolationTestSuite.hxx index 7fccc193f..8f99cf3a6 100644 --- a/src/INTERP_KERNELTest/InterpolationTestSuite.hxx +++ b/src/INTERP_KERNELTest/InterpolationTestSuite.hxx @@ -20,10 +20,9 @@ #ifndef __TU_INTERPOLATION_TEST_SUITE_HXX__ #define __TU_INTERPOLATION_TEST_SUITE_HXX__ -#include "MeshTestToolkit.hxx" #include "MeshTestToolkit.txx" -#include +#include namespace INTERP_TEST { diff --git a/src/INTERP_KERNELTest/MEDMeshMaker.cxx b/src/INTERP_KERNELTest/MEDMeshMaker.cxx index d7955eddd..70245d3f2 100644 --- a/src/INTERP_KERNELTest/MEDMeshMaker.cxx +++ b/src/INTERP_KERNELTest/MEDMeshMaker.cxx @@ -19,8 +19,6 @@ #include "MCAuto.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDMeshMaker.hxx" diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.hxx b/src/INTERP_KERNELTest/MeshTestToolkit.hxx index e4a006b16..73a5c57de 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.hxx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.hxx @@ -20,8 +20,9 @@ #ifndef __TU_MESH_TEST_TOOLKIT_HXX__ #define __TU_MESH_TEST_TOOLKIT_HXX__ -#include "InterpolationOptions.hxx" -#include "MCIdType.hxx" +#include "Interpolation3D.hxx" +#include "Interpolation3D.txx" +#include "InterpolationPlanar.hxx" #include #include @@ -52,12 +53,12 @@ namespace INTERP_TEST { public: - double _precision{1.e-6}; - INTERP_KERNEL::IntersectionType _intersectionType{INTERP_KERNEL::Triangulation};//Used only in the case MESHDIM==2 (planar intersections) + double _precision; + INTERP_KERNEL::IntersectionType _intersectionType;//Used only in the case MESHDIM==2 (planar intersections) - MeshTestToolkit() = default; + MeshTestToolkit():_precision(1.e-6),_intersectionType(INTERP_KERNEL::Triangulation) {} - ~MeshTestToolkit() = default; + ~MeshTestToolkit() {} void intersectMeshes(const char* mesh1, const char* mesh2, const double correctVol, const double prec = 1.0e-5, bool doubleTest = true) const; diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.txx b/src/INTERP_KERNELTest/MeshTestToolkit.txx index 4ccd830b6..49097166a 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.txx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.txx @@ -16,34 +16,26 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef __MESHTESTTOOLKI_TXX__ -#define __MESHTESTTOOLKI_TXX__ +#include "TestInterpKernelUtils.hxx" #include "MeshTestToolkit.hxx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "Interpolation2D.hxx" - #include "MEDFileMesh.hxx" +#include "MEDCouplingNormalizedUnstructuredMesh.hxx" #include "MEDCouplingNormalizedUnstructuredMesh.txx" #include "MEDCouplingFieldDouble.hxx" #include "Interpolation3DSurf.hxx" #include "Interpolation2D.txx" #include "Interpolation3D.txx" -#include "TestInterpKernelUtils.hxx" -#include -#include #include -#include +#include +#include #include #include #include -#include -#include // levels : @@ -53,8 +45,8 @@ // 4 - empty // 5 - misc #include "Log.hxx" -#include "VectorUtils.hxx" +#include //#define VOL_PREC 1.0e-6 using namespace MEDCoupling; @@ -74,11 +66,11 @@ namespace INTERP_TEST double MeshTestToolkit::sumRow(const IntersectionMatrix& m, int i) const { double vol = 0.0; - for(const auto & iter : m) + for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - if(iter.count(i) != 0.0) + if(iter->count(i) != 0.0) { - auto iter2 = iter.find(i); + std::map::const_iterator iter2 = iter->find(i); vol += fabs(iter2->second); } } @@ -98,9 +90,9 @@ namespace INTERP_TEST { double vol = 0.0; const std::map& col = m[i]; - for(auto iter : col) + for(std::map::const_iterator iter = col.begin() ; iter != col.end() ; ++iter) { - vol += fabs(iter.second); + vol += fabs(iter->second); } return vol; } @@ -129,17 +121,17 @@ namespace INTERP_TEST double MeshTestToolkit::sumVolume(const IntersectionMatrix& m) const { std::vector volumes; - for(const auto & iter : m) + for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(const auto & iter2 : iter) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { - volumes.push_back(fabs(iter2.second)); + volumes.push_back(fabs(iter2->second)); } } // sum in ascending order to avoid rounding errors - std::sort(volumes.begin(), volumes.end()); + sort(volumes.begin(), volumes.end()); const double vol = accumulate(volumes.begin(), volumes.end(), 0.0); return vol; @@ -163,7 +155,7 @@ namespace INTERP_TEST bool ok = true; // source elements - auto* sVol = new double[sMesh.getNumberOfCells()]; + double* sVol = new double[sMesh.getNumberOfCells()]; getVolumes(sMesh, sVol); for(int i = 0; i < sMesh.getNumberOfCells(); ++i) @@ -178,7 +170,7 @@ namespace INTERP_TEST } // target elements - auto* tVol = new double[tMesh.getNumberOfCells()]; + double* tVol = new double[tMesh.getNumberOfCells()]; getVolumes(tMesh, tVol); for(int i = 0; i < tMesh.getNumberOfCells(); ++i) { @@ -211,7 +203,7 @@ namespace INTERP_TEST int i = 0; for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter) { - for(auto iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { mcIdType j = iter2->first; if(m2.at(j).count(i) == 0) @@ -253,7 +245,7 @@ namespace INTERP_TEST for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter) { - for(auto iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { mcIdType j = iter2->first; const double v1 = fabs(iter2->second); @@ -295,9 +287,9 @@ namespace INTERP_TEST bool isDiagonal = true; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(auto iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { - mcIdType const j = iter2->first; + mcIdType j = iter2->first; const double vol = iter2->second; if(vol != 0.0 && (i != j)) { @@ -488,5 +480,3 @@ namespace INTERP_TEST intersectMeshes(path1.c_str(), mesh1, path2.c_str(), mesh2, correctVol, prec, doubleTest); } } - -#endif diff --git a/src/INTERP_KERNELTest/MultiElement2DTests.hxx b/src/INTERP_KERNELTest/MultiElement2DTests.hxx index 33f868400..799e23776 100644 --- a/src/INTERP_KERNELTest/MultiElement2DTests.hxx +++ b/src/INTERP_KERNELTest/MultiElement2DTests.hxx @@ -22,9 +22,6 @@ #include "InterpolationTestSuite.hxx" -#include -#include "MeshTestToolkit.hxx" - namespace INTERP_TEST { /** diff --git a/src/INTERP_KERNELTest/MultiElement3DSurfTests.hxx b/src/INTERP_KERNELTest/MultiElement3DSurfTests.hxx index 9681f5f75..4437a9815 100644 --- a/src/INTERP_KERNELTest/MultiElement3DSurfTests.hxx +++ b/src/INTERP_KERNELTest/MultiElement3DSurfTests.hxx @@ -21,9 +21,6 @@ #define __MULTI_ELEMENT_3DSurf_TESTS_HXX_ #include "InterpolationTestSuite.hxx" -#include "InterpolationOptions.hxx" -#include -#include "MeshTestToolkit.hxx" namespace INTERP_TEST { @@ -35,7 +32,7 @@ namespace INTERP_TEST * different geometries : triangle, quadrilateral. * */ - class MultiElement3DSurfTests : public InterpolationTestSuite<3,2> + class MultiElement2DTests : public InterpolationTestSuite<3,2> { CPPUNIT_TEST_SUITE( MultiElement3DSurfTests ); diff --git a/src/INTERP_KERNELTest/MultiElementTetraTests.hxx b/src/INTERP_KERNELTest/MultiElementTetraTests.hxx index 437ca855d..401d37eb1 100644 --- a/src/INTERP_KERNELTest/MultiElementTetraTests.hxx +++ b/src/INTERP_KERNELTest/MultiElementTetraTests.hxx @@ -21,7 +21,6 @@ #define __MULTI_ELEMENT_TETRA_TESTS_HXX_ #include "InterpolationTestSuite.hxx" -#include namespace INTERP_TEST { diff --git a/src/INTERP_KERNELTest/PerfTest.cxx b/src/INTERP_KERNELTest/PerfTest.cxx index 9b2c4a51f..cd0c3b2bf 100644 --- a/src/INTERP_KERNELTest/PerfTest.cxx +++ b/src/INTERP_KERNELTest/PerfTest.cxx @@ -19,19 +19,15 @@ #include "Interpolation3D.hxx" #include "Interpolation3D.txx" -#include "MeshTestToolkit.hxx" -#include "MCAuto.hxx" -#include "MEDFileMesh.hxx" -#include "MEDCouplingUMesh.hxx" #include "MeshTestToolkit.txx" #include "Log.hxx" #include "VectorUtils.hxx" +#include "TestInterpKernelUtils.hxx" -#include "MEDCouplingNormalizedUnstructuredMesh.txx" +#include "MEDCouplingNormalizedUnstructuredMesh.hxx" #include #include -#include /** * Test program which takes two meshes and calculates their intersection matrix. diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.cxx index a22d060f1..0a7fe104e 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.cxx @@ -19,7 +19,6 @@ // Author : Anthony Geay (CEA/DEN) #include "QuadraticPlanarInterpTest.hxx" -#include "InterpKernelGeo2DPrecision.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DElementaryEdge.hxx" @@ -27,9 +26,8 @@ #include "InterpKernelGeo2DEdgeLin.hxx" #include "TestInterpKernelUtils.hxx" -#include -#include #include +#include using namespace INTERP_KERNEL; @@ -54,7 +52,7 @@ void QuadraticPlanarInterpTest::ReadWriteInXfigElementary() { //Testing bounds calculation. For Seg2 std::istringstream stream("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4700"); - auto *e1=new EdgeLin(stream); + EdgeLin *e1=new EdgeLin(stream); Bounds bound=e1->getBounds(); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,bound[1],ADMISSIBLE_ERROR); @@ -75,18 +73,18 @@ void QuadraticPlanarInterpTest::ReadWriteInXfigElementary() void QuadraticPlanarInterpTest::ReadWriteInXfigGlobal() { - QuadraticPolygon const pol1(INTERP_TEST::getResourceFile("Pol1.fig").c_str()); + QuadraticPolygon pol1(INTERP_TEST::getResourceFile("Pol1.fig").c_str()); pol1.dumpInXfigFile("Pol1_gen.fig"); - QuadraticPolygon const pol2(INTERP_TEST::getResourceFile("Pol2.fig").c_str()); + QuadraticPolygon pol2(INTERP_TEST::getResourceFile("Pol2.fig").c_str()); pol2.dumpInXfigFile("Pol2_gen.fig"); - QuadraticPolygon const pol3(INTERP_TEST::getResourceFile("Pol3.fig").c_str()); + QuadraticPolygon pol3(INTERP_TEST::getResourceFile("Pol3.fig").c_str()); pol3.dumpInXfigFile("Pol3_gen.fig"); - QuadraticPolygon const pol4(INTERP_TEST::getResourceFile("Pol4.fig").c_str()); + QuadraticPolygon pol4(INTERP_TEST::getResourceFile("Pol4.fig").c_str()); CPPUNIT_ASSERT_EQUAL(1,pol4.size()); - auto *edge1=dynamic_cast(pol4[0]); + ElementaryEdge *edge1=dynamic_cast(pol4[0]); CPPUNIT_ASSERT(edge1); Edge *edge2=edge1->getPtr(); - auto *edge=dynamic_cast(edge2); + EdgeArcCircle *edge=dynamic_cast(edge2); CPPUNIT_ASSERT(edge); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.7857653289925404,edge->getAngle(),ADMISSIBLE_ERROR); @@ -106,7 +104,7 @@ void QuadraticPlanarInterpTest::ReadWriteInXfigGlobal() CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.49741997818704586,edge->getAngle(),ADMISSIBLE_ERROR);//5.7857653289925404 + 2*PI n1->decrRef(); //A half circle. - auto *e=new EdgeArcCircle(0.84,0.54,0.78,0.6,0.84,0.66); + EdgeArcCircle *e=new EdgeArcCircle(0.84,0.54,0.78,0.6,0.84,0.66); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.06,e->getRadius(),ADMISSIBLE_ERROR); CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.1415925921507317,e->getAngle(),1e-5); e->decrRef(); @@ -120,7 +118,7 @@ void QuadraticPlanarInterpTest::BasicGeometricTools() { Node *n1=new Node(1.,1.); Node *n2=new Node(4.,2.); - auto *e1=new EdgeLin(n1,n2); + EdgeLin *e1=new EdgeLin(n1,n2); double tmp[2]; e1->getNormalVector(tmp); CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.94868329805051377,tmp[1],ADMISSIBLE_ERROR); @@ -140,7 +138,7 @@ void QuadraticPlanarInterpTest::BasicGeometricTools() CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0158113883008418,e1->getDistanceToPoint(tmp),1e-12); tmp[0]=0.; tmp[1]=5.; CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,e1->getDistanceToPoint(tmp),1e-12); - auto *e=new EdgeArcCircle(4.,3.,0.,5.,-5.,0.); + EdgeArcCircle *e=new EdgeArcCircle(4.,3.,0.,5.,-5.,0.); tmp[0]=-4.; tmp[1]=3.; CPPUNIT_ASSERT(e->isNodeLyingOn(tmp)); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,e->getDistanceToPoint(tmp),1e-12); @@ -158,9 +156,9 @@ void QuadraticPlanarInterpTest::IntersectionBasics() { //Testing intersection of Bounds. std::istringstream stream1("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800"); - auto *e1=new EdgeLin(stream1); + EdgeLin *e1=new EdgeLin(stream1); std::istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800"); - auto *e2=new EdgeLin(stream2); + EdgeLin *e2=new EdgeLin(stream2); Bounds *bound=e1->getBounds().amIIntersectingWith(e2->getBounds()); CPPUNIT_ASSERT(bound); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,(*bound)[0],ADMISSIBLE_ERROR); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,(*bound)[1],ADMISSIBLE_ERROR); @@ -170,9 +168,9 @@ void QuadraticPlanarInterpTest::IntersectionBasics() e2->decrRef(); e1->decrRef(); // std::istringstream stream3("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3000 7200 6000 3700"); - auto *e3=new EdgeLin(stream3); + EdgeLin *e3=new EdgeLin(stream3); std::istringstream stream4("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4800 6600 7200 4200"); - auto *e4=new EdgeLin(stream4); + EdgeLin *e4=new EdgeLin(stream4); bound=e3->getBounds().amIIntersectingWith(e4->getBounds()); CPPUNIT_ASSERT(bound); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,(*bound)[0],ADMISSIBLE_ERROR); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.6,(*bound)[1],ADMISSIBLE_ERROR); @@ -184,7 +182,7 @@ void QuadraticPlanarInterpTest::IntersectionBasics() void QuadraticPlanarInterpTest::EdgeLinUnitary() { - auto *e1=new EdgeLin(0.5,0.5,3.7,4.1); + EdgeLin *e1=new EdgeLin(0.5,0.5,3.7,4.1); Node *n=new Node(2.1,2.3); CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),0.5,1e-8); n->decrRef(); @@ -354,7 +352,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() v1.clear(); v2.clear(); v3.clear(); //Test 3bis - INSIDE - INSIDE - Bis | opp dir. double center[2]={0.,0.}; - double const radius=1.; + double radius=1.; e1=buildArcOfCircle(center,radius,-M_PI,0); e2=buildArcOfCircle(center,radius,-2*M_PI/3.+2*M_PI,-M_PI/3.); CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.*M_PI/3.,e2->getCurveLength(),1e-12);// To check that in the previous line +2.M_PI has done its job. CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); @@ -900,8 +898,8 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() void QuadraticPlanarInterpTest::IntersectionPointOnlyUnitarySegSeg() { // 0deg - classical - auto *e1=new EdgeLin(0.,0.,1.,0.); - auto *e2=new EdgeLin(0.3,0.3,0.5,-0.3); + EdgeLin *e1=new EdgeLin(0.,0.,1.,0.); + EdgeLin *e2=new EdgeLin(0.3,0.3,0.5,-0.3); ComposedEdge& v1=*(new ComposedEdge); ComposedEdge& v2=*(new ComposedEdge); MergePoints v3; CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.hxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.hxx index 7d2e009ed..4c2dd8d91 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.hxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.hxx @@ -21,10 +21,8 @@ #ifndef _QUADRATICPLANARINTERPTEST_HXX_ #define _QUADRATICPLANARINTERPTEST_HXX_ -#include #include -#include "InterpKernelGeo2DNode.hxx" #include "InterpKernelTestExport.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx index d0bcc22ba..8bae77b74 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx @@ -18,18 +18,14 @@ // // Author : Anthony Geay (CEA/DEN) -#include "InterpKernelGeo2DEdge.hxx" -#include "InterpKernelGeo2DNode.hxx" -#include "InterpKernelGeo2DPrecision.hxx" #include "QuadraticPlanarInterpTest.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DEdgeLin.hxx" #include -#include -#include -#include +#include +#include using namespace INTERP_KERNEL; @@ -41,7 +37,7 @@ static const double ADMISSIBLE_ERROR = 1.e-14; void QuadraticPlanarInterpTest::IntersectArcCircleBase() { double center[2]={0.5,0.5}; - double const radius=0.3; + double radius=0.3; EdgeArcCircle *e1=buildArcOfCircle(center,radius,M_PI/4.,M_PI/3.); CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI/3),ADMISSIBLE_ERROR); CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(M_PI/4),ADMISSIBLE_ERROR); @@ -111,7 +107,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() std::vector v4; MergePoints v3; EdgeArcCircle *e2; - ArcCArcCIntersector *intersector=nullptr; + ArcCArcCIntersector *intersector=0; for(unsigned k=0;k<8;k++) { e1=buildArcOfCircle(center,radius,M_PI/4.+k*M_PI/4.,M_PI/3.+k*M_PI/4.); @@ -172,8 +168,8 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10); - for(auto & iter : v4) - iter->decrRef(); + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) + (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } @@ -197,8 +193,8 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10); - for(auto & iter : v4) - iter->decrRef(); + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) + (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } @@ -222,8 +218,8 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10); - for(auto & iter : v4) - iter->decrRef(); + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) + (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } @@ -247,8 +243,8 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10); - for(auto & iter : v4) - iter->decrRef(); + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) + (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } @@ -272,8 +268,8 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(auto & iter : v4) - iter->decrRef(); + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) + (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } @@ -297,8 +293,8 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(auto & iter : v4) - iter->decrRef(); + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) + (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } @@ -322,8 +318,8 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(auto & iter : v4) - iter->decrRef(); + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) + (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } @@ -347,8 +343,8 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(auto & iter : v4) - iter->decrRef(); + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) + (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } @@ -369,8 +365,8 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - for(auto & iter : v4) - iter->decrRef(); + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) + (*iter)->decrRef(); v4.clear(); v4.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } @@ -497,7 +493,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() void QuadraticPlanarInterpTest::IntersectArcCircleFull() { - double center1[2]; center1[0]=0.; center1[1]=0.; double const radius1=3.; + double center1[2]; center1[0]=0.; center1[1]=0.; double radius1=3.; double center2[2]; center2[0]=0.75; center2[1]=-2.6; double radius2=1.; EdgeArcCircle *e1=buildArcOfCircle(center1,radius1,-M_PI/3.,4.*M_PI/3.); EdgeArcCircle *e2=buildArcOfCircle(center2,radius2,0.,M_PI/2.); @@ -609,7 +605,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleSegumentBase() { double center[2]={2.,2.}; EdgeArcCircle *e1=buildArcOfCircle(center,2.3,M_PI/4.,5.*M_PI/4.); - auto *e2=new EdgeLin(-1.3,1.,3.,5.3); + EdgeLin *e2=new EdgeLin(-1.3,1.,3.,5.3); EdgeIntersector *intersector=new ArcCSegIntersector(*e1,*e2); bool order; bool obvious,areOverlapped; @@ -655,7 +651,7 @@ QuadraticPolygon *QuadraticPlanarInterpTest::buildQuadraticPolygonCoarseInfo(con EdgeArcCircle *QuadraticPlanarInterpTest::buildArcOfCircle(const double *center, double radius, double alphaStart, double alphaEnd) { - double const alphaM=(alphaStart+alphaEnd)/2; + double alphaM=(alphaStart+alphaEnd)/2; return new EdgeArcCircle(center[0]+cos(alphaStart)*radius,center[1]+sin(alphaStart)*radius, center[0]+cos(alphaM)*radius,center[1]+sin(alphaM)*radius, center[0]+cos(alphaEnd)*radius,center[1]+sin(alphaEnd)*radius); @@ -668,8 +664,8 @@ double QuadraticPlanarInterpTest::btw2NodesAndACenter(const Node& n1, const Node double tmp1[2],tmp2[2]; tmp1[0]=n1Pt[0]-center[0]; tmp1[1]=n1Pt[1]-center[1]; tmp2[0]=n2Pt[0]-center[0]; tmp2[1]=n2Pt[1]-center[1]; - double const distTmp1=sqrt(tmp1[0]*tmp1[0]+tmp1[1]*tmp1[1]); - double const distTmp2=sqrt(tmp2[0]*tmp2[0]+tmp2[1]*tmp2[1]); + double distTmp1=sqrt(tmp1[0]*tmp1[0]+tmp1[1]*tmp1[1]); + double distTmp2=sqrt(tmp2[0]*tmp2[0]+tmp2[1]*tmp2[1]); double ret=acos((tmp1[0]*tmp2[0]+tmp1[1]*tmp2[1])/(distTmp1*distTmp2)); if(tmp1[0]*tmp2[1]-tmp1[1]*tmp2[0]<0) ret=-ret; diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest3.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest3.cxx index 444a642aa..2b5acaa25 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest3.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest3.cxx @@ -18,17 +18,15 @@ // // Author : Anthony Geay (CEA/DEN) -#include "InterpKernelGeo2DNode.hxx" -#include "InterpKernelGeo2DComposedEdge.hxx" -#include "InterpKernelGeo2DAbstractEdge.hxx" -#include "InterpKernelGeo2DEdge.hxx" #include "QuadraticPlanarInterpTest.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" #include "InterpKernelGeo2DElementaryEdge.hxx" +#include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DEdgeLin.hxx" #include -#include +#include +#include using namespace INTERP_KERNEL; @@ -40,10 +38,10 @@ void QuadraticPlanarInterpTest::checkInOutDetection() Node *n1=new Node(0.,0.); Node *n2=new Node(1.,0.); Node *n3=new Node(0.5,1.); - auto *e1=new EdgeLin(n1,n2); - auto *e2=new EdgeLin(n2,n3); - auto *e3=new EdgeLin(n3,n1); - auto *tri=new ComposedEdge; + EdgeLin *e1=new EdgeLin(n1,n2); + EdgeLin *e2=new EdgeLin(n2,n3); + EdgeLin *e3=new EdgeLin(n3,n1); + ComposedEdge *tri=new ComposedEdge; tri->pushBack(e1); tri->pushBack(e2); tri->pushBack(e3); // Node *where=new Node(0.4,0.1); @@ -63,22 +61,22 @@ void QuadraticPlanarInterpTest::checkInOutDetection() void QuadraticPlanarInterpTest::checkAssemblingBases1() { Node *n1=new Node(0.,0.); - Node *n2=new Node(0.1,0.); auto *e1_2=new EdgeLin(n1,n2); - Node *n3=new Node(0.2,0.); auto *e2_3=new EdgeLin(n2,n3); - Node *n4=new Node(0.3,0.); auto *e3_4=new EdgeLin(n3,n4); - Node *n5=new Node(0.4,0.); auto *e4_5=new EdgeLin(n4,n5); - Node *n6=new Node(0.5,0.); auto *e5_6=new EdgeLin(n5,n6); - Node *n7=new Node(0.6,0.); auto *e6_7=new EdgeLin(n6,n7); - Node *n8=new Node(0.7,0.); auto *e7_8=new EdgeLin(n7,n8); - Node *n9=new Node(0.8,0.); auto *e8_9=new EdgeLin(n8,n9); - Node *n10=new Node(0.9,0.); auto *e9_10=new EdgeLin(n9,n10); - Node *n11=new Node(1.,0.); auto *e10_11=new EdgeLin(n10,n11); - Node *n12=new Node(0.5,1.); auto *e11_12=new EdgeLin(n11,n12); - auto *e12_1=new EdgeLin(n12,n1); + Node *n2=new Node(0.1,0.); EdgeLin *e1_2=new EdgeLin(n1,n2); + Node *n3=new Node(0.2,0.); EdgeLin *e2_3=new EdgeLin(n2,n3); + Node *n4=new Node(0.3,0.); EdgeLin *e3_4=new EdgeLin(n3,n4); + Node *n5=new Node(0.4,0.); EdgeLin *e4_5=new EdgeLin(n4,n5); + Node *n6=new Node(0.5,0.); EdgeLin *e5_6=new EdgeLin(n5,n6); + Node *n7=new Node(0.6,0.); EdgeLin *e6_7=new EdgeLin(n6,n7); + Node *n8=new Node(0.7,0.); EdgeLin *e7_8=new EdgeLin(n7,n8); + Node *n9=new Node(0.8,0.); EdgeLin *e8_9=new EdgeLin(n8,n9); + Node *n10=new Node(0.9,0.); EdgeLin *e9_10=new EdgeLin(n9,n10); + Node *n11=new Node(1.,0.); EdgeLin *e10_11=new EdgeLin(n10,n11); + Node *n12=new Node(0.5,1.); EdgeLin *e11_12=new EdgeLin(n11,n12); + EdgeLin *e12_1=new EdgeLin(n12,n1); //Only one level e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_7->incrRef(); e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef(); - auto *c=new ComposedEdge; + ComposedEdge *c=new ComposedEdge; c->pushBack(e1_2); c->pushBack(e2_3); c->pushBack(e3_4); c->pushBack(e4_5); c->pushBack(e5_6); c->pushBack(e6_7); c->pushBack(e7_8); c->pushBack(e8_9); c->pushBack(e9_10); c->pushBack(e10_11); c->pushBack(e11_12); c->pushBack(e12_1); CPPUNIT_ASSERT_EQUAL(12,c->recursiveSize()); @@ -100,10 +98,10 @@ void QuadraticPlanarInterpTest::checkAssemblingBases1() //(e1_2, (e2_3,(e3_4, e4_5, e5_6, e6_7, (e7_8, e8_9 ), ( e9_10 , e10_11 ), e11_12 ),e12_1 ) ) e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_7->incrRef(); e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef(); - auto *c2_2_4=new ComposedEdge; c2_2_4->pushBack(e7_8); c2_2_4->pushBack(e8_9); - auto *c2_2_5=new ComposedEdge; c2_2_5->pushBack(e9_10); c2_2_5->pushBack(e10_11); - auto *c2_2=new ComposedEdge; c2_2->pushBack(e3_4); c2_2->pushBack(e4_5); c2_2->pushBack(e5_6); c2_2->pushBack(e6_7); c2_2->pushBack(c2_2_4); c2_2->pushBack(c2_2_5); c2_2->pushBack(e11_12); - auto *c2=new ComposedEdge; c2->pushBack(e2_3); c2->pushBack(c2_2); c2->pushBack(e12_1); + ComposedEdge *c2_2_4=new ComposedEdge; c2_2_4->pushBack(e7_8); c2_2_4->pushBack(e8_9); + ComposedEdge *c2_2_5=new ComposedEdge; c2_2_5->pushBack(e9_10); c2_2_5->pushBack(e10_11); + ComposedEdge *c2_2=new ComposedEdge; c2_2->pushBack(e3_4); c2_2->pushBack(e4_5); c2_2->pushBack(e5_6); c2_2->pushBack(e6_7); c2_2->pushBack(c2_2_4); c2_2->pushBack(c2_2_5); c2_2->pushBack(e11_12); + ComposedEdge *c2=new ComposedEdge; c2->pushBack(e2_3); c2->pushBack(c2_2); c2->pushBack(e12_1); c=new ComposedEdge; c->pushBack(e1_2); c->pushBack(c2); CPPUNIT_ASSERT_EQUAL(12,c->recursiveSize()); IteratorOnComposedEdge it2(c); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); @@ -185,14 +183,14 @@ void QuadraticPlanarInterpTest::checkAssemblingBases2() Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-0.3); Node *n2=new Node(1.,0.); Node *n5=new Node(1.,-0.3); Node *n3=new Node(0.5,1.); Node *n6=new Node(0.5,0.7); - auto *e1_2=new EdgeLin(n1,n2); auto *e4_5=new EdgeLin(n4,n5); - auto *e2_3=new EdgeLin(n2,n3); auto *e5_6=new EdgeLin(n5,n6); - auto *e3_1=new EdgeLin(n3,n1); auto *e6_4=new EdgeLin(n6,n4); + EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5); + EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6); + EdgeLin *e3_1=new EdgeLin(n3,n1); EdgeLin *e6_4=new EdgeLin(n6,n4); // e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); QuadraticPolygon pol1; pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1); QuadraticPolygon pol2; pol2.pushBack(e4_5); pol2.pushBack(e5_6); pol2.pushBack(e6_4); - QuadraticPolygon const cpyPol1(pol1); int nbOfSplits=0; + QuadraticPolygon cpyPol1(pol1); int nbOfSplits=0; cpyPol1.SplitPolygonsEachOther(pol1,pol2,nbOfSplits); CPPUNIT_ASSERT_EQUAL(5,pol1.recursiveSize()); CPPUNIT_ASSERT_EQUAL(5,pol2.recursiveSize());CPPUNIT_ASSERT_EQUAL(15,nbOfSplits); @@ -202,7 +200,7 @@ void QuadraticPlanarInterpTest::checkAssemblingBases2() CPPUNIT_ASSERT(pol2[3]->getEndNode()==pol1[0]->getEndNode()); CPPUNIT_ASSERT(pol2[3]->getEndNode()->getLoc()==ON_1); cpyPol1.performLocatingOperation(pol2); - auto *tmp=dynamic_cast(pol2[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_5); + ElementaryEdge *tmp=dynamic_cast(pol2[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_5); CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); tmp=dynamic_cast(pol2[1]); CPPUNIT_ASSERT(tmp); @@ -223,12 +221,12 @@ void QuadraticPlanarInterpTest::checkAssemblingBases2() n2=new Node(1.,0.); n5=new Node(0.5,0.); n3=new Node(0.5,1.); n6=new Node(0.75,0.5); Node *n7=new Node(2.,0.5); e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - auto *e5_4=new EdgeLin(n5,n4); auto *e4_7=new EdgeLin(n4,n7); auto *e7_6=new EdgeLin(n7,n6); auto *e6_5=new EdgeLin(n6,n5); + EdgeLin *e5_4=new EdgeLin(n5,n4); EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_6=new EdgeLin(n7,n6); EdgeLin *e6_5=new EdgeLin(n6,n5); // e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e5_4->incrRef(); e4_7->incrRef(); e7_6->incrRef(); e6_5->incrRef(); QuadraticPolygon pol3; pol3.pushBack(e1_2); pol3.pushBack(e2_3); pol3.pushBack(e3_1); QuadraticPolygon pol4; pol4.pushBack(e5_4); pol4.pushBack(e4_7); pol4.pushBack(e7_6); pol4.pushBack(e6_5); - QuadraticPolygon const cpyPol3(pol3); nbOfSplits=0; + QuadraticPolygon cpyPol3(pol3); nbOfSplits=0; cpyPol3.SplitPolygonsEachOther(pol3,pol4,nbOfSplits); CPPUNIT_ASSERT_EQUAL(5,pol3.recursiveSize()); CPPUNIT_ASSERT_EQUAL(4,pol4.recursiveSize());CPPUNIT_ASSERT_EQUAL(16,nbOfSplits); @@ -261,7 +259,7 @@ void QuadraticPlanarInterpTest::checkAssemblingBases2() e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); QuadraticPolygon pol5; pol5.pushBack(e1_2); pol5.pushBack(e2_3); pol5.pushBack(e3_1); QuadraticPolygon pol6; pol6.pushBack(e4_5); pol6.pushBack(e5_6); pol6.pushBack(e6_4); - QuadraticPolygon const cpyPol5(pol5); nbOfSplits=0; + QuadraticPolygon cpyPol5(pol5); nbOfSplits=0; cpyPol5.SplitPolygonsEachOther(pol5,pol6,nbOfSplits); CPPUNIT_ASSERT_EQUAL(4,pol5.recursiveSize()); CPPUNIT_ASSERT_EQUAL(4,pol6.recursiveSize()); CPPUNIT_ASSERT_EQUAL(13,nbOfSplits); @@ -293,7 +291,7 @@ void QuadraticPlanarInterpTest::checkAssemblingBases2() e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); QuadraticPolygon pol7; pol7.pushBack(e1_2); pol7.pushBack(e2_3); pol7.pushBack(e3_1); QuadraticPolygon pol8; pol8.pushBack(e4_5); pol8.pushBack(e5_6); pol8.pushBack(e6_4); - QuadraticPolygon const cpyPol7(pol7); nbOfSplits=0; + QuadraticPolygon cpyPol7(pol7); nbOfSplits=0; cpyPol7.SplitPolygonsEachOther(pol7,pol8,nbOfSplits); tmp=dynamic_cast(pol8[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e1_2); CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1); diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest4.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest4.cxx index ba75c734c..6259d42df 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest4.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest4.cxx @@ -18,21 +18,16 @@ // // Author : Anthony Geay (CEA/DEN) -#include "InterpKernelGeo2DNode.hxx" -#include "InterpKernelGeo2DPrecision.hxx" -#include "InterpKernelGeo2DBounds.hxx" #include "QuadraticPlanarInterpTest.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" #include "InterpKernelGeo2DElementaryEdge.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DEdgeLin.hxx" -#include #include -#include -#include -#include -#include +#include +#include +#include using namespace INTERP_KERNEL; @@ -45,9 +40,9 @@ void QuadraticPlanarInterpTest::checkPolygonsIntersection1() Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-0.3); Node *n2=new Node(1.,0.); Node *n5=new Node(1.,-0.3); Node *n3=new Node(0.5,1.); Node *n6=new Node(0.5,0.7); - auto *e1_2=new EdgeLin(n1,n2); auto *e4_5=new EdgeLin(n4,n5); - auto *e2_3=new EdgeLin(n2,n3); auto *e5_6=new EdgeLin(n5,n6); - auto *e3_1=new EdgeLin(n3,n1); auto *e6_4=new EdgeLin(n6,n4); + EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5); + EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6); + EdgeLin *e3_1=new EdgeLin(n3,n1); EdgeLin *e6_4=new EdgeLin(n6,n4); // std::vector result; for(int k=0;k<2;k++) @@ -100,7 +95,7 @@ void QuadraticPlanarInterpTest::checkPolygonsIntersection1() n2=new Node(1.,0.); n5=new Node(0.5,0.); n3=new Node(0.5,1.); n6=new Node(0.75,0.5); Node *n7=new Node(2.,0.5); e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - auto *e5_4=new EdgeLin(n5,n4); auto *e4_7=new EdgeLin(n4,n7); auto *e7_6=new EdgeLin(n7,n6); auto *e6_5=new EdgeLin(n6,n5); + EdgeLin *e5_4=new EdgeLin(n5,n4); EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_6=new EdgeLin(n7,n6); EdgeLin *e6_5=new EdgeLin(n6,n5); // for(int k=0;k<2;k++) for(int i=0;i<3;i++) @@ -519,9 +514,9 @@ void QuadraticPlanarInterpTest::checkHighLevelFunctionTest1() QuadraticPolygon *pol=QuadraticPolygon::BuildArcCirclePolygon(nodes); CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.04719755,pol->getArea(),1e-5); CPPUNIT_ASSERT_EQUAL(3,pol->size()); - auto *e0=dynamic_cast((*pol)[0]); - auto *e1=dynamic_cast((*pol)[1]); - auto *e2=dynamic_cast((*pol)[0]); + ElementaryEdge *e0=dynamic_cast((*pol)[0]); + ElementaryEdge *e1=dynamic_cast((*pol)[1]); + ElementaryEdge *e2=dynamic_cast((*pol)[0]); CPPUNIT_ASSERT(e0); CPPUNIT_ASSERT(e1); CPPUNIT_ASSERT(e2); CPPUNIT_ASSERT(dynamic_cast(e0->getPtr()));// <- testing detection of colinearity CPPUNIT_ASSERT(dynamic_cast(e1->getPtr())); @@ -597,7 +592,7 @@ void QuadraticPlanarInterpTest::check1DInterpLin() 0.1000 , 0.1500 , 0.2000 , 0.2500, 0.3000, 0.3500, 0.4000, 0.4500, 0.5000, 0.5500, 0.6000, 0.6500, 0.7000, 0.7194, 0.7388, 0.7581, 0.7775, 0.7969, 0.8163, 0.8356, 0.8550}; - std::vector const zLev1(Z_VALS_1,Z_VALS_1+NB_OF_CELL_AXIAL_1+1); + std::vector zLev1(Z_VALS_1,Z_VALS_1+NB_OF_CELL_AXIAL_1+1); const int NB_OF_CELL_AXIAL_2=46; static const double Z_VALS_2[NB_OF_CELL_AXIAL_2+1]= @@ -606,7 +601,7 @@ void QuadraticPlanarInterpTest::check1DInterpLin() , 0.20, 0.25, 0.30, 0.350 ,0.40 ,0.450 ,0.500 , 0.550, 0.600 ,0.650 ,0.700 , 0.7194 ,0.7388 ,0.7581 ,0.7775 ,0.7969 ,0.8163 ,0.8356, 0.8550 , 0.8738 ,0.8925 ,0.9113 ,0.9300 ,0.9488 ,0.9675 ,0.9863, 1.0050}; - std::vector const zLev2(Z_VALS_2,Z_VALS_2+NB_OF_CELL_AXIAL_2+1); + std::vector zLev2(Z_VALS_2,Z_VALS_2+NB_OF_CELL_AXIAL_2+1); std::map > m; Edge::Interpolate1DLin(zLev1,zLev2,m); CPPUNIT_ASSERT_EQUAL(30,(int)m.size()); @@ -624,7 +619,7 @@ void QuadraticPlanarInterpTest::check1DInterpLin() static const double Z_VALS_3[NB_OF_CELL_AXIAL_3+1]={ 0.,0.01,0.05,0.10,0.15,0.20,0.25,0.30, 0.35,0.40,0.45,0.50,0.55,0.60 }; - std::vector const zLev3(Z_VALS_3,Z_VALS_3+NB_OF_CELL_AXIAL_3+1); + std::vector zLev3(Z_VALS_3,Z_VALS_3+NB_OF_CELL_AXIAL_3+1); Edge::Interpolate1DLin(zLev3,zLev1,m); CPPUNIT_ASSERT_EQUAL(13,(int)m.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,m[0][8],1e-12); @@ -687,7 +682,7 @@ void QuadraticPlanarInterpTest::checkNonRegression1() const double radius1=2.902; const double angleS1=-0.49999999950907054; const double angleL1=-0.0942156629996692; const double center1[2]={13.66, -23.66}; - auto *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1); + EdgeArcCircle *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1); // const double coords2[]= { @@ -699,7 +694,7 @@ void QuadraticPlanarInterpTest::checkNonRegression1() const double radius2=2.4345; const double angleS2=-0.523598776190207; const double angleL2=0.5235987755846041; const double center2[]={ 13.933240960547204, -24.132999998525658 }; - auto *e2=new EdgeArcCircle(nS2,nE2,center2,radius2,angleS2,angleL2); + EdgeArcCircle *e2=new EdgeArcCircle(nS2,nE2,center2,radius2,angleS2,angleL2); MergePoints merge; QuadraticPolygon c1,c2; e1->intersectWith(e2,merge,c1,c2); @@ -778,7 +773,7 @@ void QuadraticPlanarInterpTest::checkNonRegression3() const double radius1=3.4304999897666599; const double angleS1=2.6179938783536514; const double angleL1=-0.52359877711901204; const double center1[2]={13.933240950441375, -24.132999992807399}; - auto *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1); + EdgeArcCircle *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1); // const double coords2[]= { @@ -787,14 +782,14 @@ void QuadraticPlanarInterpTest::checkNonRegression3() }; Node *nS2=new Node(coords2); Node *nE2=new Node(coords2+2); - auto *e2=new EdgeLin(nS2,nE2); + EdgeLin *e2=new EdgeLin(nS2,nE2); MergePoints merge; QuadraticPolygon c1,c2; CPPUNIT_ASSERT(e1->intersectWith(e2,merge,c1,c2)); CPPUNIT_ASSERT_EQUAL(2,c1.size()); CPPUNIT_ASSERT_EQUAL(2,c2.size()); - auto *tmp1=dynamic_cast(c1.front()); CPPUNIT_ASSERT(tmp1); - auto *tmp2=dynamic_cast(tmp1->getPtr()); CPPUNIT_ASSERT(tmp2); + ElementaryEdge *tmp1=dynamic_cast(c1.front()); CPPUNIT_ASSERT(tmp1); + EdgeArcCircle *tmp2=dynamic_cast(tmp1->getPtr()); CPPUNIT_ASSERT(tmp2); CPPUNIT_ASSERT_DOUBLES_EQUAL(2.6179938783536514,tmp2->getAngle0(),1e-14); //clean-up nS1->decrRef(); nE1->decrRef(); nS2->decrRef(); nE2->decrRef(); e1->decrRef(); e2->decrRef(); @@ -901,7 +896,7 @@ void QuadraticPlanarInterpTest::checkNonRegression5() nodes2.push_back(new Node(coords2+12)); nodes2.push_back(new Node(coords2+14)); QuadraticPolygon *pol2=QuadraticPolygon::BuildArcCirclePolygon(nodes2); - std::vector const v=pol1->intersectMySelfWith(*pol2); + std::vector v=pol1->intersectMySelfWith(*pol2); CPPUNIT_ASSERT_EQUAL(0,(int)v.size()); //CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00164773941455998,v[0]->getArea(),1e-7); //delete v[0]; @@ -1106,7 +1101,7 @@ void QuadraticPlanarInterpTest::checkNonRegression9() nodes2.push_back(new Node(coords2+12)); nodes2.push_back(new Node(coords2+14)); QuadraticPolygon *pol2=QuadraticPolygon::BuildArcCirclePolygon(nodes2); - std::vector const v=pol1->intersectMySelfWith(*pol2); + std::vector v=pol1->intersectMySelfWith(*pol2); CPPUNIT_ASSERT_EQUAL(0,(int)v.size()); delete pol1; delete pol2; @@ -1127,11 +1122,11 @@ void QuadraticPlanarInterpTest::checkNonRegression10() Node *n3_1=new Node(coords1+4); Node *n1_2=new Node(coords2); Node *n2_2=new Node(coords2+2); - auto *e1=new EdgeArcCircle(n1_1,n3_1,n2_1); - auto *e2=new EdgeLin(n1_2,n2_2); + EdgeArcCircle *e1=new EdgeArcCircle(n1_1,n3_1,n2_1); + EdgeLin *e2=new EdgeLin(n1_2,n2_2); MergePoints merge; - auto *c1=new ComposedEdge; - auto *c2=new ComposedEdge; + ComposedEdge *c1=new ComposedEdge; + ComposedEdge *c2=new ComposedEdge; CPPUNIT_ASSERT(e1->intersectWith(e2,merge,*c1,*c2)); CPPUNIT_ASSERT_EQUAL(2,c1->size()); CPPUNIT_ASSERT_EQUAL(2,c2->size()); @@ -1605,20 +1600,20 @@ void QuadraticPlanarInterpTest::checkNormalize() Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-3.); Node *n2=new Node(10.,0.); Node *n5=new Node(10.,-3.); Node *n3=new Node(5.,10.); Node *n6=new Node(5.,7.); - auto *e1_2=new EdgeLin(n1,n2); auto *e4_5=new EdgeLin(n4,n5); - auto *e2_3=new EdgeLin(n2,n3); auto *e5_6=new EdgeLin(n5,n6); - auto *e3_1=new EdgeLin(n3,n1); auto *e6_4=new EdgeLin(n6,n4); + EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5); + EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6); + EdgeLin *e3_1=new EdgeLin(n3,n1); EdgeLin *e6_4=new EdgeLin(n6,n4); // QuadraticPolygon pol1; pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1); QuadraticPolygon pol2; pol2.pushBack(e4_5); pol2.pushBack(e5_6); pol2.pushBack(e6_4); n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - double const area1Start=pol1.getArea(); + double area1Start=pol1.getArea(); double xb,yb; - double const fact=pol1.normalize(&pol2,xb,yb); - double const area1End=pol1.getArea(); + double fact=pol1.normalize(&pol2,xb,yb); + double area1End=pol1.getArea(); CPPUNIT_ASSERT_DOUBLES_EQUAL(area1Start,area1End*fact*fact,1e-14); CPPUNIT_ASSERT_DOUBLES_EQUAL(13.,fact,1.e-14); - double const area=pol1.intersectWith(pol2); + double area=pol1.intersectWith(pol2); CPPUNIT_ASSERT_DOUBLES_EQUAL(24.5,area*fact*fact,1e-14); // n1=new Node(0.,0.); n4=new Node(0.,-3.); @@ -1633,7 +1628,7 @@ void QuadraticPlanarInterpTest::checkNormalize() CPPUNIT_ASSERT_DOUBLES_EQUAL(24.5,pol3.intersectWithAbs(pol4),1.e-14); // Ok testing EdgeArcCircle update. double center[2]={5.,5.}; - double const radius=300.; + double radius=300.; EdgeArcCircle *e1=buildArcOfCircle(center,radius,M_PI/4.,M_PI/3.); const Bounds& b=e1->getBounds(); double x,y,fact2; @@ -1657,11 +1652,11 @@ void QuadraticPlanarInterpTest::checkMakePartitionAbs1() Node *n1=new Node(0.,0.5); Node *n5=new Node(0.3,1.2); Node *n2=new Node(1.,0.5); Node *n6=new Node(1.1,1.3); Node *n3=new Node(1.,0.); Node *n7=new Node(-0.1,0.9); - auto *e0_1=new EdgeLin(n0,n1); - auto *e1_2=new EdgeLin(n1,n2); auto *e4_5=new EdgeLin(n4,n5); - auto *e2_3=new EdgeLin(n2,n3); auto *e5_6=new EdgeLin(n5,n6); - auto *e3_0=new EdgeLin(n3,n0); auto *e6_4=new EdgeLin(n6,n4); - auto *e4_7=new EdgeLin(n4,n7); auto *e7_5=new EdgeLin(n7,n5); + EdgeLin *e0_1=new EdgeLin(n0,n1); + EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5); + EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6); + EdgeLin *e3_0=new EdgeLin(n3,n0); EdgeLin *e6_4=new EdgeLin(n6,n4); + EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_5=new EdgeLin(n7,n5); QuadraticPolygon pol1; pol1.pushBack(e0_1); pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_0); QuadraticPolygon pol2; pol2.pushBack(e4_5); pol2.pushBack(e5_6); pol2.pushBack(e6_4); pol2.pushBack(e7_5); e4_5->incrRef(); pol2.pushBack(new ElementaryEdge(e4_5,false)); pol2.pushBack(e4_7); @@ -1675,7 +1670,7 @@ void QuadraticPlanarInterpTest::checkMakePartitionAbs1() */ void QuadraticPlanarInterpTest::checkArcArcIntersection1() { - double const eps=1.0e-8; + double eps=1.0e-8; INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(eps); Node *n0=new Node(6.37533,38.8928); Node *n3=new Node(6.29194,39.2789); @@ -1685,8 +1680,8 @@ void QuadraticPlanarInterpTest::checkArcArcIntersection1() Node *n6=new Node(6.2534549999999998, 38.861800000000002); // to have a linear edge e1 //EdgeArcCircle *e1=new EdgeArcCircle(n0, n2, n6, true); // to have a linear edge e1 - auto *e1=new EdgeArcCircle(n0, n2, n1, true); - auto *e2=new EdgeArcCircle(n3, n5, n4, true); + EdgeArcCircle *e1=new EdgeArcCircle(n0, n2, n1, true); + EdgeArcCircle *e2=new EdgeArcCircle(n3, n5, n4, true); MergePoints merge; QuadraticPolygon c1,c2; diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx index ecad06046..6e88fa78e 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx @@ -18,16 +18,16 @@ // // Author : Anthony Geay (CEA/DEN) -#include "InterpKernelGeo2DPrecision.hxx" -#include "InterpKernelGeo2DNode.hxx" #include "QuadraticPlanarInterpTest.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" +#include "InterpKernelGeo2DElementaryEdge.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" +#include "InterpKernelGeo2DEdgeLin.hxx" -#include #include -#include -#include +#include +#include +#include using namespace INTERP_KERNEL; @@ -1180,7 +1180,7 @@ void QuadraticPlanarInterpTest::checkGetMiddleOfPoints() Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused // start, end, center_x, center_y, radius, angle0, angle - EdgeArcCircle const e(start, end, e_center, 1.2264175471673588, -0.9533904350433241, 0.95339043504332388); + EdgeArcCircle e(start, end, e_center, 1.2264175471673588, -0.9533904350433241, 0.95339043504332388); e.getMiddleOfPoints(p1, p2, mid); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.37969180470645592, mid[0], 1.e-7); @@ -1200,7 +1200,7 @@ void QuadraticPlanarInterpTest::checkGetMiddleOfPoints() Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused // start, end, center_x, center_y, radius, angle0, angle - EdgeArcCircle const e(start, end, e_center, 6.0104076400856474, -0.69522150912422953, -0.18035330854643861); + EdgeArcCircle e(start, end, e_center, 6.0104076400856474, -0.69522150912422953, -0.18035330854643861); e.getMiddleOfPoints(p1, p2, mid); CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.6, mid[0], 1.e-7); @@ -1220,7 +1220,7 @@ void QuadraticPlanarInterpTest::checkGetMiddleOfPoints() Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused // start, end, center_x, center_y, radius, angle0, angle - EdgeArcCircle const e(start, end, e_center, 2.0977501175200861, 1.0829141821052615, -0.59503203741562627); + EdgeArcCircle e(start, end, e_center, 2.0977501175200861, 1.0829141821052615, -0.59503203741562627); e.getMiddleOfPoints(p1, p2, mid); CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[0], 1.e-7); @@ -1244,7 +1244,7 @@ void QuadraticPlanarInterpTest::checkGetMiddleOfPointsOriented() Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused // start, end, center_x, center_y, radius, angle0, angle - EdgeArcCircle const e(start, end, e_center, 1.0, -0.7853981633974485, -1.5707963267948966); + EdgeArcCircle e(start, end, e_center, 1.0, -0.7853981633974485, -1.5707963267948966); e.getMiddleOfPointsOriented(p1, p2, mid); CPPUNIT_ASSERT_DOUBLES_EQUAL(1., mid[0], 1.e-7); diff --git a/src/INTERP_KERNELTest/SingleElementPlanarTests.cxx b/src/INTERP_KERNELTest/SingleElementPlanarTests.cxx index 51b6ea90f..a69906b72 100644 --- a/src/INTERP_KERNELTest/SingleElementPlanarTests.cxx +++ b/src/INTERP_KERNELTest/SingleElementPlanarTests.cxx @@ -19,10 +19,10 @@ #include "SingleElementPlanarTests.hxx" #include "InterpolationUtils.hxx" +#include "PolygonAlgorithms.hxx" #include "PolygonAlgorithms.txx" -#include +#include "InterpolationPlanarTestSuite.hxx" #include -#include using namespace INTERP_KERNEL; @@ -227,7 +227,7 @@ namespace INTERP_TEST // \brief Status : pass void SingleElementPlanarTests::identicalSquares() { - INTERP_KERNEL::PolygonAlgorithms<2> const intersector (_Epsilon, _Precision);; + INTERP_KERNEL::PolygonAlgorithms<2> intersector (_Epsilon, _Precision);; /* ////////////////// TEST DEACTIVATED by A. GEAY because memory fault : // conditional jump INTERP_KERNEL::PolygonAlgorithms<2>::intersectConvexPolygons(double const*, double const*, int, int) (PolygonAlgorithms.txx:629) diff --git a/src/INTERP_KERNELTest/SingleElementPlanarTests.hxx b/src/INTERP_KERNELTest/SingleElementPlanarTests.hxx index 699cbfa6e..9011e8530 100644 --- a/src/INTERP_KERNELTest/SingleElementPlanarTests.hxx +++ b/src/INTERP_KERNELTest/SingleElementPlanarTests.hxx @@ -22,7 +22,6 @@ #include "InterpKernelTestExport.hxx" #include "InterpolationPlanarTestSuite.hxx" -#include namespace INTERP_TEST { diff --git a/src/INTERP_KERNELTest/SingleElementTetraTests.hxx b/src/INTERP_KERNELTest/SingleElementTetraTests.hxx index b922fffa9..2d63a672a 100644 --- a/src/INTERP_KERNELTest/SingleElementTetraTests.hxx +++ b/src/INTERP_KERNELTest/SingleElementTetraTests.hxx @@ -21,7 +21,6 @@ #define __SINGLE_ELEMENT_TETRA_TESTS_HXX_ #include "InterpolationTestSuite.hxx" -#include namespace INTERP_TEST { diff --git a/src/INTERP_KERNELTest/TestInterpKernel.cxx b/src/INTERP_KERNELTest/TestInterpKernel.cxx index da44d54cd..1a885ad51 100644 --- a/src/INTERP_KERNELTest/TestInterpKernel.cxx +++ b/src/INTERP_KERNELTest/TestInterpKernel.cxx @@ -26,8 +26,6 @@ #include "TransformedTriangleTest.hxx" #include "UnitTetraIntersectionBaryTest.hxx" #include "UnitTetra3D2DIntersectionTest.hxx" -#include "MeshTestToolkit.txx" -#include #ifndef MEDCOUPLING_MICROMED #include "HexaTests.hxx" diff --git a/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx b/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx index 1dd4e227b..b5649070e 100644 --- a/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx +++ b/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx @@ -21,7 +21,6 @@ #include "InterpKernelException.hxx" #include -#include #ifdef WIN32 #include #define getcwd _getcwd @@ -42,7 +41,7 @@ namespace INTERP_TEST resourceFile = getenv("MEDCOUPLING_ROOT_DIR"); resourceFile += "/share/resources/med/"; resourceFile += filename; - std::ifstream const my_file(resourceFile.c_str()); + std::ifstream my_file(resourceFile.c_str()); if (my_file.good()) return resourceFile; } @@ -52,12 +51,12 @@ namespace INTERP_TEST resourceFile.erase(std::remove(resourceFile.begin(), resourceFile.end(), ':'), resourceFile.end()); resourceFile += "/"; resourceFile += filename; - std::ifstream const my_file(resourceFile.c_str()); + std::ifstream my_file(resourceFile.c_str()); if (my_file.good()) return resourceFile; } // else - char * tmp_c = getcwd(nullptr, 0); + char * tmp_c = getcwd(NULL, 0); resourceFile = tmp_c; free(tmp_c); resourceFile += "/"; @@ -65,7 +64,7 @@ namespace INTERP_TEST resourceFile += "../"; resourceFile += "resources/"; resourceFile += filename; - std::ifstream const my_file(resourceFile.c_str()); + std::ifstream my_file(resourceFile.c_str()); if (!my_file.good()) { std::stringstream ss; diff --git a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx index c895da529..5522adf27 100644 --- a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx +++ b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx @@ -18,11 +18,8 @@ // #include "ThreeDSurfProjectionTest.hxx" -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.txx" #include "MCIdType.hxx" -#include -#include class MyMeshType { @@ -48,7 +45,7 @@ void INTERP_TEST::ThreeDSurfProjectionTest::test1() //MEDCouplingPointSet.Rotate3DAlg([0.,0.,0.],[2.,1.,3.],0.3,coo2) const double coo[9]={0.,0.,0.,0.96809749223257568,0.24332379388106262,-0.059839592782071335,-0.23056279077409292,0.95852673990234838,0.16753294721527912}; const double coo2[9]={9.8122602102980502e-08,-1.4839144255482456e-7,9.8404874611628791e-7,0.96809759035517784,0.24332364548962007,-0.059838608733325221,-0.23056269265149082,0.9585265915109058,0.16753393126402524}; - auto *tmp0(new double[9]),*tmp1(new double[9]); + double *tmp0(new double[9]),*tmp1(new double[9]); int ret; //eps=1e-2. eps is a tolerance to detect that two points are the same or not in a same polygon. // here the max 3D distance is 1e-5 > 1e-6 so 1 is expected @@ -93,7 +90,7 @@ void INTERP_TEST::ThreeDSurfProjectionTest::test2() // const double coo[9]={0.,0.,0.,0.96809749223257568,0.24332379388106262,-0.059839592782071335,-0.23056279077409292,0.95852673990234838,0.16753294721527912}; const double coo2[9]={7.2311562622637225e-07,6.8998795679738294e-07,3.1943866106249849e-08,0.72852072144314628,0.33125439126063028,0.5996079016637561,0.0090154262465889021,0.87059752249869415,-0.49191448334281612}; - auto *tmp0(new double[9]),*tmp1(new double[9]); + double *tmp0(new double[9]),*tmp1(new double[9]); int ret; //eps=1e-2. eps is a tolerance to detect that two points are the same or not in a same polygon. // here the max 3D distance is 1e-5 > 1e-6 so 1 is expected diff --git a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.hxx b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.hxx index 8e8ec781f..7f382612f 100644 --- a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.hxx +++ b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.hxx @@ -20,7 +20,6 @@ #ifndef __THREEDSURFPROJECTIONTEST_HXX__ #define __THREEDSURFPROJECTIONTEST_HXX__ -#include #include #include "InterpKernelTestExport.hxx" diff --git a/src/INTERP_KERNELTest/TransformedTriangleIntersectTest.cxx b/src/INTERP_KERNELTest/TransformedTriangleIntersectTest.cxx index 521b5c8ae..41c12e1c7 100644 --- a/src/INTERP_KERNELTest/TransformedTriangleIntersectTest.cxx +++ b/src/INTERP_KERNELTest/TransformedTriangleIntersectTest.cxx @@ -18,11 +18,10 @@ // #include "TransformedTriangleIntersectTest.hxx" -#include -#include +#include +#include #include "Log.hxx" -#include "TransformedTriangle.hxx" /// macro to test for zero double products outside the segment-edge intersection test method /// as is done in TransformedTriangle when OPTIMIZE is defined @@ -146,7 +145,7 @@ namespace INTERP_TEST 0.4, 2.5, 0.5 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -300,7 +299,7 @@ namespace INTERP_TEST 1.5, 0.5,-0.25, // Q -0.5,-1.5, 0.75 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -454,7 +453,7 @@ namespace INTERP_TEST -0.4, 0.3, 0.9 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -608,7 +607,7 @@ namespace INTERP_TEST 0.2, -1.3, -1.4 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -764,7 +763,7 @@ namespace INTERP_TEST 0.5, -2.6, 1.3 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -919,7 +918,7 @@ namespace INTERP_TEST -3.0, 3.0, -0.5 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -1074,7 +1073,7 @@ namespace INTERP_TEST 0.3, 0.4, 0.2 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -1229,7 +1228,7 @@ namespace INTERP_TEST -0.1, -0.4, 0.9 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -1383,7 +1382,7 @@ namespace INTERP_TEST 0.1, 0.2, 0.8 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -1538,7 +1537,7 @@ namespace INTERP_TEST 0.4, 0.3, 0.3 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -1692,7 +1691,7 @@ namespace INTERP_TEST 0.3, 0.3, 0.3 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -1847,7 +1846,7 @@ namespace INTERP_TEST 0.6, 0.6, -0.6 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -2001,7 +2000,7 @@ namespace INTERP_TEST -0.2, -0.1, 3.0 // R }; - auto* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); + TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]); // run all intersection tests and ensure that the ones // listed with yes in the tables above return true and @@ -2139,7 +2138,7 @@ namespace INTERP_TEST 0.44117647058823506, 0, 0.55882352941176483, -0.89215686274509864, 1.3333333333333339, 0.55882352941176483}; - double const refVol = 0.054383777732546296; + double refVol = 0.054383777732546296; TransformedTriangle tri(&coords[0], &coords[3], &coords[6]); const double vol = tri.calculateIntersectionVolume(); @@ -2164,7 +2163,7 @@ namespace INTERP_TEST -0.55882352941176472, 0, 1.5588235294117649, -0.89215686274509864, 1.3333333333333339, 0.55882352941176483 }; - double const refVol = -0.06869529818848; + double refVol = -0.06869529818848; TransformedTriangle tri(&coords[0], &coords[3], &coords[6]); const double vol = tri.calculateIntersectionVolume(); @@ -2190,7 +2189,7 @@ namespace INTERP_TEST -1.2062474433365091, -0.037350951323461778, 2.1879983126221099, 0.49877186496532655, 0.59827776894780405, 0.79353793765518521 }; - double const refVol = -0.051135429735185; + double refVol = -0.051135429735185; TransformedTriangle tri(&coords[0], &coords[3], &coords[6]); const double vol = tri.calculateIntersectionVolume(); @@ -2215,7 +2214,7 @@ namespace INTERP_TEST 2.022774182629973, -1.020222639063029, -0.01375178680446254, 0.7495960843059706, 0.1125313911637846, 0.7430770879625861 }; - double const refVol = -0.00060846166394417; + double refVol = -0.00060846166394417; TransformedTriangle tri(&coords[0], &coords[3], &coords[6]); const double vol = tri.calculateIntersectionVolume(); @@ -2240,7 +2239,7 @@ namespace INTERP_TEST -3.552713678800501e-15, 0, 0.9999999999999982, 0, 1.000000000000004, -8.881784197001252e-16 }; - double const refVol = -1/6.; + double refVol = -1/6.; TransformedTriangle tri(&coords[0], &coords[3], &coords[6]); const double vol = tri.calculateIntersectionVolume(); @@ -2265,7 +2264,7 @@ namespace INTERP_TEST 1.000000000000004, 0, 0, 0, 0, 0.9999999999999929, 3.552713678800501e-15, 1, 0}; - double const refVol = -1/6.; + double refVol = -1/6.; TransformedTriangle tri(&coords[0], &coords[3], &coords[6]); const double vol = tri.calculateIntersectionVolume(); @@ -2292,7 +2291,7 @@ namespace INTERP_TEST 3.700743415417188e-17, 0.9999999999999999, 3.700743415417188e-17 }; - double const refVol = -1/6.; + double refVol = -1/6.; TransformedTriangle tri(&coords[0], &coords[3], &coords[6]); const double vol = tri.calculateIntersectionVolume(); @@ -2334,7 +2333,7 @@ namespace INTERP_TEST -7.105427357601002e-15, 1.000000000000014, -3.552713678800501e-15 }; - double const refVol = -1/6.; + double refVol = -1/6.; TransformedTriangle tri(&coords[0], &coords[3], &coords[6]); const double vol = tri.calculateIntersectionVolume(); diff --git a/src/INTERP_KERNELTest/TransformedTriangleIntersectTest.hxx b/src/INTERP_KERNELTest/TransformedTriangleIntersectTest.hxx index 1c16c034e..8d7ef5e64 100644 --- a/src/INTERP_KERNELTest/TransformedTriangleIntersectTest.hxx +++ b/src/INTERP_KERNELTest/TransformedTriangleIntersectTest.hxx @@ -20,7 +20,6 @@ #ifndef __TU_TRANSFORMED_TRIANGLE_INTERSECT_HXX__ #define __TU_TRANSFORMED_TRIANGLE_INTERSECT_HXX__ -#include #include #include "InterpKernelTestExport.hxx" diff --git a/src/INTERP_KERNELTest/TransformedTriangleTest.cxx b/src/INTERP_KERNELTest/TransformedTriangleTest.cxx index 9de4ef357..856e06086 100644 --- a/src/INTERP_KERNELTest/TransformedTriangleTest.cxx +++ b/src/INTERP_KERNELTest/TransformedTriangleTest.cxx @@ -18,9 +18,8 @@ // #include "TransformedTriangleTest.hxx" -#include "TransformedTriangle.hxx" -#include +#include using namespace INTERP_KERNEL; @@ -87,14 +86,14 @@ namespace INTERP_TEST void TransformedTriangleTest::test_constructor() { // test that _coords has correct values after constructor is called - double const good_values1[15] = + double good_values1[15] = { p1[0], p1[1], p1[2], hp1, Hp1, q1[0], q1[1], q1[2], hq1, Hq1, r1[0], r1[1], r1[2], hr1, Hr1 }; - double const good_values2[15] = + double good_values2[15] = { p2[0], p2[1], p2[2], hp2, Hp2, q2[0], q2[1], q2[2], hq2, Hq2, @@ -119,7 +118,7 @@ namespace INTERP_TEST // test that the correct c-values are calculated - double const correct_c_vals[24] = + double correct_c_vals[24] = { p1[0] * q1[1] - p1[1] * q1[0], p1[1] * q1[2] - p1[2] * q1[1], @@ -316,7 +315,7 @@ namespace INTERP_TEST for(int i = 0; i < 3 ; ++i) { - DoubleProduct const dp = DOUBLE_PRODUCTS[3*min_corner + i]; + DoubleProduct dp = DOUBLE_PRODUCTS[3*min_corner + i]; // std::cout << std::endl << "in test inconsistent (seg,dp) :(" << seg <<", " << dp << ")" << std::endl; CPPUNIT_ASSERT_EQUAL(0.0, tri2->calcStableC(seg, dp)); correct_c_vals[8*seg + dp] = 0.0; diff --git a/src/INTERP_KERNELTest/TransformedTriangleTest.hxx b/src/INTERP_KERNELTest/TransformedTriangleTest.hxx index 0f98006f9..c01d9be26 100644 --- a/src/INTERP_KERNELTest/TransformedTriangleTest.hxx +++ b/src/INTERP_KERNELTest/TransformedTriangleTest.hxx @@ -20,7 +20,6 @@ #ifndef __TU_TRANSFORMED_TRIANGLE_HXX__ #define __TU_TRANSFORMED_TRIANGLE_HXX__ -#include #include #include "InterpKernelTestExport.hxx" @@ -46,8 +45,8 @@ namespace INTERP_TEST // CPPUNIT_TEST( test_calcStableC_Consistency ); CPPUNIT_TEST_SUITE_END(); - using TriSegment = INTERP_KERNEL::TransformedTriangle::TriSegment; - using DoubleProduct = INTERP_KERNEL::TransformedTriangle::DoubleProduct; + typedef INTERP_KERNEL::TransformedTriangle::TriSegment TriSegment; + typedef INTERP_KERNEL::TransformedTriangle::DoubleProduct DoubleProduct; public: void setUp(); diff --git a/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx b/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx index 8f7294914..28a91f427 100644 --- a/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx +++ b/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx @@ -19,12 +19,12 @@ #include "UnitTetra3D2DIntersectionTest.hxx" +#include "TetraAffineTransform.hxx" +#include "InterpolationUtils.hxx" #include "SplitterTetra.txx" -#include "NormalizedGeometricTypes" #include "MCIdType.hxx" -#include -#include +#include using namespace INTERP_KERNEL; @@ -32,7 +32,7 @@ namespace INTERP_TEST { struct __MESH_DUMMY { - using MyConnType = mcIdType; + typedef mcIdType MyConnType; static const int MY_SPACEDIM=3; }; @@ -47,7 +47,7 @@ namespace INTERP_TEST const double* tetraCoords[]={ targetCoords, targetCoords+3, targetCoords+6, targetCoords+9 }; - __MESH_DUMMY const dummyMesh; + __MESH_DUMMY dummyMesh; SplitterTetra<__MESH_DUMMY>* targetTetra = new SplitterTetra<__MESH_DUMMY>( dummyMesh, tetraCoords, conn ); return targetTetra; } @@ -80,13 +80,13 @@ namespace INTERP_TEST CPPUNIT_ASSERT_EQUAL(4,(int)listOfTetraFacesTreated.size()); std::multiset correctListOfTetraFacesTreated; - TriangleFaceKey const key1 = TriangleFaceKey(0, 1, 2); + TriangleFaceKey key1 = TriangleFaceKey(0, 1, 2); correctListOfTetraFacesTreated.insert(key1); - TriangleFaceKey const key2 = TriangleFaceKey(0, 1, 3); + TriangleFaceKey key2 = TriangleFaceKey(0, 1, 3); correctListOfTetraFacesTreated.insert(key2); - TriangleFaceKey const key3 = TriangleFaceKey(0, 2, 3); + TriangleFaceKey key3 = TriangleFaceKey(0, 2, 3); correctListOfTetraFacesTreated.insert(key3); - TriangleFaceKey const key4 = TriangleFaceKey(1, 2, 3); + TriangleFaceKey key4 = TriangleFaceKey(1, 2, 3); correctListOfTetraFacesTreated.insert(key4); CPPUNIT_ASSERT(correctListOfTetraFacesTreated == listOfTetraFacesTreated); @@ -126,13 +126,13 @@ namespace INTERP_TEST CPPUNIT_ASSERT_EQUAL(4,(int)listOfTetraFacesTreated.size()); std::multiset correctListOfTetraFacesTreated; - TriangleFaceKey const key1 = TriangleFaceKey(0, 1, 2); + TriangleFaceKey key1 = TriangleFaceKey(0, 1, 2); correctListOfTetraFacesTreated.insert(key1); - TriangleFaceKey const key2 = TriangleFaceKey(0, 1, 3); + TriangleFaceKey key2 = TriangleFaceKey(0, 1, 3); correctListOfTetraFacesTreated.insert(key2); - TriangleFaceKey const key3 = TriangleFaceKey(0, 2, 3); + TriangleFaceKey key3 = TriangleFaceKey(0, 2, 3); correctListOfTetraFacesTreated.insert(key3); - TriangleFaceKey const key4 = TriangleFaceKey(1, 2, 3); + TriangleFaceKey key4 = TriangleFaceKey(1, 2, 3); correctListOfTetraFacesTreated.insert(key4); CPPUNIT_ASSERT(correctListOfTetraFacesTreated == listOfTetraFacesTreated); diff --git a/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.hxx b/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.hxx index 740155f31..6b69728ed 100644 --- a/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.hxx +++ b/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.hxx @@ -20,7 +20,6 @@ #ifndef __UNITTETRA3D2DINTERSECTIONTEST_HXX__ #define __UNITTETRA3D2DINTERSECTIONTEST_HXX__ -#include #include #include "InterpKernelTestExport.hxx" diff --git a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx index 308c3167e..991b93c76 100644 --- a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx +++ b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx @@ -23,16 +23,13 @@ // #include "UnitTetraIntersectionBaryTest.hxx" -#include "TransformedTriangle.hxx" -#include "SplitterTetra.txx" -#include "InterpKernelException.hxx" #include "UnitTetraIntersectionBary.hxx" #include "TetraAffineTransform.hxx" #include "InterpolationUtils.hxx" +#include "SplitterTetra.txx" #include "MCIdType.hxx" -#include -#include +#include using namespace INTERP_KERNEL; @@ -49,7 +46,8 @@ namespace INTERP_TEST // { 1, 2, 3 }, // { 3, 2, 0 } }; bary.init(true); - for (auto faceNodes : faceConn) { + for ( int i = 0; i < 4; ++i ) { + int* faceNodes = faceConn[ i ]; TransformedTriangle tri(nodes[faceNodes[0]], nodes[faceNodes[1]], nodes[faceNodes[2]]); tri.calculateIntersectionVolume(); bary.addSide( tri ); @@ -65,8 +63,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.166667, vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.25, baryCenter[0], 1e-5); @@ -83,8 +81,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.166667, vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.25, baryCenter[0], 1e-5); @@ -101,8 +99,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.020833333333333332, vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.125, baryCenter[0], 1e-5); @@ -119,8 +117,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.020833333333333332, vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.125, baryCenter[0], 1e-5); @@ -137,8 +135,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.1215, vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.225, baryCenter[0], 1e-5); @@ -155,8 +153,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.000441855, vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.353463 , baryCenter[0], 1e-5 ); @@ -173,8 +171,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0103501, vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.215578 , baryCenter[0], 1e-5 ); @@ -191,8 +189,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0349217, vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.332275 , baryCenter[0], 1e-2 ); @@ -209,8 +207,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( !ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, vol, 1e-15); CPPUNIT_ASSERT_DOUBLES_EQUAL( -1. , baryCenter[0], 1e-5 ); @@ -227,8 +225,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.166667, vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.25, baryCenter[0], 1e-5); @@ -245,8 +243,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.15873 , vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.250000, baryCenter[0], 1e-5); @@ -263,8 +261,8 @@ namespace INTERP_TEST UnitTetraIntersectionBary bary; fill_UnitTetraIntersectionBary(bary,nodes); double baryCenter[3]; - bool const ok = bary.getBary( baryCenter ); - double const vol = bary.getVolume(); + bool ok = bary.getBary( baryCenter ); + double vol = bary.getVolume(); CPPUNIT_ASSERT( ok ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.005208 , vol, 1e-5); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.562500, baryCenter[0], 1e-5); @@ -274,7 +272,7 @@ namespace INTERP_TEST struct __MESH_DUMMY { - using MyConnType = mcIdType; + typedef mcIdType MyConnType; }; void UnitTetraIntersectionBaryTest::test_UnitTetraIntersectionBary_13() @@ -291,12 +289,12 @@ namespace INTERP_TEST 75,150,75, 100,100,100}; - mcIdType const conn[4] = { 0,1,2,3 }; + mcIdType conn[4] = { 0,1,2,3 }; const double* tnodes[4]={ T, T+3, T+6, T+9 }; const double* snodes[4]={ S, S+3, S+6, S+9 }; - __MESH_DUMMY const dummyMesh; + __MESH_DUMMY dummyMesh; SplitterTetra<__MESH_DUMMY> src( dummyMesh, snodes, conn ); double volume = src.intersectTetra( tnodes ); CPPUNIT_ASSERT_DOUBLES_EQUAL(6944.4444444444443,volume,1e-9); @@ -320,19 +318,19 @@ namespace INTERP_TEST 41.6666666666666714036, 120.0, 6.3333333333333348136, 25.0, 120.0, 17.6666666666666714036}; - mcIdType const conn[4] = { 0,1,2,3 }; + mcIdType conn[4] = { 0,1,2,3 }; const double* tnodes[4]={ T, T+3, T+6, T+9 }; const double* snodes[4]={ S, S+3, S+6, S+9 }; const double refVol = 48.6591695501729; - __MESH_DUMMY const dummyMesh; + __MESH_DUMMY dummyMesh; SplitterTetra<__MESH_DUMMY> src( dummyMesh, snodes, conn ); - double const volume = src.intersectTetra( tnodes ); + double volume = src.intersectTetra( tnodes ); CPPUNIT_ASSERT_DOUBLES_EQUAL(refVol,volume,1e-9); // Now the other way round: SplitterTetra<__MESH_DUMMY> tgt( dummyMesh, tnodes, conn ); - double const volume2 = tgt.intersectTetra( snodes ); + double volume2 = tgt.intersectTetra( snodes ); CPPUNIT_ASSERT_DOUBLES_EQUAL(refVol,volume2,1e-9); } @@ -346,7 +344,7 @@ namespace INTERP_TEST // double pSrc[3] = { -4.0, 9.0, 3.0 }; double pSrc[3] = { 40., -20., 100. }; double pDest[] = {1,1,1}; - TetraAffineTransform const a(nodes); + TetraAffineTransform a(nodes); a.apply( pDest, pSrc ); a.reverseApply( pDest, pDest ); CPPUNIT_ASSERT_DOUBLES_EQUAL( pSrc[0], pDest[0], 1e-12); @@ -357,7 +355,7 @@ namespace INTERP_TEST void UnitTetraIntersectionBaryTest::test_barycentric_coords() { // compute barycentric coordinates - double const nodes[4][3] = { {11.0, 0.0, 2.0 }, + double nodes[4][3] = { {11.0, 0.0, 2.0 }, {-4.0, 9.0, 3.0 }, { 0.0, 0.0, 0.0 }, { 6.0, 1.0,10.0 }}; @@ -406,9 +404,9 @@ namespace INTERP_TEST { 1.0, 2.0, 0.0 } }; // Translate cube: - for (auto & node : nodes) - for (double & j : node) - j += 15.0; + for (int i=0; i < 8; ++i) + for (int j=0; j < 3; ++j) + nodes[i][j] += 15.0; std::vector n (8); for (int i=0; i<8; i++) @@ -471,9 +469,9 @@ namespace INTERP_TEST { 1.0, 0.0 } }; // Translate quad4: - for (auto & node : nodes) - for (double & j : node) - j += 15.0; + for (int i=0; i < 4; ++i) + for (int j=0; j < 2; ++j) + nodes[i][j] += 15.0; std::vector n (4); for (int i=0; i<4; i++) diff --git a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.hxx b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.hxx index ac706b774..ab7dcecbd 100644 --- a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.hxx +++ b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.hxx @@ -24,7 +24,6 @@ #ifndef __UNITTETRAINTERSECTIONBARYTEST_HXX__ #define __UNITTETRAINTERSECTIONBARYTEST_HXX__ -#include #include #include "InterpKernelTestExport.hxx" diff --git a/src/MEDCoupling/MCAuto.hxx b/src/MEDCoupling/MCAuto.hxx index 748e05335..75b4827ce 100644 --- a/src/MEDCoupling/MCAuto.hxx +++ b/src/MEDCoupling/MCAuto.hxx @@ -20,9 +20,9 @@ #pragma once +#include "MEDCouplingRefCountObject.hxx" #include "InterpKernelException.hxx" -#include #include #include diff --git a/src/MEDCoupling/MCAuto.txx b/src/MEDCoupling/MCAuto.txx index 8b4e58141..903431054 100644 --- a/src/MEDCoupling/MCAuto.txx +++ b/src/MEDCoupling/MCAuto.txx @@ -23,7 +23,6 @@ #include "MCAuto.hxx" -#include #include namespace MEDCoupling diff --git a/src/MEDCoupling/MCType.hxx b/src/MEDCoupling/MCType.hxx index 5d2990aae..0dfa1f0b0 100644 --- a/src/MEDCoupling/MCType.hxx +++ b/src/MEDCoupling/MCType.hxx @@ -24,6 +24,7 @@ #include #include +#include namespace MEDCoupling { diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 45b446c4b..cdcb07682 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -18,46 +18,22 @@ // // Author : Anthony Geay (EDF R&D) -#include "CellModel.hxx" -#include "MEDCouplingPointSet.hxx" #include "MEDCoupling1GTUMesh.txx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "InterpKernelHashMap.hxx" -#include "InterpKernelException.hxx" -#include "MEDCouplingStructuredMesh.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingCMesh.hxx" -#include "NormalizedGeometricTypes" -#include "SplitterTetra.txx" +#include "SplitterTetra.hxx" #include "DiameterCalculator.hxx" #include "OrientationInverter.hxx" #include "InterpKernelAutoPtr.hxx" #include "VolSurfUser.txx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include using namespace MEDCoupling; const int MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS[6]={0,1,2,4,3,5}; -MEDCoupling1GTUMesh::MEDCoupling1GTUMesh():_cm(nullptr) +MEDCoupling1GTUMesh::MEDCoupling1GTUMesh():_cm(0) { } @@ -85,7 +61,7 @@ MEDCoupling1GTUMesh *MEDCoupling1GTUMesh::New(const MEDCouplingUMesh *m) { if(!m) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::New : input mesh is null !"); - std::set const gts(m->getAllGeoTypes()); + std::set gts(m->getAllGeoTypes()); if(gts.size()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::New : input mesh must have exactly one geometric type !"); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*gts.begin()); @@ -235,7 +211,7 @@ void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayIdType *profile, st */ DataArrayIdType *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !"); if(code[0]!=ToIdType(getCellModelEnum())) @@ -246,7 +222,7 @@ DataArrayIdType *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::v if(code[2]==-1) { if(code[1]==nbOfCells) - return nullptr; + return 0; else { std::ostringstream oss; oss << "MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : mismatch between the number of cells in this (" << nbOfCells << ") and the number of non profile (" << code[1] << ") !"; @@ -294,7 +270,7 @@ bool MEDCoupling1GTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double p return false; if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::isEqualIfNotWhy : input other pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1GTUMesh *otherC=dynamic_cast(other); if(!otherC) { reason="mesh given in input is not castable in MEDCouplingSGTUMesh !"; @@ -314,7 +290,7 @@ bool MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *ot return false; if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::isEqualWithoutConsideringStr : input other pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1GTUMesh *otherC=dynamic_cast(other); if(!otherC) return false; if(_cm!=otherC->_cm) @@ -454,34 +430,34 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v if(!firstPart) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : the first instance in input parts is null !"); const DataArrayDouble *coords(firstPart->getCoords()); - int const meshDim(firstPart->getMeshDimension()); + int meshDim(firstPart->getMeshDimension()); MCAuto ret(MEDCouplingUMesh::New(firstPart->getName(),meshDim)); ret->setDescription(firstPart->getDescription()); ret->setCoords(coords); mcIdType nbOfCells(0),connSize(0); - for(auto part : parts) + for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++) { - if(!part) + if(!(*it)) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : presence of null pointer in input vector !"); - if(part->getMeshDimension()!=meshDim) + if((*it)->getMeshDimension()!=meshDim) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances in input vector must have same mesh dimension !"); - if(part->getCoords()!=coords) + if((*it)->getCoords()!=coords) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances must share the same coordinates pointer !"); - nbOfCells+=part->getNumberOfCells(); - connSize+=part->getNodalConnectivityLength(); + nbOfCells+=(*it)->getNumberOfCells(); + connSize+=(*it)->getNodalConnectivityLength(); } MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()); connI->alloc(nbOfCells+1,1); conn->alloc(connSize+nbOfCells,1); mcIdType *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0; - for(auto part : parts) + for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++) { - mcIdType const curNbCells=part->getNumberOfCells(); - mcIdType const geoType(ToIdType(part->getCellModelEnum())); - const mcIdType *cinPtr(part->getNodalConnectivity()->begin()); - const auto *ps(dynamic_cast(part)); - const auto *pd(dynamic_cast(part)); + mcIdType curNbCells=(*it)->getNumberOfCells(); + mcIdType geoType(ToIdType((*it)->getCellModelEnum())); + const mcIdType *cinPtr((*it)->getNodalConnectivity()->begin()); + const MEDCoupling1SGTUMesh *ps(dynamic_cast(*it)); + const MEDCoupling1DGTUMesh *pd(dynamic_cast(*it)); if(ps && !pd) { - mcIdType const nNodesPerCell(ps->getNumberOfNodesPerCell()); + mcIdType nNodesPerCell(ps->getNumberOfNodesPerCell()); for(int i=0;i const gts(m->getAllGeoTypes()); + std::set gts(m->getAllGeoTypes()); if(gts.size()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : input mesh must have exactly one geometric type !"); - mcIdType const geoType(ToIdType(*gts.begin())); + mcIdType geoType(ToIdType(*gts.begin())); MCAuto ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin())); ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); - mcIdType const nbCells=m->getNumberOfCells(); - mcIdType const nbOfNodesPerCell(ret->getNumberOfNodesPerCell()); + mcIdType nbCells=m->getNumberOfCells(); + mcIdType nbOfNodesPerCell(ret->getNumberOfNodesPerCell()); MCAuto conn(DataArrayIdType::New()); conn->alloc(nbCells*nbOfNodesPerCell,1); mcIdType *c(conn->getPointer()); const mcIdType *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin()); @@ -608,7 +585,7 @@ void MEDCoupling1SGTUMesh::shallowCopyConnectivityFrom(const MEDCouplingPointSet { if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::shallowCopyConnectivityFrom : input pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1SGTUMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::shallowCopyConnectivityFrom : input pointer is not an MEDCoupling1SGTUMesh instance !"); setNodalConnectivity(otherC->getNodalConnectivity()); @@ -644,7 +621,7 @@ bool MEDCoupling1SGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::isEqualIfNotWhy : input other pointer is null !"); std::ostringstream oss; oss.precision(15); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1SGTUMesh *otherC=dynamic_cast(other); if(!otherC) { reason="mesh given in input is not castable in MEDCoupling1SGTUMesh !"; @@ -672,7 +649,7 @@ bool MEDCoupling1SGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o { if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::isEqualWithoutConsideringStr : input other pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1SGTUMesh *otherC=dynamic_cast(other); if(!otherC) return false; if(!MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(other,prec)) @@ -708,19 +685,19 @@ void MEDCoupling1SGTUMesh::checkConsistencyLight() const checkConsistencyOfConnectivity(); } -void MEDCoupling1SGTUMesh::checkConsistency(double /*eps*/) const +void MEDCoupling1SGTUMesh::checkConsistency(double eps) const { checkConsistencyLight(); const DataArrayIdType *c1(_conn); - mcIdType const nbOfTuples(c1->getNumberOfTuples()); - mcIdType const nbOfNodesPerCell=_cm->getNumberOfNodes(); + mcIdType nbOfTuples(c1->getNumberOfTuples()); + mcIdType nbOfNodesPerCell=_cm->getNumberOfNodes(); if(nbOfTuples%nbOfNodesPerCell!=0) { std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::checkConsistency : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType const nbOfNodes=getNumberOfNodes(); - mcIdType const nbOfCells=nbOfTuples/nbOfNodesPerCell; + mcIdType nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=nbOfTuples/nbOfNodesPerCell; const mcIdType *w(c1->begin()); for(mcIdType i=0;i ret=DataArrayIdType::New(); - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); ret->alloc(nbCells,1); mcIdType *retPtr(ret->getPointer()); - mcIdType const nbNodesPerCell(getNumberOfNodesPerCell()); + mcIdType nbNodesPerCell(getNumberOfNodesPerCell()); const mcIdType *conn(_conn->begin()); for(mcIdType i=0;i const s(conn,conn+nbNodesPerCell); + std::set s(conn,conn+nbNodesPerCell); *retPtr=ToIdType(s.size()); } return ret.retn(); @@ -793,7 +770,7 @@ DataArrayIdType *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const void MEDCoupling1SGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - mcIdType const sz=getNumberOfNodesPerCell(); + mcIdType sz=getNumberOfNodesPerCell(); conn.resize(sz); if(cellIdbegin()+cellId*sz,_conn->begin()+(cellId+1)*sz,conn.begin()); @@ -822,11 +799,11 @@ std::string MEDCoupling1SGTUMesh::simpleRepr() const ret << "Single static geometic type (" << _cm->getRepr() << ") unstructured mesh with name : \"" << getName() << "\"\n"; ret << "Description of mesh : \"" << getDescription() << "\"\n"; int tmpp1,tmpp2; - double const tt=getTime(tmpp1,tmpp2); + double tt=getTime(tmpp1,tmpp2); ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n"; ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; ret << "Mesh dimension : " << getMeshDimension() << "\nSpace dimension : "; - if(_coords!=nullptr) + if(_coords!=0) { const int spaceDim=getSpaceDimension(); ret << spaceDim << "\nInfo attached on space dimension : "; @@ -837,7 +814,7 @@ std::string MEDCoupling1SGTUMesh::simpleRepr() const else ret << msg0 << "\n"; ret << "Number of nodes : "; - if(_coords!=nullptr) + if(_coords!=0) ret << getNumberOfNodes() << "\n"; else ret << msg0 << "\n"; @@ -877,8 +854,8 @@ std::string MEDCoupling1SGTUMesh::advancedRepr() const { if(_conn->getNumberOfComponents()==1) { - mcIdType const nbOfCells=getNumberOfCells(); - mcIdType const sz=getNumberOfNodesPerCell(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType sz=getNumberOfNodesPerCell(); const mcIdType *connPtr=_conn->begin(); for(mcIdType i=0;i ret=DataArrayDouble::New(); - int const spaceDim=getSpaceDimension(); - mcIdType const nbOfCells=getNumberOfCells();//checkConsistencyLight() - mcIdType const nbOfNodes=getNumberOfNodes(); + int spaceDim=getSpaceDimension(); + mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight() + mcIdType nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); const double *coor=_coords->begin(); const mcIdType *nodal=_conn->begin(); - mcIdType const sz=getNumberOfNodesPerCell(); - double const coeff=1./FromIdType(sz); + mcIdType sz=getNumberOfNodesPerCell(); + double coeff=1./FromIdType(sz); for(mcIdType i=0;i o2n=DataArrayIdType::New(); o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1); if(check) @@ -940,12 +917,12 @@ void MEDCoupling1SGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check) MCAuto newConn=DataArrayIdType::New(); newConn->alloc(_conn->getNumberOfTuples(),1); newConn->copyStringInfoFrom(*_conn); - mcIdType const sz=getNumberOfNodesPerCell(); + mcIdType sz=getNumberOfNodesPerCell(); // mcIdType *newC=newConn->getPointer(); for(mcIdType i=0;i cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1); mcIdType tmp=-1; mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1; @@ -973,7 +950,7 @@ void MEDCoupling1SGTUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, c if(*work>=0 && *workbegin(); - mcIdType const nbNodesPerCell=getNumberOfNodesPerCell(); + mcIdType nbNodesPerCell=getNumberOfNodesPerCell(); for(mcIdType i=0;igetType()!=SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED) throw INTERP_KERNEL::Exception("Merge of umesh only available with umesh single static geo type each other !"); - const auto *otherC=static_cast(other); + const MEDCoupling1SGTUMesh *otherC=static_cast(other); return Merge1SGTUMeshes(this,otherC); } @@ -1003,9 +980,9 @@ MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const MCAuto ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); const mcIdType *nodalConn=_conn->begin(); - mcIdType const nbCells=getNumberOfCells(); - mcIdType const nbNodesPerCell=getNumberOfNodesPerCell(); - mcIdType const geoType=ToIdType(getCellModelEnum()); + mcIdType nbCells=getNumberOfCells(); + mcIdType nbNodesPerCell=getNumberOfNodesPerCell(); + mcIdType geoType=ToIdType(getCellModelEnum()); MCAuto c=DataArrayIdType::New(); c->alloc(nbCells*(nbNodesPerCell+1),1); mcIdType *cPtr=c->getPointer(); for(mcIdType i=0;i fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); - mcIdType const sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true))); + mcIdType sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true))); MCAuto ret(DataArrayIdType::New()); ret->alloc(sz,1); mcIdType *retPtr(ret->getPointer()); for(mcIdType i=0;i ret(DataArrayIdType::New()); ret->alloc(nbOfNodes,1); mcIdType *traducer=ret->getPointer(); std::fill(traducer,traducer+nbOfNodes,-1); const mcIdType *conn=_conn->begin(); - mcIdType const nbNodesPerCell=getNumberOfNodesPerCell(); + mcIdType nbNodesPerCell=getNumberOfNodesPerCell(); for(mcIdType i=0;i=0 && *conn& a) { - std::size_t const sz=a.size(); + std::size_t sz=a.size(); if(sz==0) return Merge1SGTUMeshesLL(a); for(std::size_t ii=0;ii::const_iterator it=a.begin(); mcIdType nbOfCells=(*it)->getNumberOfCells(); const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel()); - mcIdType const nbNodesPerCell=(*it)->getNumberOfNodesPerCell(); + mcIdType nbNodesPerCell=(*it)->getNumberOfNodesPerCell(); it++; for(;it!=a.end();it++) { @@ -1268,7 +1245,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vectorgetNodalConnectivityLength(); + mcIdType curConnLgth=(*it)->getNodalConnectivityLength(); const mcIdType *curC=(*it)->_conn->begin(); cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind(std::plus(),std::placeholders::_1,offset)); offset+=(*it)->getNumberOfNodes(); @@ -1280,12 +1257,12 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); - std::size_t const nbOfElemsRet=std::distance(begin,end); + std::size_t nbOfElemsRet=std::distance(begin,end); const mcIdType *inConn=_conn->getConstPointer(); - mcIdType const sz=getNumberOfNodesPerCell(); + mcIdType sz=getNumberOfNodesPerCell(); MCAuto connRet=DataArrayIdType::New(); connRet->alloc(nbOfElemsRet*sz,1); mcIdType *connPtr=connRet->getPointer(); for(const mcIdType *work=begin;work!=end;work++,connPtr+=sz) @@ -1305,12 +1282,12 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords(const mcI MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const { - mcIdType const ncell=getNumberOfCells(); - mcIdType const nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : "); + mcIdType ncell=getNumberOfCells(); + mcIdType nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : "); MCAuto ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); const mcIdType *inConn=_conn->getConstPointer(); - mcIdType const sz=getNumberOfNodesPerCell(); + mcIdType sz=getNumberOfNodesPerCell(); MCAuto connRet=DataArrayIdType::New(); connRet->alloc(nbOfElemsRet*sz,1); mcIdType *connPtr=connRet->getPointer(); mcIdType curId=start; @@ -1331,7 +1308,7 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice(mcId void MEDCoupling1SGTUMesh::computeNodeIdsAlg(std::vector& nodeIdsInUse) const { - mcIdType const sz(ToIdType(nodeIdsInUse.size())); + mcIdType sz(ToIdType(nodeIdsInUse.size())); for(const mcIdType *conn=_conn->begin();conn!=_conn->end();conn++) { if(*conn>=0 && *conn newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1); @@ -1389,7 +1366,7 @@ DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePol0() DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePol1() { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4) return DataArrayIdType::Range(0,nbOfCells,1); MCAuto newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1); @@ -1410,7 +1387,7 @@ DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePol1() DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePlanarFace5() { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8) return DataArrayIdType::Range(0,nbOfCells,1); MCAuto newConn=DataArrayIdType::New(); newConn->alloc(5*4*nbOfCells,1); @@ -1431,7 +1408,7 @@ DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePlanarFace5() DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePlanarFace6() { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8) return DataArrayIdType::Range(0,nbOfCells,1); MCAuto newConn=DataArrayIdType::New(); newConn->alloc(6*4*nbOfCells,1); @@ -1484,7 +1461,7 @@ void MEDCoupling1SGTUMesh::checkFullyDefined() const /*! * First step of unserialization process. */ -bool MEDCoupling1SGTUMesh::isEmptyMesh(const std::vector& /*tinyInfo*/) const +bool MEDCoupling1SGTUMesh::isEmptyMesh(const std::vector& tinyInfo) const { throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::isEmptyMesh : not implemented yet !"); } @@ -1492,7 +1469,7 @@ bool MEDCoupling1SGTUMesh::isEmptyMesh(const std::vector& /*tinyInfo* void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; - double const time=getTime(it,order); + double time=getTime(it,order); tinyInfo.clear(); tinyInfoD.clear(); littleStrings.clear(); // littleStrings.push_back(getName()); @@ -1524,10 +1501,10 @@ void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD.push_back(time); } -void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& /*littleStrings*/) const +void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { - std::vector const tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+tinyInfo[5]); - std::vector const tinyInfo1(tinyInfo.begin()+7+tinyInfo[5],tinyInfo.begin()+7+tinyInfo[5]+tinyInfo[6]); + std::vector tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+tinyInfo[5]); + std::vector tinyInfo1(tinyInfo.begin()+7+tinyInfo[5],tinyInfo.begin()+7+tinyInfo[5]+tinyInfo[6]); a1->resizeForUnserialization(tinyInfo1); a2->resizeForUnserialization(tinyInfo2); } @@ -1555,7 +1532,7 @@ void MEDCoupling1SGTUMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) void MEDCoupling1SGTUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { - auto const gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); + INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); _cm=&INTERP_KERNEL::CellModel::GetCellModel(gt); setName(littleStrings[0]); setDescription(littleStrings[1]); @@ -1564,16 +1541,16 @@ void MEDCoupling1SGTUMesh::unserialization(const std::vector& tinyInfoD, mcIdType sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]); // _coords=DataArrayDouble::New(); - std::vector const tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+sz2); + std::vector tinyInfo2(tinyInfo.begin()+7,tinyInfo.begin()+7+sz2); _coords->resizeForUnserialization(tinyInfo2); std::copy(a2->begin(),a2->end(),_coords->getPointer()); _conn=DataArrayIdType::New(); - std::vector const tinyInfo3(tinyInfo.begin()+7+sz2,tinyInfo.begin()+7+sz2+sz3); + std::vector tinyInfo3(tinyInfo.begin()+7+sz2,tinyInfo.begin()+7+sz2+sz3); _conn->resizeForUnserialization(tinyInfo3); std::copy(a1->begin(),a1->end(),_conn->getPointer()); - std::vector const littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0); + std::vector littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0); _coords->finishUnserialization(tinyInfo2,littleStrings2); - std::vector const littleStrings3(littleStrings.begin()+3+sz0,littleStrings.begin()+3+sz0+sz1); + std::vector littleStrings3(littleStrings.begin()+3+sz0,littleStrings.begin()+3+sz0+sz1); _conn->finishUnserialization(tinyInfo3,littleStrings3); } @@ -1590,7 +1567,7 @@ void MEDCoupling1SGTUMesh::unserialization(const std::vector& tinyInfoD, void MEDCoupling1SGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const { MEDCouplingPointSet::checkFastEquivalWith(other,prec); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1SGTUMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::checkFastEquivalWith : Two meshes are not unstructured with single static geometric type !"); const DataArrayIdType *c1(_conn),*c2(otherC->_conn); @@ -1610,7 +1587,7 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::mergeMyselfWithOnSameCoords(const MED { if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::mergeMyselfWithOnSameCoords : input other is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1SGTUMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::mergeMyselfWithOnSameCoords : the input other mesh is not of type single statuc geo type unstructured !"); std::vector ms(2); @@ -1622,14 +1599,14 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::mergeMyselfWithOnSameCoords(const MED void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const { checkFullyDefined(); - mcIdType const nbOfNodes=getNumberOfNodes(); - auto *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType)); + mcIdType nbOfNodes=getNumberOfNodes(); + mcIdType *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType)); revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1); std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0); const mcIdType *conn=_conn->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); mcIdType nbOfEltsInRevNodal=0; - mcIdType const nbOfNodesPerCell=getNumberOfNodesPerCell(); + mcIdType nbOfNodesPerCell=getNumberOfNodesPerCell(); for(mcIdType eltId=0;eltId()); conn=_conn->begin(); - auto *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType)); + mcIdType *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType)); revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1); std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1); for(mcIdType eltId=0;eltIdbegin()); MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4)); MCAuto c(DataArrayIdType::New()); c->alloc(nbHexa8*6*4,1); @@ -1791,7 +1768,7 @@ MCAuto MEDCoupling1SGTUMesh::computeTriangleHeight() const if(cm.getEnum()!=INTERP_KERNEL::NORM_TRI3) THROW_IK_EXCEPTION("MEDCoupling1SGTUMesh::computeTriangleHeight : this method can be applied only on TRI3 mesh !"); MCAuto ret(DataArrayDouble::New()); - mcIdType const nbTri3( getNumberOfCells() ); + mcIdType nbTri3( getNumberOfCells() ); const double *coordPtr( this->getCoords()->begin() ); const mcIdType *inConnPtr(getNodalConnectivity()->begin()); ret->alloc(nbTri3,3); @@ -1837,13 +1814,13 @@ MCAuto MEDCoupling1SGTUMesh::computeTriangleHeight() const MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayIdType *& cellPerm, DataArrayIdType *& nodePerm, double eps) const { checkConsistencyLight(); - int spaceDim(getSpaceDimension()),meshDim(getMeshDimension()); mcIdType const nbNodes(getNumberOfNodes()); + int spaceDim(getSpaceDimension()),meshDim(getMeshDimension()); mcIdType nbNodes(getNumberOfNodes()); if(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(meshDim)!=getCellModelEnum()) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::structurizeMe : the unique geo type in this is not compatible with the geometric type regarding mesh dimension !"); MCAuto cm(MEDCouplingCMesh::New()); for(int i=0;i const tmp(1,i); + std::vector tmp(1,i); MCAuto elt(static_cast(getCoords()->keepSelectedComponents(tmp))); elt=elt->getDifferentValues(eps); elt->sort(true); @@ -1874,10 +1851,10 @@ bool UpdateHexa8Cell(int validAxis, mcIdType neighId, const mcIdType *validConnQ static const int TAB2[6]={0,0,3,3,3,3}; if(myNeighbours[validAxis]==neighId && allFacesNodalConn[4*validAxis+0]==validConnQuad4NeighSide[TAB2[validAxis]]) return true; - mcIdType const oldAxis(ToIdType(std::distance(myNeighbours,std::find(myNeighbours,myNeighbours+6,neighId)))); - std::size_t const pos(std::distance(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,std::find(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS+6,oldAxis))); + mcIdType oldAxis(ToIdType(std::distance(myNeighbours,std::find(myNeighbours,myNeighbours+6,neighId)))); + std::size_t pos(std::distance(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,std::find(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS,MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS+6,oldAxis))); std::size_t pos0(pos/2),pos1(pos%2); - int const oldAxisOpp(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2]); + int oldAxisOpp(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2]); mcIdType oldConn[8],myConn2[8]={-1,-1,-1,-1,-1,-1,-1,-1},myConn[8],edgeConn[2],allFacesTmp[24],neighTmp[6]; oldConn[0]=allFacesNodalConn[0]; oldConn[1]=allFacesNodalConn[1]; oldConn[2]=allFacesNodalConn[2]; oldConn[3]=allFacesNodalConn[3]; oldConn[4]=allFacesNodalConn[4]; oldConn[5]=allFacesNodalConn[7]; oldConn[6]=allFacesNodalConn[6]; oldConn[7]=allFacesNodalConn[5]; @@ -1886,7 +1863,7 @@ bool UpdateHexa8Cell(int validAxis, mcIdType neighId, const mcIdType *validConnQ myConn2[i]=validConnQuad4NeighSide[(4-i+TAB2[validAxis])%4]; for(int i=0;i<4;i++) { - mcIdType const nodeId(myConn2[i]);//the node id for which the opposite one will be found + mcIdType nodeId(myConn2[i]);//the node id for which the opposite one will be found bool found(false); INTERP_KERNEL::NormalizedCellType typeOfSon; for(int j=0;j<12 && !found;j++) @@ -1910,11 +1887,11 @@ bool UpdateHexa8Cell(int validAxis, mcIdType neighId, const mcIdType *validConnQ for(int i=0;i<6;i++) { cm.fillSonCellNodalConnectivity(i,myConn,allFacesTmp+4*i); - std::set const s(allFacesTmp+4*i,allFacesTmp+4*i+4); + std::set s(allFacesTmp+4*i,allFacesTmp+4*i+4); bool found(false); for(int j=0;j<6 && !found;j++) { - std::set const s1(allFacesNodalConn+4*j,allFacesNodalConn+4*j+4); + std::set s1(allFacesNodalConn+4*j,allFacesNodalConn+4*j+4); if(s==s1) { neighTmp[i]=myNeighbours[j]; @@ -1944,42 +1921,42 @@ bool UpdateHexa8Cell(int validAxis, mcIdType neighId, const mcIdType *validConnQ DataArrayIdType *MEDCoupling1SGTUMesh::sortHexa8EachOther() { MCAuto quads(explodeEachHexa8To6Quad4());//checks that only hexa8 - mcIdType const nbHexa8=getNumberOfCells(); + mcIdType nbHexa8=getNumberOfCells(); mcIdType *cQuads(quads->getNodalConnectivity()->getPointer()); MCAuto neighOfQuads(DataArrayIdType::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1); mcIdType *ptNeigh(neighOfQuads->getPointer()); {//neighOfQuads tells for each face of each Quad8 which cell (if!=-1) is connected to this face. MCAuto quadsTmp(quads->buildUnstructured()); MCAuto ccSafe,cciSafe; - DataArrayIdType *cc(nullptr),*cci(nullptr); + DataArrayIdType *cc(0),*cci(0); quadsTmp->findCommonCells(3,0,cc,cci); ccSafe=cc; cciSafe=cci; const mcIdType *ccPtr(ccSafe->begin()); - mcIdType const nbOfPair=cci->getNumberOfTuples()-1; + mcIdType nbOfPair=cci->getNumberOfTuples()-1; for(mcIdType i=0;i ret(DataArrayIdType::New()); ret->alloc(0,1); std::vector fetched(nbHexa8,false); - auto it(std::find(fetched.begin(),fetched.end(),false)); + std::vector::iterator it(std::find(fetched.begin(),fetched.end(),false)); while(it!=fetched.end())//it will turns as time as number of connected zones { - mcIdType const cellId(ToIdType(std::distance(fetched.begin(),it)));//it is the seed of the connected zone. + mcIdType cellId(ToIdType(std::distance(fetched.begin(),it)));//it is the seed of the connected zone. std::set s; s.insert(cellId);//s contains already organized. while(!s.empty()) { std::set sNext; - for(long const it0 : s) + for(std::set::const_iterator it0=s.begin();it0!=s.end();it0++) { - fetched[it0]=true; - mcIdType *myNeighb(ptNeigh+6*it0); + fetched[*it0]=true; + mcIdType *myNeighb(ptNeigh+6*(*it0)); for(int i=0;i<6;i++) { if(myNeighb[i]!=-1 && !fetched[myNeighb[i]]) { - std::size_t const pos(std::distance(HEXA8_FACE_PAIRS,std::find(HEXA8_FACE_PAIRS,HEXA8_FACE_PAIRS+6,i))); + std::size_t pos(std::distance(HEXA8_FACE_PAIRS,std::find(HEXA8_FACE_PAIRS,HEXA8_FACE_PAIRS+6,i))); std::size_t pos0(pos/2),pos1(pos%2); - if(!UpdateHexa8Cell(HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2],it0,cQuads+6*4*it0+4*i,cQuads+6*4*myNeighb[i],ptNeigh+6*myNeighb[i])) + if(!UpdateHexa8Cell(HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2],*it0,cQuads+6*4*(*it0)+4*i,cQuads+6*4*myNeighb[i],ptNeigh+6*myNeighb[i])) ret->pushBackSilent(myNeighb[i]); fetched[myNeighb[i]]=true; sNext.insert(myNeighb[i]); @@ -1993,8 +1970,9 @@ DataArrayIdType *MEDCoupling1SGTUMesh::sortHexa8EachOther() if(!ret->empty()) { mcIdType *conn(getNodalConnectivity()->getPointer()); - for(long const cellId : *ret) + for(const mcIdType *pt=ret->begin();pt!=ret->end();pt++) { + mcIdType cellId(*pt); conn[8*cellId+0]=cQuads[24*cellId+0]; conn[8*cellId+1]=cQuads[24*cellId+1]; conn[8*cellId+2]=cQuads[24*cellId+2]; conn[8*cellId+3]=cQuads[24*cellId+3]; conn[8*cellId+4]=cQuads[24*cellId+4]; conn[8*cellId+5]=cQuads[24*cellId+7]; conn[8*cellId+6]=cQuads[24*cellId+6]; conn[8*cellId+7]=cQuads[24*cellId+5]; } @@ -2029,21 +2007,21 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh3D() const MCAuto edges(thisu->explode3DMeshTo1D(d1Arr,di1Arr,rd1Arr,rdi1Arr)); const mcIdType *d1(d1Arr->begin()); MCAuto d2Arr(DataArrayIdType::New()),di2Arr(DataArrayIdType::New()),rd2Arr(DataArrayIdType::New()),rdi2Arr(DataArrayIdType::New()); - MCAuto faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=nullptr; + MCAuto faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0; const mcIdType *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); MCAuto edgesBaryArr(edges->computeCellCenterOfMass()),facesBaryArr(faces->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass()); const mcIdType nbOfNodes(getNumberOfNodes()); const mcIdType offset0=nbOfNodes+faces->getNumberOfCells(); const mcIdType offset1=offset0+edges->getNumberOfCells(); - edges=nullptr; faces=nullptr; + edges=0; faces=0; std::vector v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr; - MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=nullptr; edgesBaryArr=nullptr; facesBaryArr=nullptr; + MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0; std::string name("DualOf_"); name+=getName(); MCAuto ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr); MCAuto cArr(DataArrayIdType::New()),ciArr(DataArrayIdType::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); for(mcIdType i=0;ipushBackSilent(-1); mcIdType tmp[14]; // @@ -2103,19 +2081,19 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const thisu->getReverseNodalConnectivity(revNodArr,revNodIArr); const mcIdType *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); MCAuto d2Arr(DataArrayIdType::New()),di2Arr(DataArrayIdType::New()),rd2Arr(DataArrayIdType::New()),rdi2Arr(DataArrayIdType::New()); - MCAuto edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=nullptr; + MCAuto edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0; const mcIdType *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); MCAuto edgesBaryArr(edges->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass()); const mcIdType nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells()); - edges=nullptr; + edges=0; std::vector v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr; - MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=nullptr; edgesBaryArr=nullptr; + MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; std::string name("DualOf_"); name+=getName(); MCAuto ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr); MCAuto cArr(DataArrayIdType::New()),ciArr(DataArrayIdType::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); for(mcIdType i=0;i > polyg; for(int j=0;j locV(3); locV[0]=d2[3*curCellId+DUAL_TRI_0[2*nodePosInCurCell+0]]+nbOfNodes; locV[1]=curCellId+offset0; locV[2]=d2[3*curCellId+DUAL_TRI_0[2*nodePosInCurCell+1]]+nbOfNodes; polyg.push_back(locV); @@ -2139,7 +2117,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const if(rdi2[*edgeId+1]-rdi2[*edgeId]==1) { std::vector locV2(2); - int const zeLocEdgeIdRel(DUAL_TRI_1[2*nodePosInCurCell+kk]); + int zeLocEdgeIdRel(DUAL_TRI_1[2*nodePosInCurCell+kk]); if(zeLocEdgeIdRel>0) { locV2[0]=d2[3*curCellId+zeLocEdgeIdRel-3]+nbOfNodes; locV2[1]=i; } else @@ -2168,7 +2146,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const * \throw If \a this is not fully set (coordinates and connectivity). * \throw If a cell in \a this has no valid nodeId. */ -DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double /*arcDetEps*/) const +DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const { mcIdType spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); @@ -2185,7 +2163,7 @@ DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double /*arcDetE int kk(0); for(int j=0;j=0 && nodeId ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); INTERP_KERNEL::AutoCppPtr dc(_cm->buildInstanceOfDiameterCalulator(getSpaceDimension())); @@ -2262,7 +2240,8 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::New(const std::string& name, INTERP_ } MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh() -= default; +{ +} MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm):MEDCoupling1GTUMesh(name,cm) { @@ -2336,7 +2315,7 @@ bool MEDCoupling1DGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::isEqualIfNotWhy : input other pointer is null !"); std::ostringstream oss; oss.precision(15); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1DGTUMesh *otherC=dynamic_cast(other); if(!otherC) { reason="mesh given in input is not castable in MEDCoupling1DGTUMesh !"; @@ -2377,7 +2356,7 @@ bool MEDCoupling1DGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o { if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::isEqualWithoutConsideringStr : input other pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1DGTUMesh *otherC=dynamic_cast(other); if(!otherC) return false; if(!MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(other,prec)) @@ -2405,7 +2384,7 @@ bool MEDCoupling1DGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o void MEDCoupling1DGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const { MEDCouplingPointSet::checkFastEquivalWith(other,prec); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1DGTUMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkFastEquivalWith : Two meshes are not unstructured with single dynamic geometric type !"); const DataArrayIdType *c1(_conn),*c2(otherC->_conn); @@ -2448,7 +2427,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const else throw INTERP_KERNEL::Exception("Nodal connectivity array not defined !"); // - mcIdType const sz2(_conn->getNumberOfTuples()); + mcIdType sz2(_conn->getNumberOfTuples()); c1=_conn_indx; if(c1) { @@ -2478,7 +2457,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const } else throw INTERP_KERNEL::Exception("Nodal connectivity index array not defined !"); - mcIdType const szOfC1Exp=_conn_indx->back(); + mcIdType szOfC1Exp=_conn_indx->back(); if(sz2getNumberOfTuples() << " !"; @@ -2497,15 +2476,15 @@ void MEDCoupling1DGTUMesh::checkConsistencyLight() const checkConsistencyOfConnectivity(); } -void MEDCoupling1DGTUMesh::checkConsistency(double /*eps*/) const +void MEDCoupling1DGTUMesh::checkConsistency(double eps) const { checkConsistencyLight(); const DataArrayIdType *c1(_conn),*c2(_conn_indx); if(!c2->isMonotonic(true)) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkConsistency : the nodal connectivity index is expected to be increasing monotinic !"); // - mcIdType const nbOfTuples(c1->getNumberOfTuples()); - mcIdType const nbOfNodes=getNumberOfNodes(); + mcIdType nbOfTuples(c1->getNumberOfTuples()); + mcIdType nbOfNodes=getNumberOfNodes(); const mcIdType *w(c1->begin()); for(mcIdType i=0;ideltaShiftIndex(); // for polyhedrons - mcIdType const nbOfCells=_conn_indx->getNumberOfTuples()-1; + mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); mcIdType *retPtr=ret->getPointer(); @@ -2568,7 +2547,7 @@ DataArrayIdType *MEDCoupling1DGTUMesh::computeNbOfFacesPerCell() const return ret.retn(); } // for polyhedrons - mcIdType const nbOfCells=_conn_indx->getNumberOfTuples()-1; + mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); mcIdType *retPtr=ret->getPointer(); @@ -2589,7 +2568,7 @@ DataArrayIdType *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const { checkConsistencyLight(); _conn_indx->checkMonotonic(true); - mcIdType const nbOfCells=_conn_indx->getNumberOfTuples()-1; + mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); mcIdType *retPtr(ret->getPointer()); @@ -2598,7 +2577,7 @@ DataArrayIdType *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const { for(mcIdType i=0;i const s(c+ci[0],c+ci[1]); + std::set s(c+ci[0],c+ci[1]); *retPtr=ToIdType(s.size()); } } @@ -2615,11 +2594,11 @@ DataArrayIdType *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const void MEDCoupling1DGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - mcIdType const nbOfCells(getNumberOfCells());//performs checks + mcIdType nbOfCells(getNumberOfCells());//performs checks if(cellIdgetIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0); - mcIdType const nbOfNodes=stp-strt; + mcIdType nbOfNodes=stp-strt; if(nbOfNodes<0) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::getNodeIdsOfCell : the index array is invalid ! Should be increasing monotonic !"); conn.resize(nbOfNodes); @@ -2634,7 +2613,7 @@ void MEDCoupling1DGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector=0 && cellIdbegin()); @@ -2657,11 +2636,11 @@ std::string MEDCoupling1DGTUMesh::simpleRepr() const ret << "Single dynamic geometic type (" << _cm->getRepr() << ") unstructured mesh with name : \"" << getName() << "\"\n"; ret << "Description of mesh : \"" << getDescription() << "\"\n"; int tmpp1,tmpp2; - double const tt=getTime(tmpp1,tmpp2); + double tt=getTime(tmpp1,tmpp2); ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n"; ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; ret << "Mesh dimension : " << getMeshDimension() << "\nSpace dimension : "; - if(_coords!=nullptr) + if(_coords!=0) { const int spaceDim=getSpaceDimension(); ret << spaceDim << "\nInfo attached on space dimension : "; @@ -2672,7 +2651,7 @@ std::string MEDCoupling1DGTUMesh::simpleRepr() const else ret << msg0 << "\n"; ret << "Number of nodes : "; - if(_coords!=nullptr) + if(_coords!=0) ret << getNumberOfNodes() << "\n"; else ret << msg0 << "\n"; @@ -2708,7 +2687,7 @@ std::string MEDCoupling1DGTUMesh::advancedRepr() const } if(!isOK) return ret.str(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *ci=_conn_indx->begin(),*c=_conn->begin(); for(mcIdType i=0;i ret=DataArrayDouble::New(); - int const spaceDim=getSpaceDimension(); - mcIdType const nbOfCells=getNumberOfCells();//checkConsistencyLight() - mcIdType const nbOfNodes=getNumberOfNodes(); + int spaceDim=getSpaceDimension(); + mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight() + mcIdType nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); const double *coor=_coords->begin(); @@ -2798,7 +2777,7 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons void MEDCoupling1DGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check) { - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); MCAuto o2n=DataArrayIdType::New(); o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1); if(check) @@ -2814,8 +2793,8 @@ void MEDCoupling1DGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check) mcIdType *newC=newConn->getPointer(),*newCI=newConnI->getPointer(); for(mcIdType i=0;i=0) newCI[newPos]=sz; else @@ -2828,7 +2807,7 @@ void MEDCoupling1DGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check) // for(mcIdType i=0;igetType()!=SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED) throw INTERP_KERNEL::Exception("Merge of umesh only available with umesh single dynamic geo type each other !"); - const auto *otherC=static_cast(other); + const MEDCoupling1DGTUMesh *otherC=static_cast(other); return Merge1DGTUMeshes(this,otherC); } @@ -2848,15 +2827,15 @@ MEDCouplingUMesh *MEDCoupling1DGTUMesh::buildUnstructured() const MCAuto ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); const mcIdType *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin(); - mcIdType const nbCells=getNumberOfCells();//checkConsistencyLight - mcIdType const geoType=ToIdType(getCellModelEnum()); + mcIdType nbCells=getNumberOfCells();//checkConsistencyLight + mcIdType geoType=ToIdType(getCellModelEnum()); MCAuto c=DataArrayIdType::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1); MCAuto cI=DataArrayIdType::New(); cI->alloc(nbCells+1); mcIdType *cPtr=c->getPointer(),*ciPtr=cI->getPointer(); ciPtr[0]=0; for(mcIdType i=0;i=0) { *cPtr++=geoType; @@ -2879,9 +2858,9 @@ MEDCouplingUMesh *MEDCoupling1DGTUMesh::buildUnstructured() const /*! * Do nothing for the moment, because there is no policy that allows to split polygons, polyhedrons ... into simplexes */ -DataArrayIdType *MEDCoupling1DGTUMesh::simplexize(int /*policy*/) +DataArrayIdType *MEDCoupling1DGTUMesh::simplexize(int policy) { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); ret->iota(0); @@ -2918,7 +2897,7 @@ void MEDCoupling1DGTUMesh::shallowCopyConnectivityFrom(const MEDCouplingPointSet { if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::shallowCopyConnectivityFrom : input pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1DGTUMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::shallowCopyConnectivityFrom : input pointer is not an MEDCoupling1DGTUMesh instance !"); setNodalConnectivity(otherC->getNodalConnectivity(),otherC->getNodalConnectivityIndex()); @@ -2928,7 +2907,7 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords(const MED { if(!other) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords : input other is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCoupling1DGTUMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords : the input other mesh is not of type single statuc geo type unstructured !"); std::vector ms(2); @@ -2942,7 +2921,7 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const mcI checkConsistencyLight(); MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); - DataArrayIdType *c=nullptr,*ci=nullptr; + DataArrayIdType *c=0,*ci=0; DataArrayIdType::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci); MCAuto cSafe(c),ciSafe(ci); ret->setNodalConnectivity(c,ci); @@ -2954,7 +2933,7 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoordsSlice(mcId checkConsistencyLight(); MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); - DataArrayIdType *c=nullptr,*ci=nullptr; + DataArrayIdType *c=0,*ci=0; DataArrayIdType::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci); MCAuto cSafe(c),ciSafe(ci); ret->setNodalConnectivity(c,ci); @@ -2964,7 +2943,7 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoordsSlice(mcId void MEDCoupling1DGTUMesh::computeNodeIdsAlg(std::vector& nodeIdsInUse) const { checkConsistency(); - mcIdType const sz(ToIdType(nodeIdsInUse.size())); + mcIdType sz(ToIdType(nodeIdsInUse.size())); for(const mcIdType *conn=_conn->begin();conn!=_conn->end();conn++) { if(*conn>=0 && *conn& nodeIdsInUse) co void MEDCoupling1DGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const { checkFullyDefined(); - mcIdType const nbOfNodes=getNumberOfNodes(); - auto *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType)); + mcIdType nbOfNodes=getNumberOfNodes(); + mcIdType *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType)); revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1); std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0); const mcIdType *conn=_conn->begin(),*conni=_conn_indx->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); mcIdType nbOfEltsInRevNodal=0; for(mcIdType eltId=0;eltId=0) { for(mcIdType j=0;j=0 && nodeId()); conn=_conn->begin(); - auto *revNodalPtr=(mcIdType *)malloc((nbOfEltsInRevNodal)*sizeof(mcIdType)); + mcIdType *revNodalPtr=(mcIdType *)malloc((nbOfEltsInRevNodal)*sizeof(mcIdType)); revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1); std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1); for(mcIdType eltId=0;eltId(),std::placeholders::_1,-1))=eltId; } @@ -3040,7 +3019,7 @@ void MEDCoupling1DGTUMesh::checkFullyDefined() const throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkFullyDefined : part of this is not fully defined."); } -bool MEDCoupling1DGTUMesh::isEmptyMesh(const std::vector& /*tinyInfo*/) const +bool MEDCoupling1DGTUMesh::isEmptyMesh(const std::vector& tinyInfo) const { throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::isEmptyMesh : not implemented yet !"); } @@ -3048,7 +3027,7 @@ bool MEDCoupling1DGTUMesh::isEmptyMesh(const std::vector& /*tinyInfo* void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; - double const time=getTime(it,order); + double time=getTime(it,order); tinyInfo.clear(); tinyInfoD.clear(); littleStrings.clear(); // littleStrings.push_back(getName()); @@ -3086,11 +3065,11 @@ void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD.push_back(time); } -void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& /*littleStrings*/) const +void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { - std::vector const tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]); - std::vector const tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]); - std::vector const tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]); + std::vector tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]); + std::vector tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]); + std::vector tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]); MCAuto p1(DataArrayIdType::New()); p1->resizeForUnserialization(tinyInfo1); MCAuto p2(DataArrayIdType::New()); p2->resizeForUnserialization(tinyInfo12); std::vector v(2); v[0]=p1; v[1]=p2; @@ -3128,7 +3107,7 @@ void MEDCoupling1DGTUMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { - auto gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); + INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); _cm=&INTERP_KERNEL::CellModel::GetCellModel(gt); setName(littleStrings[0]); setDescription(littleStrings[1]); @@ -3137,22 +3116,22 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, mcIdType sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]),sz4(tinyInfo[7]),sz5(tinyInfo[8]); // _coords=DataArrayDouble::New(); - std::vector const tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+sz3); + std::vector tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+sz3); _coords->resizeForUnserialization(tinyInfo2); std::copy(a2->begin(),a2->end(),_coords->getPointer()); _conn=DataArrayIdType::New(); - std::vector const tinyInfo3(tinyInfo.begin()+9+sz3,tinyInfo.begin()+9+sz3+sz4); + std::vector tinyInfo3(tinyInfo.begin()+9+sz3,tinyInfo.begin()+9+sz3+sz4); _conn->resizeForUnserialization(tinyInfo3); std::copy(a1->begin(),a1->begin()+_conn->getNbOfElems(),_conn->getPointer()); _conn_indx=DataArrayIdType::New(); - std::vector const tinyInfo4(tinyInfo.begin()+9+sz3+sz4,tinyInfo.begin()+9+sz3+sz4+sz5); + std::vector tinyInfo4(tinyInfo.begin()+9+sz3+sz4,tinyInfo.begin()+9+sz3+sz4+sz5); _conn_indx->resizeForUnserialization(tinyInfo4); std::copy(a1->begin()+_conn->getNbOfElems(),a1->end(),_conn_indx->getPointer()); - std::vector const littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0); + std::vector littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0); _coords->finishUnserialization(tinyInfo2,littleStrings2); - std::vector const littleStrings3(littleStrings.begin()+3+sz0,littleStrings.begin()+3+sz0+sz1); + std::vector littleStrings3(littleStrings.begin()+3+sz0,littleStrings.begin()+3+sz0+sz1); _conn->finishUnserialization(tinyInfo3,littleStrings3); - std::vector const littleStrings4(littleStrings.begin()+3+sz0+sz1,littleStrings.begin()+3+sz0+sz1+sz2); + std::vector littleStrings4(littleStrings.begin()+3+sz0+sz1,littleStrings.begin()+3+sz0+sz1+sz2); _conn_indx->finishUnserialization(tinyInfo4,littleStrings4); } @@ -3172,10 +3151,10 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, DataArrayIdType *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const { checkConsistency(); - mcIdType const nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); std::vector fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); - mcIdType const sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true))); + mcIdType sz(ToIdType(std::count(fetchedNodes.begin(),fetchedNodes.end(),true))); MCAuto ret(DataArrayIdType::New()); ret->alloc(sz,1); mcIdType *retPtr(ret->getPointer()); for(mcIdType i=0;i ret=DataArrayIdType::New(); ret->alloc(nbOfNodes,1); mcIdType *traducer=ret->getPointer(); @@ -3210,10 +3189,10 @@ DataArrayIdType *MEDCoupling1DGTUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse const mcIdType *conn=_conn->begin(),*conni(_conn_indx->begin()); for(mcIdType i=0;i=0 && nodeIdgetNumberOfTuples()); + mcIdType nbOfTuples(_conn->getNumberOfTuples()); mcIdType *pt(_conn->getPointer()); for(mcIdType i=0;i cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1); mcIdType tmp=-1; mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1; @@ -3328,12 +3307,12 @@ void MEDCoupling1DGTUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, c for(mcIdType i=0;i=0) { for(mcIdType j=0;j=0) { ref++; @@ -3375,11 +3354,11 @@ void MEDCoupling1DGTUMesh::allocateCells(mcIdType nbOfCells) */ void MEDCoupling1DGTUMesh::insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd) { - std::size_t const sz(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd)); + std::size_t sz(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd)); DataArrayIdType *c(_conn),*c2(_conn_indx); if(c && c2) { - mcIdType const pos=c2->back(); + mcIdType pos=c2->back(); if(pos==c->getNumberOfTuples()) { c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd); @@ -3440,7 +3419,7 @@ DataArrayIdType *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const { MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); - DataArrayIdType *nc=nullptr,*nci=nullptr; + DataArrayIdType *nc=0,*nci=0; isShallowCpyOfNodalConnn=retrievePackedNodalConnectivity(nc,nci); MCAuto ncs(nc),ncis(nci); ret->_conn=ncs; ret->_conn_indx=ncis; @@ -3509,7 +3488,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(const MEDCoupling1D MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(std::vector& a) { - std::size_t const sz=a.size(); + std::size_t sz=a.size(); if(sz==0) return Merge1DGTUMeshesLL(a); for(std::size_t ii=0;iigetConstPointer()),*connI(_conn_indx->getConstPointer()); for(mcIdType i=0;i=0 && nodeId oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum())); - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); const mcIdType *connI(_conn_indx->begin()); mcIdType *conn(_conn->getPointer()); for(mcIdType i=0;i::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++) { - if(!nodalConn) + if(!(*it)) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of null pointer in input vector !"); - if(!nodalConn->isAllocated()) + if(!(*it)->isAllocated()) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of non allocated array in input vector !"); - if(nodalConn->getNumberOfComponents()!=1) + if((*it)->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of array with not exactly one component !"); - nbOfTuples+=nodalConn->getNumberOfTuples(); + nbOfTuples+=(*it)->getNumberOfTuples(); } MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1); mcIdType *pt=ret->getPointer(); mcIdType i=0; - for(auto it=nodalConns.begin();it!=nodalConns.end();it++,i++) + for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++) { - mcIdType const curNbt=(*it)->getNumberOfTuples(); + mcIdType curNbt=(*it)->getNumberOfTuples(); const mcIdType *inPt=(*it)->begin(); - mcIdType const offset=offsetInNodeIdsPerElt[i]; + mcIdType offset=offsetInNodeIdsPerElt[i]; for(mcIdType j=0;j const gts(m->getAllGeoTypes()); + std::set gts(m->getAllGeoTypes()); if(gts.size()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : input mesh must have exactly one geometric type !"); - mcIdType const geoType(ToIdType(*gts.begin())); + mcIdType geoType(ToIdType(*gts.begin())); MCAuto ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin())); ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); - mcIdType const nbCells=m->getNumberOfCells(); + mcIdType nbCells=m->getNumberOfCells(); MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()); conn->alloc(m->getNodalConnectivityArrayLen()-nbCells,1); connI->alloc(nbCells+1,1); mcIdType *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0; diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx index 50845fb68..1e637c670 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx @@ -21,23 +21,13 @@ #ifndef __PARAMEDMEM_MEDCOUPLING1GTUMESH_HXX__ #define __PARAMEDMEM_MEDCOUPLING1GTUMESH_HXX__ -#include "InterpKernelHashMap.hxx" #include "MEDCoupling.hxx" #include "MCType.hxx" -#include "MEDCouplingMesh.hxx" #include "MEDCouplingPointSet.hxx" #include "MEDCouplingMemArray.hxx" #include "MCAuto.hxx" #include "CellModel.hxx" -#include -#include "NormalizedGeometricTypes" -#include -#include -#include -#include -#include "MEDCouplingRefCountObject.hxx" -#include namespace MEDCoupling { @@ -50,36 +40,36 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m); MEDCOUPLING_EXPORT const INTERP_KERNEL::CellModel& getCellModel() const; MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getCellModelEnum() const; - MEDCOUPLING_EXPORT int getMeshDimension() const override; - MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const override; - MEDCOUPLING_EXPORT std::set getAllGeoTypes() const override; - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const override; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const override; - MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const override; - MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override; - MEDCOUPLING_EXPORT std::string getVTKDataSetType() const override; - MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override; + MEDCOUPLING_EXPORT int getMeshDimension() const; + MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; + MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; + MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; + MEDCOUPLING_EXPORT std::string getVTKDataSetType() const; + MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; // - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT mcIdType getNodalConnectivityLength() const; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override; - MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override; + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const override; MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override; - MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const override; - MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) override; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const override; - MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const override; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const override; - MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const override; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; + MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const; + MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps); + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const; + MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const; + MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const; MEDCOUPLING_EXPORT static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(const std::vector< const MEDCoupling1GTUMesh *>& parts); public: MEDCOUPLING_EXPORT virtual void allocateCells(mcIdType nbOfCells=0) = 0; @@ -106,61 +96,61 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New(); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCoupling1SGTUMesh"); } // Copy methods - MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *clone(bool recDeepCpy) const override; - MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopy() const override; - MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopyConnectivityOnly() const override; + MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopy() const; + MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopyConnectivityOnly() const; // overload of TimeLabel and RefCountObject - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; // overload of MEDCouplingMesh - MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED; } + MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED; } - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override; - MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override; - MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const override; - MEDCOUPLING_EXPORT std::string simpleRepr() const override; - MEDCOUPLING_EXPORT std::string advancedRepr() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override; - MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override; - MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override; - MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; + MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const; + MEDCOUPLING_EXPORT std::string simpleRepr() const; + MEDCOUPLING_EXPORT std::string advancedRepr() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; + MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy); + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; // overload of MEDCouplingPointSet - MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) override; - MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const override; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const override; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const override; - MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector& nodeIdsInUse) const override; - MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override; - MEDCOUPLING_EXPORT void checkFullyDefined() const override; - MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const override; - MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const override; - MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset) override; - MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) override; + MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other); + MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const; + MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector& nodeIdsInUse) const; + MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const; + MEDCOUPLING_EXPORT void checkFullyDefined() const; + MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const; + MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const; + MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset); + MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N); MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& newNodeNumbersO2N) override; - MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N) override; - MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const override; - MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const override; - MEDCOUPLING_EXPORT void invertOrientationOfAllCells() override; + MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N); + MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const; + MEDCOUPLING_EXPORT void invertOrientationOfAllCells(); // overload of MEDCoupling1GTUMesh - MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const override; - MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0) override; - MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd) override; + MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const; + MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0); + MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd); public://specific MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayIdType *nodalConn); - MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const override; + MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const; MEDCOUPLING_EXPORT mcIdType getNumberOfNodesPerCell() const; MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2); MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(std::vector& a); @@ -172,11 +162,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MCAuto computeTriangleHeight() const; MEDCOUPLING_EXPORT MEDCouplingCMesh *structurizeMe(DataArrayIdType *& cellPerm, DataArrayIdType *& nodePerm, double eps=1e-12) const; public://serialization - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, - const std::vector& littleStrings) override; + const std::vector& littleStrings); private: MEDCoupling1SGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); MEDCoupling1SGTUMesh(const MEDCoupling1SGTUMesh& other, bool recDeepCpy); @@ -207,61 +197,61 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCoupling1DGTUMesh"); } // Copy methods - MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *clone(bool recDeepCpy) const override; - MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopy() const override; - MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopyConnectivityOnly() const override; + MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopy() const; + MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopyConnectivityOnly() const; // overload of TimeLabel and RefCountObject - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; // overload of MEDCouplingMesh - MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED; } - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override; - MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override; - MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const override; - MEDCOUPLING_EXPORT std::string simpleRepr() const override; - MEDCOUPLING_EXPORT std::string advancedRepr() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override; - MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override; - MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override; - MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED; } + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; + MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const; + MEDCOUPLING_EXPORT std::string simpleRepr() const; + MEDCOUPLING_EXPORT std::string advancedRepr() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; + MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy); + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; // overload of MEDCouplingPointSet - MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) override; - MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const override; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const override; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const override; - MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector& nodeIdsInUse) const override; - MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override; - MEDCOUPLING_EXPORT void checkFullyDefined() const override; - MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const override; - MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const override; - MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset) override; - MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) override; + MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other); + MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const; + MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector& nodeIdsInUse) const; + MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const; + MEDCOUPLING_EXPORT void checkFullyDefined() const; + MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const; + MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const; + MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset); + MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N); MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& newNodeNumbersO2N) override; - MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N) override; - MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const override; - MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const override; - MEDCOUPLING_EXPORT void invertOrientationOfAllCells() override; + MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N); + MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const; + MEDCOUPLING_EXPORT void invertOrientationOfAllCells(); // overload of MEDCoupling1GTUMesh - MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const override; - MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0) override; - MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd) override; + MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const; + MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0); + MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd); public://specific MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex); - MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const override; + MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const; MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivityIndex() const; MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const; MEDCOUPLING_EXPORT bool retrievePackedNodalConnectivity(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndx) const; @@ -273,11 +263,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static std::vector BuildAPolygonFromParts(const std::vector< std::vector >& parts); MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const; public://serialization - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, - const std::vector& littleStrings) override; + const std::vector& littleStrings); private: MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); MEDCoupling1DGTUMesh(const MEDCoupling1DGTUMesh& other, bool recDeepCpy); diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.txx b/src/MEDCoupling/MEDCoupling1GTUMesh.txx index afca389b0..e265cdf4d 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.txx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.txx @@ -19,10 +19,8 @@ // Author : Anthony Geay (EDF R&D) #pragma once -#include "MCType.hxx" #include "MEDCoupling1GTUMesh.hxx" -#include #include template @@ -30,7 +28,7 @@ void MEDCoupling::MEDCoupling1SGTUMesh::renumberNodesInConnT(const MAPCLS& newNo { getNumberOfCells();//only to check that all is well defined. mcIdType *begPtr(_conn->getPointer()); - mcIdType const nbElt(_conn->getNumberOfTuples()); + mcIdType nbElt(_conn->getNumberOfTuples()); mcIdType *endPtr(begPtr+nbElt); for(mcIdType *it=begPtr;it!=endPtr;it++) { @@ -53,7 +51,7 @@ void MEDCoupling::MEDCoupling1DGTUMesh::renumberNodesInConnT(const MAPCLS& newNo { getNumberOfCells();//only to check that all is well defined. // - mcIdType const nbOfTuples(_conn->getNumberOfTuples()); + mcIdType nbOfTuples(_conn->getNumberOfTuples()); mcIdType *pt(_conn->getPointer()); for(mcIdType i=0;i -#include -#include -#include -#include + #include #include #include -#include -#include -#include using namespace MEDCoupling; @@ -58,21 +42,21 @@ DataArrayDoubleCollection *DataArrayDoubleCollection::deepCopy() const void DataArrayDoubleCollection::allocTuples(mcIdType nbOfTuples) { - std::size_t const sz(_arrs.size()); + std::size_t sz(_arrs.size()); for(std::size_t i=0;ireAlloc(nbOfTuples); } void DataArrayDoubleCollection::dellocTuples() { - std::size_t const sz(_arrs.size()); + std::size_t sz(_arrs.size()); for(std::size_t i=0;ireAlloc(0); } void DataArrayDoubleCollection::copyFrom(const DataArrayDoubleCollection& other) { - std::size_t const sz(_arrs.size()); + std::size_t sz(_arrs.size()); if(sz!=other._arrs.size()) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::copyFrom : size are not the same !"); for(std::size_t i=0;i >& compNames) { - std::size_t const sz(_arrs.size()); + std::size_t sz(_arrs.size()); if(sz!=compNames.size()) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::spillInfoOnComponents : first size of compNames has to be equal to the number of fields defined !"); for(std::size_t i=0;i& nfs) { - std::size_t const sz(_arrs.size()); + std::size_t sz(_arrs.size()); if(sz!=nfs.size()) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::spillNatures : first size of vector of NatureOfField has to be equal to the number of fields defined !"); for(std::size_t i=0;i& n std::vector< std::pair < std::string, std::vector > > DataArrayDoubleCollection::getInfoOnComponents() const { - std::size_t const sz(_arrs.size()); + std::size_t sz(_arrs.size()); std::vector< std::pair < std::string, std::vector > > ret(sz); for(std::size_t i=0;i > > DataArrayDoub std::vector DataArrayDoubleCollection::getNatures() const { - std::size_t const sz(_arrs.size()); + std::size_t sz(_arrs.size()); std::vector ret(sz); for(std::size_t i=0;i DataArrayDoubleCollection::getNatures() const std::vector DataArrayDoubleCollection::retrieveFields() const { - std::size_t const sz(_arrs.size()); + std::size_t sz(_arrs.size()); std::vector ret(sz); for(std::size_t i=0;i DataArrayDoubleCollection::retrieveFields() const const DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name) const { std::vector vec; - for(const auto & _arr : _arrs) + for(std::vector< std::pair< MCAuto, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) { - const DataArrayDouble *obj(_arr.first); + const DataArrayDouble *obj((*it).first); if(obj) { if(obj->getName()==name) @@ -168,9 +152,9 @@ const DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::st DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name) { std::vector vec; - for(auto & _arr : _arrs) + for(std::vector< std::pair< MCAuto, NatureOfField > >::iterator it=_arrs.begin();it!=_arrs.end();it++) { - DataArrayDouble *obj(_arr.first); + DataArrayDouble *obj((*it).first); if(obj) { if(obj->getName()==name) @@ -207,7 +191,7 @@ void DataArrayDoubleCollection::SynchronizeFineToCoarse(mcIdType ghostLev, const { if(!fine || !coarse) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineToCoarse : the input DataArrayDouble collections must be non NULL !"); - std::size_t const sz(coarse->_arrs.size()); + std::size_t sz(coarse->_arrs.size()); if(fine->_arrs.size()!=sz) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineToCoarse : the input DataArrayDouble collection must have the same size !"); for(std::size_t i=0;i_arrs.size()); + std::size_t sz(coarse->_arrs.size()); if(fine->_arrs.size()!=sz) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFine : the input DataArrayDouble collection must have the same size !"); for(std::size_t i=0;i_arrs.size()); + std::size_t nbOfCall(fieldsOnFine[0]->_arrs.size()); for(std::size_t i=0;igetPatchIdFromChildMesh(children[i])!=ToIdType(i)) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : internal error !"); @@ -263,14 +247,14 @@ void DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(mcIdType ghost { if(!p1 || !p1dac || !p2 || !p2dac) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo : input pointer must be not NULL !"); - std::size_t const sz(p1dac->_arrs.size()); + std::size_t sz(p1dac->_arrs.size()); if(p2dac->_arrs.size()!=sz) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo : size of DataArrayDouble Collection must be the same !"); for(std::size_t i=0;i_arrs[i].first); DataArrayDoubleCollection::CheckSameNatures(p1dac->_arrs[i].second,p2dac->_arrs[i].second); - bool const isConservative(DataArrayDoubleCollection::IsConservativeNature(p1dac->_arrs[i].second)); + bool isConservative(DataArrayDoubleCollection::IsConservativeNature(p1dac->_arrs[i].second)); MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(ghostLev,p1,p2,const_cast(zeArrWhichGhostsWillBeUpdated),p2dac->_arrs[i].first,isConservative); } } @@ -279,7 +263,7 @@ void DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(mcIdType { if(!fine || !coarse) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone : the input DataArrayDouble collections must be non NULL !"); - std::size_t const sz(coarse->_arrs.size()); + std::size_t sz(coarse->_arrs.size()); if(fine->_arrs.size()!=sz) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone : the input DataArrayDouble collection must have the same size !"); for(std::size_t i=0;i(this)); - std::size_t const sz(_arrs.size()); + DataArrayDoubleCollection *thisNC(const_cast(this)); + std::size_t sz(_arrs.size()); if(other._arrs.size()!=sz) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::synchronizeMyGhostZoneUsing : sizes of collections must match !"); for(std::size_t i=0;i(this)); - std::size_t const sz(_arrs.size()); + DataArrayDoubleCollection *thisNC(const_cast(this)); + std::size_t sz(_arrs.size()); if(other._arrs.size()!=sz) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::synchronizeMyGhostZoneUsingExt : sizes of collections must match !"); for(std::size_t i=0;i >& fieldNames):_arrs(fieldNames.size()) { - std::size_t const sz(fieldNames.size()); + std::size_t sz(fieldNames.size()); std::vector names(sz); for(std::size_t i=0;i DataArrayDoubleCollection::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _arr : _arrs) - ret.push_back((const DataArrayDouble *)_arr.first); + for(std::vector< std::pair< MCAuto, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) + ret.push_back((const DataArrayDouble *)(*it).first); return ret; } void DataArrayDoubleCollection::updateTime() const { - for(const auto & _arr : _arrs) + for(std::vector< std::pair< MCAuto, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) { - const DataArrayDouble *pt(_arr.first); + const DataArrayDouble *pt((*it).first); if(pt) updateTimeWith(*pt); } @@ -367,7 +351,7 @@ void DataArrayDoubleCollection::updateTime() const void DataArrayDoubleCollection::CheckDiscriminantNames(const std::vector& names) { - std::set const s(names.begin(),names.end()); + std::set s(names.begin(),names.end()); if(s.size()!=names.size()) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::CheckDiscriminantNames : The names of fields must be different each other ! It is not the case !"); } @@ -404,10 +388,10 @@ MEDCouplingGridCollection *MEDCouplingGridCollection::deepCopy(const MEDCoupling void MEDCouplingGridCollection::alloc(mcIdType ghostLev) { - for(auto & it : _map_of_dadc) + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { - mcIdType const nbTuples(it.first->getNumberOfCellsAtCurrentLevelGhost(ghostLev)); - DataArrayDoubleCollection *dadc(it.second); + mcIdType nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev)); + DataArrayDoubleCollection *dadc((*it).second); if(dadc) dadc->allocTuples(nbTuples); else @@ -417,9 +401,9 @@ void MEDCouplingGridCollection::alloc(mcIdType ghostLev) void MEDCouplingGridCollection::dealloc() { - for(auto & it : _map_of_dadc) + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { - DataArrayDoubleCollection *dadc(it.second); + DataArrayDoubleCollection *dadc((*it).second); if(dadc) dadc->dellocTuples(); else @@ -429,14 +413,14 @@ void MEDCouplingGridCollection::dealloc() void MEDCouplingGridCollection::spillInfoOnComponents(const std::vector< std::vector >& compNames) { - for(auto & it : _map_of_dadc) - it.second->spillInfoOnComponents(compNames); + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + (*it).second->spillInfoOnComponents(compNames); } void MEDCouplingGridCollection::spillNatures(const std::vector& nfs) { - for(auto & it : _map_of_dadc) - it.second->spillNatures(nfs); + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + (*it).second->spillNatures(nfs); } std::vector< std::pair > > MEDCouplingGridCollection::getInfoOnComponents() const @@ -462,7 +446,7 @@ std::vector MEDCouplingGridCollection::getNatures() const bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen *m, mcIdType& pos) const { mcIdType ret(0); - for(auto it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++) + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++) { if((*it).first==m) { @@ -494,30 +478,30 @@ DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(mcIdType pos) */ void MEDCouplingGridCollection::copyOverlappedZoneFrom(mcIdType ghostLev, const MEDCouplingGridCollection& other) { - for(auto & it : _map_of_dadc) + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { std::vector deltaThis,deltaOther; - std::vector< std::pair > const rgThis(it.first->positionRelativeToGodFather(deltaThis)); - std::vector thisSt(it.first->getImageMesh()->getCellGridStructure()); + std::vector< std::pair > rgThis((*it).first->positionRelativeToGodFather(deltaThis)); + std::vector thisSt((*it).first->getImageMesh()->getCellGridStructure()); std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostLev)); - for(const auto & it2 : other._map_of_dadc) + for(std::vector< std::pair > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++) { - std::vector< std::pair > const rgOther(it2.first->positionRelativeToGodFather(deltaOther)); + std::vector< std::pair > rgOther((*it2).first->positionRelativeToGodFather(deltaOther)); if(MEDCouplingStructuredMesh::AreRangesIntersect(rgThis,rgOther)) { - std::vector< std::pair > const isect(MEDCouplingStructuredMesh::IntersectRanges(rgThis,rgOther)); + std::vector< std::pair > isect(MEDCouplingStructuredMesh::IntersectRanges(rgThis,rgOther)); std::vector< std::pair > pThis,pOther; MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(rgThis,isect,pThis,true); MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(rgOther,isect,pOther,true); - std::vector otherSt(it2.first->getImageMesh()->getCellGridStructure()); + std::vector otherSt((*it2).first->getImageMesh()->getCellGridStructure()); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(pThis,ghostLev); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(pOther,ghostLev); std::transform(otherSt.begin(),otherSt.end(),otherSt.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostLev)); - mcIdType const sz(it2.second->size()); + mcIdType sz((*it2).second->size()); for(mcIdType i=0;iat(i)); - DataArrayDouble *thisArr(it.second->at(i)); + const DataArrayDouble *otherArr((*it2).second->at(i)); + DataArrayDouble *thisArr((*it).second->at(i)); MCAuto partOfOther(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(otherSt,otherArr,pOther)); MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(thisSt,thisArr,pThis,partOfOther); } @@ -532,20 +516,20 @@ void MEDCouplingGridCollection::SynchronizeFineToCoarse(mcIdType ghostLev, const throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeFineToCoarse : one or more input pointer is NULL !"); const std::vector< std::pair > >& mf(fine->_map_of_dadc); const std::vector< std::pair > >& mc(coarse->_map_of_dadc); - for(const auto & it : mf) + for(std::vector< std::pair > >::const_iterator it=mf.begin();it!=mf.end();it++) { - const MEDCouplingCartesianAMRMeshGen *fineMesh(it.first); + const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first); const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather()); bool found(false); - for(auto it0=mc.begin();it0!=mc.end() && !found;it0++) + for(std::vector< std::pair > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++) { if((*it0).first==fatherOfFineMesh) { found=true; - mcIdType const patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); + mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); const DataArrayDoubleCollection *coarseDaCol((*it0).second); - auto *coarseModified(const_cast(coarseDaCol));//coarse values in DataArrayDouble will be altered - DataArrayDoubleCollection::SynchronizeFineToCoarse(ghostLev,fatherOfFineMesh,patchId,it.second,coarseModified); + DataArrayDoubleCollection *coarseModified(const_cast(coarseDaCol));//coarse values in DataArrayDouble will be altered + DataArrayDoubleCollection::SynchronizeFineToCoarse(ghostLev,fatherOfFineMesh,patchId,(*it).second,coarseModified); } } if(!found) @@ -559,19 +543,19 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFine(mcIdType ghostLev, const throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFine : one or more input pointer is NULL !"); const std::vector< std::pair > >& mf(fine->_map_of_dadc); const std::vector< std::pair > >& mc(coarse->_map_of_dadc); - for(const auto & it : mf) + for(std::vector< std::pair > >::const_iterator it=mf.begin();it!=mf.end();it++) { - const MEDCouplingCartesianAMRMeshGen *fineMesh(it.first); + const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first); const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather()); bool found(false); - for(auto it0=mc.begin();it0!=mc.end() && !found;it0++) + for(std::vector< std::pair > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++) { if((*it0).first==fatherOfFineMesh) { found=true; - mcIdType const patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); - const DataArrayDoubleCollection *fineDaCol(it.second); - auto *fineModified(const_cast(fineDaCol));//fine values in DataArrayDouble will be altered + mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); + const DataArrayDoubleCollection *fineDaCol((*it).second); + DataArrayDoubleCollection *fineModified(const_cast(fineDaCol));//fine values in DataArrayDouble will be altered DataArrayDoubleCollection::SynchronizeCoarseToFine(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified); } } @@ -587,16 +571,16 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFine(mcIdType ghostLev, const */ void MEDCouplingGridCollection::synchronizeFineEachOther(mcIdType ghostLev, const std::vector< std::pair >& ps) const { - for(const auto & p : ps) + for(std::vector< std::pair >::const_iterator it=ps.begin();it!=ps.end();it++) { mcIdType p1,p2; - if(!presenceOf(p.first->getMesh(),p1)) + if(!presenceOf((*it).first->getMesh(),p1)) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOther : internal error #1 !"); - if(!presenceOf(p.second->getMesh(),p2)) + if(!presenceOf((*it).second->getMesh(),p2)) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOther : internal error #2 !"); const DataArrayDoubleCollection& col1(getFieldsAt(p1)); const DataArrayDoubleCollection& col2(getFieldsAt(p2)); - col1.synchronizeMyGhostZoneUsing(ghostLev,col2,p.first,p.second,p.first->getMesh()->getFather()); + col1.synchronizeMyGhostZoneUsing(ghostLev,col2,(*it).first,(*it).second,(*it).first->getMesh()->getFather()); } } @@ -607,16 +591,16 @@ void MEDCouplingGridCollection::synchronizeFineEachOther(mcIdType ghostLev, cons */ void MEDCouplingGridCollection::synchronizeFineEachOtherExt(mcIdType ghostLev, const std::vector< std::pair >& ps) const { - for(const auto & p : ps) + for(std::vector< std::pair >::const_iterator it=ps.begin();it!=ps.end();it++) { mcIdType p1,p2; - if(!presenceOf(p.first->getMesh(),p1)) + if(!presenceOf((*it).first->getMesh(),p1)) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOtherExt : internal error #1 !"); - if(!presenceOf(p.second->getMesh(),p2)) + if(!presenceOf((*it).second->getMesh(),p2)) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOtherExt : internal error #2 !"); const DataArrayDoubleCollection& col1(getFieldsAt(p1)); const DataArrayDoubleCollection& col2(getFieldsAt(p2)); - col1.synchronizeMyGhostZoneUsingExt(ghostLev,col2,p.first,p.second); + col1.synchronizeMyGhostZoneUsingExt(ghostLev,col2,(*it).first,(*it).second); } } @@ -627,22 +611,22 @@ std::vector< std::pair > ret; std::map > m; - for(const auto & it : _map_of_dadc) + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { - const MEDCouplingCartesianAMRMeshGen *fineMesh(it.first); + const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first); const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather()); m[fatherOfFineMesh].push_back(fineMesh); } for(std::map >::const_iterator it0=m.begin();it0!=m.end();it0++) { - for(auto it1=(*it0).second.begin();it1!=(*it0).second.end();it1++) + for(std::vector::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++) { - mcIdType const patchId((*it0).first->getPatchIdFromChildMesh(*it1)); - std::vector const neighs((*it0).first->getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); + mcIdType patchId((*it0).first->getPatchIdFromChildMesh(*it1)); + std::vector neighs((*it0).first->getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); const MEDCouplingCartesianAMRPatch *pRef((*it0).first->getPatch(patchId)); - for(long const neigh : neighs) + for(std::vector::const_iterator it2=neighs.begin();it2!=neighs.end();it2++) { - const MEDCouplingCartesianAMRPatch *pLoc((*it0).first->getPatch(neigh)); + const MEDCouplingCartesianAMRPatch *pLoc((*it0).first->getPatch(*it2)); ret.push_back(std::pair(pRef,pLoc)); } } @@ -658,19 +642,19 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(mcIdType throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone : one or more input pointer is NULL !"); const std::vector< std::pair > >& mf(fine->_map_of_dadc); const std::vector< std::pair > >& mc(coarse->_map_of_dadc); - for(const auto & it : mf) + for(std::vector< std::pair > >::const_iterator it=mf.begin();it!=mf.end();it++) { - const MEDCouplingCartesianAMRMeshGen *fineMesh(it.first); + const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first); const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather()); bool found(false); - for(auto it0=mc.begin();it0!=mc.end() && !found;it0++) + for(std::vector< std::pair > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++) { if((*it0).first==fatherOfFineMesh) { found=true; - mcIdType const patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); - const DataArrayDoubleCollection *fineDaCol(it.second); - auto *fineModified(const_cast(fineDaCol));//fine values in DataArrayDouble will be altered + mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); + const DataArrayDoubleCollection *fineDaCol((*it).second); + DataArrayDoubleCollection *fineModified(const_cast(fineDaCol));//fine values in DataArrayDouble will be altered DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified); } } @@ -681,12 +665,12 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(mcIdType void MEDCouplingGridCollection::fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector& recurseArrs) const { - for(const auto & it : _map_of_dadc) + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { - const MEDCouplingCartesianAMRMeshGen *a(it.first); + const MEDCouplingCartesianAMRMeshGen *a((*it).first); if(head==a || head->isObjectInTheProgeny(a)) { - const DataArrayDoubleCollection *gc(it.second); + const DataArrayDoubleCollection *gc((*it).second); recurseArrs.push_back(gc->getFieldWithName(fieldName)); } } @@ -694,7 +678,7 @@ void MEDCouplingGridCollection::fillIfInTheProgenyOf(const std::string& fieldNam MEDCouplingGridCollection::MEDCouplingGridCollection(const std::vector& ms, const std::vector< std::pair >& fieldNames):_map_of_dadc(ms.size()) { - std::size_t const sz(ms.size()); + std::size_t sz(ms.size()); for(std::size_t i=0;i const pos(other._map_of_dadc[i].first->getPositionRelativeTo(oldGf)); + std::vector pos(other._map_of_dadc[i].first->getPositionRelativeTo(oldGf)); _map_of_dadc[i].first=newGf->getMeshAtPosition(pos); const DataArrayDoubleCollection *dac(other._map_of_dadc[i].second); if(dac) @@ -727,19 +711,19 @@ std::size_t MEDCouplingGridCollection::getHeapMemorySizeWithoutChildren() const std::vector MEDCouplingGridCollection::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & it : _map_of_dadc) - ret.push_back((const DataArrayDoubleCollection *)it.second); + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + ret.push_back((const DataArrayDoubleCollection *)(*it).second); return ret; } void MEDCouplingGridCollection::updateTime() const { - for(const auto & it : _map_of_dadc) + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { - const MEDCouplingCartesianAMRMeshGen *a(it.first); + const MEDCouplingCartesianAMRMeshGen *a((*it).first); if(a) updateTimeWith(*a); - const DataArrayDoubleCollection *b(it.second); + const DataArrayDoubleCollection *b((*it).second); if(b) updateTimeWith(*b); } @@ -771,7 +755,7 @@ void MEDCouplingDataForGodFather::checkGodFatherFrozen() const bool MEDCouplingDataForGodFather::changeGodFather(MEDCouplingCartesianAMRMesh *gf) { - bool const ret(_tlc.keepTrackOfNewTL(gf)); + bool ret(_tlc.keepTrackOfNewTL(gf)); if(ret) { _gf=gf; @@ -788,7 +772,7 @@ MEDCouplingDataForGodFather::MEDCouplingDataForGodFather(const MEDCouplingDataFo { const MEDCouplingCartesianAMRMesh *gf(other._gf); if(gf) - _gf=gf->deepCopy(nullptr); + _gf=gf->deepCopy(0); _tlc.keepTrackOfNewTL(_gf); } } @@ -803,7 +787,7 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMes MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, mcIdType ghostLev) { - std::size_t const sz(fieldNames.size()); + std::size_t sz(fieldNames.size()); std::vector< std::pair > fieldNames2(sz); std::vector< std::vector > compNames(sz); for(std::size_t i=0;i >& compNames) { _tlc.checkConst(); - for(auto & _lev : _levs) - _lev->spillInfoOnComponents(compNames); + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) + (*it)->spillInfoOnComponents(compNames); } /*! @@ -837,8 +821,8 @@ void MEDCouplingAMRAttribute::spillInfoOnComponents(const std::vector< std::vect void MEDCouplingAMRAttribute::spillNatures(const std::vector& nfs) { _tlc.checkConst(); - for(auto & _lev : _levs) - _lev->spillNatures(nfs); + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) + (*it)->spillNatures(nfs); } MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCopy() const @@ -870,12 +854,12 @@ mcIdType MEDCouplingAMRAttribute::getNumberOfLevels() const */ std::vector MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const { - for(const auto & _lev : _levs) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { mcIdType tmp(-1); - if(_lev->presenceOf(mesh,tmp)) + if((*it)->presenceOf(mesh,tmp)) { - const DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp)); + const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); return ddc.retrieveFields(); } } @@ -887,12 +871,12 @@ std::vector MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCoup */ const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const { - for(const auto & _lev : _levs) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { mcIdType tmp(-1); - if(_lev->presenceOf(mesh,tmp)) + if((*it)->presenceOf(mesh,tmp)) { - const DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp)); + const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); return ddc.getFieldWithName(fieldName); } } @@ -901,12 +885,12 @@ const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianA DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) { - for(auto & _lev : _levs) + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) { mcIdType tmp(-1); - if(_lev->presenceOf(mesh,tmp)) + if((*it)->presenceOf(mesh,tmp)) { - DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp)); + DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); return ddc.getFieldWithName(fieldName); } } @@ -923,7 +907,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutO { std::vector recurseArrs; std::size_t lev(0); - for(auto it=_levs.begin();it!=_levs.end();it++,lev++) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++) { mcIdType tmp(-1); if((*it)->presenceOf(mesh,tmp)) @@ -952,13 +936,13 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutO */ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const { - const DataArrayDouble *arr(nullptr); - for(const auto & _lev : _levs) + const DataArrayDouble *arr(0); + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { mcIdType tmp(-1); - if(_lev->presenceOf(mesh,tmp)) + if((*it)->presenceOf(mesh,tmp)) { - const DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp)); + const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); arr=ddc.getFieldWithName(fieldName); } } @@ -982,26 +966,26 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCo */ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const { - const DataArrayDouble *arr(nullptr); - for(const auto & _lev : _levs) + const DataArrayDouble *arr(0); + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { mcIdType tmp(-1); - if(_lev->presenceOf(mesh,tmp)) + if((*it)->presenceOf(mesh,tmp)) { - const DataArrayDoubleCollection& ddc(_lev->getFieldsAt(tmp)); + const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); arr=ddc.getFieldWithName(fieldName); } } if(!arr) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost : the mesh specified is not in the progeny of this !"); // - MCAuto const im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); + MCAuto im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); MCAuto arr2(DataArrayDouble::New()); arr2->alloc(mesh->getImageMesh()->getNumberOfCells(),arr->getNumberOfComponents()); std::vector< std::pair > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev); - std::vector const fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); + std::vector fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); MEDCouplingIMesh::SpreadCoarseToFine(arr,cgsWG,arr2,cgs2,fakeFactors); arr2->copyStringInfoFrom(*arr); // @@ -1030,7 +1014,7 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons const MEDCouplingIMesh *gfm(gf->getImageMesh()); std::vector orig(gfm->getOrigin()); std::vector spacing(gfm->getDXYZ()); - mcIdType const dim(ToIdType(orig.size())); + mcIdType dim(ToIdType(orig.size())); std::copy(orig.begin(),orig.end(),std::ostream_iterator(ofs," ")); ofs << "\" grid_description=\""; for(mcIdType i=0;i patches(gf->retrieveGridsAt(i)); - std::size_t const sz(patches.size()); + std::size_t sz(patches.size()); std::vector< MCAuto > patchesSafe(sz); for(std::size_t j=0;j::const_iterator it=patches.begin();it!=patches.end();it++,jj++,kk++) { ofs << " (*it)); + const MEDCouplingCartesianAMRPatch *patchCast(dynamic_cast(*it)); const MEDCouplingCartesianAMRMeshGen *mesh((*it)->getMesh()); if(patchCast) { @@ -1084,7 +1068,7 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons { const DataArrayDoubleCollection& ddc(_levs[i]->getFieldsAt(tmp)); std::vector arrs(ddc.retrieveFields()); - std::size_t const nbFields(arrs.size()); + std::size_t nbFields(arrs.size()); std::vector< MCAuto > arrsSafe(nbFields),arrs2Safe(nbFields); std::vector< const MEDCouplingFieldDouble *> fields(nbFields); std::vector< MCAuto > fieldsSafe(nbFields); @@ -1092,13 +1076,13 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons arrsSafe[pp]=arrs[pp]; for(std::size_t pp=0;pp const im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); + MCAuto im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); arrs2Safe[pp]=DataArrayDouble::New(); arrs2Safe[pp]->alloc(mesh->getImageMesh()->getNumberOfCells(),arrs[pp]->getNumberOfComponents()); std::vector< std::pair > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev); - std::vector const fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); + std::vector fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); MEDCouplingIMesh::SpreadCoarseToFine(arrs[pp],cgsWG,arrs2Safe[pp],cgs2,fakeFactors); arrs2Safe[pp]->copyStringInfoFrom(*arrs[pp]); // @@ -1143,11 +1127,11 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::projectTo(MEDCouplingCartesian const MEDCouplingGridCollection *lev0(_levs[0]); if(!lev0) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::projectTo : lev0 is NULL !"); - std::vector< std::pair < std::string, std::vector > > const fieldNames(lev0->getInfoOnComponents()); + std::vector< std::pair < std::string, std::vector > > fieldNames(lev0->getInfoOnComponents()); MCAuto ret(MEDCouplingAMRAttribute::New(targetGF,fieldNames,_ghost_lev)); ret->spillNatures(lev0->getNatures()); ret->alloc(); - mcIdType const nbLevs(getNumberOfLevels()); + mcIdType nbLevs(getNumberOfLevels()); if(targetGF->getMaxNumberOfLevelsRelativeToThis()!=nbLevs) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::projectTo : number of levels of this and targetGF must be the same !"); // first step copy level0 @@ -1203,7 +1187,7 @@ void MEDCouplingAMRAttribute::synchronizeFineToCoarse() */ void MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev) { - mcIdType const nbl(getNumberOfLevels()); + mcIdType nbl(getNumberOfLevels()); if(fromLev<0 || toLev<0 || fromLev>=nbl || toLev>=nbl) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween : fromLev and toLev must be >= 0 and lower than number of levels in this !"); if(fromLev==toLev) @@ -1223,7 +1207,7 @@ void MEDCouplingAMRAttribute::synchronizeCoarseToFine() { if(_levs.empty()) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeCoarseToFine : not any levels in this !"); - std::size_t const sz(_levs.size()); + std::size_t sz(_levs.size()); // for(std::size_t i=0;i=nbl || toLev>=nbl) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeCoarseToFineBetween : fromLev and toLev must be >= 0 and lower than number of levels in this !"); if(fromLev==toLev) @@ -1265,7 +1249,7 @@ void MEDCouplingAMRAttribute::synchronizeCoarseToFineBetween(mcIdType fromLev, m */ void MEDCouplingAMRAttribute::synchronizeAllGhostZones() { - mcIdType const sz(getNumberOfLevels()); + mcIdType sz(getNumberOfLevels()); if(sz==0) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineEachOther : not any levels in this !"); // 1st - synchronize from coarse to the finest all the patches (excepted the god father one) @@ -1283,10 +1267,10 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZones() curLev->synchronizeFineEachOther(_ghost_lev,_neighbors[i]); } // 3rd - mixed level - for(const auto & _mixed_lev_neighbor : _mixed_lev_neighbors) + for(std::vector< std::pair >::const_iterator it=_mixed_lev_neighbors.begin();it!=_mixed_lev_neighbors.end();it++) { - const DataArrayDoubleCollection *firstDAC(&findCollectionAttachedTo(_mixed_lev_neighbor.first->getMesh())),*secondDAC(&findCollectionAttachedTo(_mixed_lev_neighbor.second->getMesh())); - DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(_ghost_lev,_mixed_lev_neighbor.first,firstDAC,_mixed_lev_neighbor.second,secondDAC); + const DataArrayDoubleCollection *firstDAC(&findCollectionAttachedTo((*it).first->getMesh())),*secondDAC(&findCollectionAttachedTo((*it).second->getMesh())); + DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(_ghost_lev,(*it).first,firstDAC,(*it).second,secondDAC); } // 4th - same level but with far ancestor. for(mcIdType i=1;i >& itemsToFilter(_neighbors[level+1]); std::vector< std::pair > itemsToSync; itemsToSync.reserve(itemsToFilter.size()); - for(const auto & it : itemsToFilter) + for(std::vector< std::pair >::const_iterator it=itemsToFilter.begin();it!=itemsToFilter.end();it++) { - if(it.first->getMesh()->getFather()==mesh && it.second->getMesh()->getFather()==mesh) - itemsToSync.push_back(std::pair(it.first,it.second)); + if((*it).first->getMesh()->getFather()==mesh && (*it).second->getMesh()->getFather()==mesh) + itemsToSync.push_back(std::pair((*it).first,(*it).second)); } const MEDCouplingGridCollection *curLev(_levs[level+1]); if(!curLev) @@ -1331,7 +1315,7 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf(const ME */ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level) { - mcIdType const maxLev(getNumberOfLevels()); + mcIdType maxLev(getNumberOfLevels()); if(level<0 || level>=maxLev) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel : the specified level must be in [0,maxLevel) !"); if(level==0) @@ -1353,7 +1337,7 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType */ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level) { - mcIdType const maxLev(getNumberOfLevels()); + mcIdType maxLev(getNumberOfLevels()); if(level<=0 || level>=maxLev) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather : the specified level must be in (0,maxLevel) !"); const MEDCouplingGridCollection *fine(_levs[level]),*coarse(_levs[level-1]); @@ -1369,9 +1353,9 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnly void MEDCouplingAMRAttribute::alloc() { _tlc.resetState(); - for(auto & _lev : _levs) + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) { - MEDCouplingGridCollection *elt(_lev); + MEDCouplingGridCollection *elt(*it); if(elt) elt->alloc(_ghost_lev); else @@ -1386,9 +1370,9 @@ void MEDCouplingAMRAttribute::alloc() void MEDCouplingAMRAttribute::dealloc() { _tlc.checkConst(); - for(auto & _lev : _levs) + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) { - MEDCouplingGridCollection *elt(_lev); + MEDCouplingGridCollection *elt(*it); if(elt) elt->dealloc(); else @@ -1398,7 +1382,7 @@ void MEDCouplingAMRAttribute::dealloc() bool MEDCouplingAMRAttribute::changeGodFather(MEDCouplingCartesianAMRMesh *gf) { - bool const ret(MEDCouplingDataForGodFather::changeGodFather(gf)); + bool ret(MEDCouplingDataForGodFather::changeGodFather(gf)); return ret; } @@ -1412,8 +1396,8 @@ std::size_t MEDCouplingAMRAttribute::getHeapMemorySizeWithoutChildren() const std::vector MEDCouplingAMRAttribute::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _lev : _levs) - ret.push_back((const MEDCouplingGridCollection *)_lev); + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) + ret.push_back((const MEDCouplingGridCollection *)*it); return ret; } @@ -1424,12 +1408,12 @@ void MEDCouplingAMRAttribute::updateTime() const MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, mcIdType ghostLev):MEDCouplingDataForGodFather(gf),_ghost_lev(ghostLev) { //gf non empty, checked by constructor - mcIdType const maxLev(gf->getMaxNumberOfLevelsRelativeToThis()); + mcIdType maxLev(gf->getMaxNumberOfLevelsRelativeToThis()); _levs.resize(maxLev); for(mcIdType i=0;i patches(gf->retrieveGridsAt(i)); - std::size_t const sz(patches.size()); + std::size_t sz(patches.size()); std::vector< MCAuto > patchesSafe(patches.size()); for(std::size_t j=0;j > > neighs2(MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev(_ghost_lev,(*it).first,(*it).second)); - std::size_t const fullLev(i+neighs2.size()); + std::size_t fullLev(i+neighs2.size()); if(fullLev>=sz) throw INTERP_KERNEL::Exception("constructor of MEDCouplingAMRAttribute : internal error ! something is wrong in computation of cross level neighbors !"); std::size_t ii(i+1); @@ -1485,7 +1469,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& for(std::size_t i=0;i >& neigh2(other._neighbors[i]); - std::size_t const sz2(neigh2.size()); + std::size_t sz2(neigh2.size()); std::vector< std::pair >& neigh3(_neighbors[i]); for(std::size_t j=0;j >& neigh2(other._cross_lev_neighbors[i]); - std::size_t const sz2(neigh2.size()); + std::size_t sz2(neigh2.size()); std::vector< std::pair >& neigh3(_cross_lev_neighbors[i]); for(std::size_t j=0;j >::const_iterator it=_levs.begin();it!=_levs.end();it++) { - const MEDCouplingGridCollection *elt(_lev); + const MEDCouplingGridCollection *elt(*it); if(elt) { mcIdType tmp(-1); @@ -1540,7 +1524,7 @@ const DataArrayDoubleCollection& MEDCouplingAMRAttribute::findCollectionAttached void MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel(mcIdType level) { - mcIdType const nbl(getNumberOfLevels()); + mcIdType nbl(getNumberOfLevels()); if(level<=0 || level>=nbl) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel : the input level must be in ]0,nb_of_levels[ !"); const MEDCouplingGridCollection *fine(_levs[level]),*coarse(_levs[level-1]); @@ -1549,7 +1533,7 @@ void MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel(mcIdType level) void MEDCouplingAMRAttribute::synchronizeCoarseToFineByOneLevel(mcIdType level) { - mcIdType const nbl(getNumberOfLevels()); + mcIdType nbl(getNumberOfLevels()); if(level<0 || level>=nbl-1) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel : the input level must be in [0,nb_of_levels[ !"); const MEDCouplingGridCollection *fine(_levs[level+1]),*coarse(_levs[level]); diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx index ec4edf384..416e1ac51 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx @@ -21,17 +21,9 @@ #ifndef __MEDCOUPLINGAMRATTRIBUTE_HXX__ #define __MEDCOUPLINGAMRATTRIBUTE_HXX__ -#include "MCType.hxx" -#include "MCAuto.hxx" #include "MEDCoupling.hxx" #include "MEDCouplingNatureOfFieldEnum" #include "MEDCouplingCartesianAMRMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTimeLabel.hxx" -#include -#include -#include -#include namespace MEDCoupling { @@ -65,9 +57,9 @@ namespace MEDCoupling private: DataArrayDoubleCollection(const std::vector< std::pair >& fieldNames); DataArrayDoubleCollection(const DataArrayDoubleCollection& other); - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; - void updateTime() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; + void updateTime() const; static void CheckDiscriminantNames(const std::vector& names); static bool IsConservativeNature(NatureOfField n); static void CheckSameNatures(NatureOfField n1, NatureOfField n2); @@ -102,9 +94,9 @@ namespace MEDCoupling private: MEDCouplingGridCollection(const std::vector& ms, const std::vector< std::pair >& fieldNames); MEDCouplingGridCollection(const MEDCouplingGridCollection& other, const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf); - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; - void updateTime() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; + void updateTime() const; private: std::vector< std::pair > > _map_of_dadc; }; @@ -160,22 +152,22 @@ namespace MEDCoupling // MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const; // - MEDCOUPLING_EXPORT void synchronizeFineToCoarse() override; - MEDCOUPLING_EXPORT void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev) override; - MEDCOUPLING_EXPORT void synchronizeCoarseToFine() override; - MEDCOUPLING_EXPORT void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev) override; - MEDCOUPLING_EXPORT void synchronizeAllGhostZones() override; - MEDCOUPLING_EXPORT void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh) override; - MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level) override; - MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level) override; + MEDCOUPLING_EXPORT void synchronizeFineToCoarse(); + MEDCOUPLING_EXPORT void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev); + MEDCOUPLING_EXPORT void synchronizeCoarseToFine(); + MEDCOUPLING_EXPORT void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev); + MEDCOUPLING_EXPORT void synchronizeAllGhostZones(); + MEDCOUPLING_EXPORT void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh); + MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level); + MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level); // - MEDCOUPLING_EXPORT void alloc() override; - MEDCOUPLING_EXPORT void dealloc() override; - MEDCOUPLING_EXPORT bool changeGodFather(MEDCouplingCartesianAMRMesh *gf) override; + MEDCOUPLING_EXPORT void alloc(); + MEDCOUPLING_EXPORT void dealloc(); + MEDCOUPLING_EXPORT bool changeGodFather(MEDCouplingCartesianAMRMesh *gf); // - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT void updateTime() const override; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT void updateTime() const; private: MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, mcIdType ghostLev); MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& other, bool deepCpyGF); diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx old mode 100644 new mode 100755 index 02bd41b24..d80b5a36a --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -19,31 +19,20 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingCMesh.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingCurveLinearMesh.hxx" #include "InterpKernelAutoPtr.hxx" -#include "MEDCouplingStructuredMesh.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include #include #include -#include -#include #include -#include -#include -#include +#include using namespace MEDCoupling; -MEDCouplingCMesh::MEDCouplingCMesh():_x_array(nullptr),_y_array(nullptr),_z_array(nullptr) +MEDCouplingCMesh::MEDCouplingCMesh():_x_array(0),_y_array(0),_z_array(0) { } @@ -54,15 +43,15 @@ MEDCouplingCMesh::MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy): if(other._x_array) _x_array=other._x_array->deepCopy(); else - _x_array=nullptr; + _x_array=0; if(other._y_array) _y_array=other._y_array->deepCopy(); else - _y_array=nullptr; + _y_array=0; if(other._z_array) _z_array=other._z_array->deepCopy(); else - _z_array=nullptr; + _z_array=0; } else { @@ -95,7 +84,7 @@ MEDCouplingCMesh *MEDCouplingCMesh::New() MEDCouplingCMesh *MEDCouplingCMesh::New(const std::string& meshName) { - auto *ret(new MEDCouplingCMesh); + MEDCouplingCMesh *ret(new MEDCouplingCMesh); ret->setName(meshName); return ret; } @@ -118,7 +107,7 @@ const DataArrayDouble *MEDCouplingCMesh::getDirectAccessOfCoordsArrIfInStructure MEDCouplingCurveLinearMesh *MEDCouplingCMesh::buildCurveLinear() const { checkConsistencyLight(); - std::size_t const dim(getSpaceDimension()); + std::size_t dim(getSpaceDimension()); MCAuto ret(MEDCouplingCurveLinearMesh::New()); ret->MEDCouplingStructuredMesh::operator=(*this); INTERP_KERNEL::AutoPtr ngs(new mcIdType[dim]); @@ -160,7 +149,7 @@ std::vector MEDCouplingCMesh::getDirectChildrenWithNull void MEDCouplingCMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) { MEDCouplingStructuredMesh::copyTinyStringsFrom(other); - const auto *otherC(dynamic_cast(other)); + const MEDCouplingCMesh *otherC(dynamic_cast(other)); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingCMesh::copyTinyStringsFrom : meshes have not same type !"); if(_x_array && otherC->_x_array) @@ -175,7 +164,7 @@ bool MEDCouplingCMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingCMesh::isEqualIfNotWhy : input other pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCouplingCMesh *otherC=dynamic_cast(other); if(!otherC) { reason="mesh given in input is not castable in MEDCouplingCMesh !"; @@ -188,7 +177,7 @@ bool MEDCouplingCMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec std::ostringstream oss; oss.precision(15); for(int i=0;i<3;i++) { - if((thisArr[i]!=nullptr && otherArr[i]==nullptr) || (thisArr[i]==nullptr && otherArr[i]!=nullptr)) + if((thisArr[i]!=0 && otherArr[i]==0) || (thisArr[i]==0 && otherArr[i]!=0)) { oss << "Only one CMesh between the two this and other has its coordinates of rank" << i << " defined !"; reason=oss.str(); @@ -207,14 +196,14 @@ bool MEDCouplingCMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec bool MEDCouplingCMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingCMesh *otherC=dynamic_cast(other); if(!otherC) return false; const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array}; const DataArrayDouble *otherArr[3]={otherC->_x_array,otherC->_y_array,otherC->_z_array}; for(int i=0;i<3;i++) { - if((thisArr[i]!=nullptr && otherArr[i]==nullptr) || (thisArr[i]==nullptr && otherArr[i]!=nullptr)) + if((thisArr[i]!=0 && otherArr[i]==0) || (thisArr[i]==0 && otherArr[i]!=0)) return false; if(thisArr[i]) if(!thisArr[i]->isEqualWithoutConsideringStr(*otherArr[i],prec)) @@ -223,8 +212,8 @@ bool MEDCouplingCMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other return true; } -void MEDCouplingCMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec, - DataArrayIdType *& /*cellCor*/, DataArrayIdType *& /*nodeCor*/) const +void MEDCouplingCMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalWith : Meshes are not the same !"); @@ -234,8 +223,8 @@ void MEDCouplingCMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int / * Nothing is done here (except to check that the other is a MEDCoupling::MEDCouplingCMesh instance too). * The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingCMesh, \a this and \a other are the same ! */ -void MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec, - DataArrayIdType *& /*cellCor*/) const +void MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayIdType *&cellCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !"); @@ -342,7 +331,7 @@ std::vector MEDCouplingCMesh::getNodeGridStructure() const MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { checkConsistencyLight(); - int const dim(getSpaceDimension()); + int dim(getSpaceDimension()); if(dim!=ToIdType(cellPart.size())) { std::ostringstream oss; oss << "MEDCouplingCMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !"; @@ -369,7 +358,7 @@ int MEDCouplingCMesh::getSpaceDimension() const void MEDCouplingCMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { mcIdType tmp[3]; - int const spaceDim=getSpaceDimension(); + int spaceDim=getSpaceDimension(); getSplitNodeValues(tmp); const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)}; mcIdType tmp2[3]; @@ -385,7 +374,7 @@ std::string MEDCouplingCMesh::simpleRepr() const ret << "Cartesian mesh with name : \"" << getName() << "\"\n"; ret << "Description of mesh : \"" << getDescription() << "\"\n"; int tmpp1,tmpp2; - double const tt=getTime(tmpp1,tmpp2); + double tt=getTime(tmpp1,tmpp2); ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n"; ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; ret << "Space dimension : " << getSpaceDimension() << "\n\nArrays :\n________\n\n"; @@ -545,7 +534,7 @@ void MEDCouplingCMesh::setCoords(const DataArrayDouble *coordsX, const DataArray void MEDCouplingCMesh::getBoundingBox(double *bbox) const { - int const dim=getSpaceDimension(); + int dim=getSpaceDimension(); int j=0; for (int idim=0; idimgetConstPointer(); - mcIdType const nb=ToIdType(c->getNbOfElems()); + mcIdType nb=ToIdType(c->getNbOfElems()); bbox[2*j]=coords[0]; bbox[2*j+1]=coords[nb-1]; j++; @@ -572,11 +561,11 @@ void MEDCouplingCMesh::getBoundingBox(double *bbox) const * and one time . The caller is to delete this field using decrRef() as it is no * more needed. */ -MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool /*isAbs*/) const +MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool isAbs) const { std::string name="MeasureOfMesh_"; name+=getName(); - mcIdType const nbelem=ToIdType(getNumberOfCells()); + mcIdType nbelem=ToIdType(getNumberOfCells()); MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); DataArrayDouble* array=DataArrayDouble::New(); @@ -588,8 +577,8 @@ MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool /*isAbs*/) const field->synchronizeTimeWithMesh(); mcIdType tmp[3]; getSplitCellValues(tmp); - int const dim=getSpaceDimension(); - const auto **thisArr=new const double *[dim]; + int dim=getSpaceDimension(); + const double **thisArr=new const double *[dim]; const DataArrayDouble *thisArr2[3]={_x_array,_y_array,_z_array}; for(int i=0;igetConstPointer(); @@ -608,7 +597,7 @@ MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool /*isAbs*/) const /*! * not implemented yet ! */ -MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureFieldOnNode(bool /*isAbs*/) const +MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureFieldOnNode(bool isAbs) const { throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getMeasureFieldOnNode : not implemented yet !"); //return 0; @@ -616,14 +605,14 @@ MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureFieldOnNode(bool /*isAbs*/) mcIdType MEDCouplingCMesh::getCellContainingPoint(const double *pos, double eps) const { - int const dim=getSpaceDimension(); + int dim=getSpaceDimension(); mcIdType ret=0; mcIdType coeff=1; for(int i=0;igetConstPointer(); - mcIdType const nbOfNodes=getCoordsAt(i)->getNbOfElems(); - double const ref=pos[i]; + mcIdType nbOfNodes=getCoordsAt(i)->getNbOfElems(); + double ref=pos[i]; const double *w=std::find_if(d,d+nbOfNodes,std::bind(std::greater_equal(),std::placeholders::_1,ref)); mcIdType w2=ToIdType(std::distance(d,w)); if(w2& elts) const { - mcIdType const ret(getCellContainingPoint(pos,eps)); + mcIdType ret(getCellContainingPoint(pos,eps)); elts.push_back(ret); } -void MEDCouplingCMesh::rotate(const double * /*center*/, const double * /*vector*/, double /*angle*/) +void MEDCouplingCMesh::rotate(const double *center, const double *vector, double angle) { throw INTERP_KERNEL::Exception("No rotation available on CMesh : Traduce it to untructured mesh to apply it !"); } @@ -688,7 +677,7 @@ void MEDCouplingCMesh::scale(const double *point, double factor) if(c) { double *coords=c->getPointer(); - mcIdType const lgth=ToIdType(c->getNbOfElems()); + mcIdType lgth=ToIdType(c->getNbOfElems()); std::transform(coords,coords+lgth,coords,std::bind(std::minus(),std::placeholders::_1,point[i])); std::transform(coords,coords+lgth,coords,std::bind(std::multiplies(),std::placeholders::_1,factor)); std::transform(coords,coords+lgth,coords,std::bind(std::plus(),std::placeholders::_1,point[i])); @@ -698,10 +687,10 @@ void MEDCouplingCMesh::scale(const double *point, double factor) updateTime(); } -MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh * /*other*/) const +MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh *other) const { //not implemented yet ! - return nullptr; + return 0; } /*! @@ -714,8 +703,8 @@ MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh * /*oth DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const { MCAuto ret(DataArrayDouble::New()); - int const spaceDim(getSpaceDimension()); - mcIdType const nbNodes(getNumberOfNodes()); + int spaceDim(getSpaceDimension()); + mcIdType nbNodes(getNumberOfNodes()); ret->alloc(nbNodes,spaceDim); double *pt(ret->getPointer()); mcIdType tmp[3]; @@ -748,8 +737,8 @@ DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const DataArrayDouble *MEDCouplingCMesh::computeCellCenterOfMass() const { DataArrayDouble *ret=DataArrayDouble::New(); - int const spaceDim=getSpaceDimension(); - mcIdType const nbCells=ToIdType(getNumberOfCells()); + int spaceDim=getSpaceDimension(); + mcIdType nbCells=ToIdType(getNumberOfCells()); ret->alloc(nbCells,spaceDim); double *pt=ret->getPointer(); mcIdType tmp[3]; @@ -758,7 +747,7 @@ DataArrayDouble *MEDCouplingCMesh::computeCellCenterOfMass() const std::vector tabsPtr[3]; for(int j=0;jgetNbOfElems()-1; + mcIdType sz=tabs[j]->getNbOfElems()-1; ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0)); const double *srcPtr=tabs[j]->getConstPointer(); tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz); @@ -780,7 +769,7 @@ DataArrayDouble *MEDCouplingCMesh::computeIsoBarycenterOfNodesPerCell() const return MEDCouplingCMesh::computeCellCenterOfMass(); } -void MEDCouplingCMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*check*/) +void MEDCouplingCMesh::renumberCells(const mcIdType *old2NewBg, bool check) { throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for CMesh !"); } @@ -788,7 +777,7 @@ void MEDCouplingCMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*che void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; - double const time=getTime(it,order); + double time=getTime(it,order); tinyInfo.clear(); tinyInfoD.clear(); littleStrings.clear(); @@ -796,14 +785,14 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tiny littleStrings.push_back(getDescription()); littleStrings.push_back(getTimeUnit()); const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array}; - for(auto & i : thisArr) + for(int i=0;i<3;i++) { mcIdType val=-1; std::string st; - if(i) + if(thisArr[i]) { - val=i->getNumberOfTuples(); - st=i->getInfoOnComponent(0); + val=thisArr[i]->getNumberOfTuples(); + st=thisArr[i]->getInfoOnComponent(0); } tinyInfo.push_back(val); littleStrings.push_back(st); @@ -813,7 +802,7 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tiny tinyInfoD.push_back(time); } -void MEDCouplingCMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& /*littleStrings*/) const +void MEDCouplingCMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { a1->alloc(0,1); mcIdType sum=0; @@ -829,20 +818,20 @@ void MEDCouplingCMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) con a1->alloc(0,1); const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array}; mcIdType sz=0; - for(auto & i : thisArr) + for(int i=0;i<3;i++) { - if(i) - sz+=i->getNumberOfTuples(); + if(thisArr[i]) + sz+=thisArr[i]->getNumberOfTuples(); } a2=DataArrayDouble::New(); a2->alloc(sz,1); double *a2Ptr=a2->getPointer(); - for(auto & i : thisArr) - if(i) - a2Ptr=std::copy(i->getConstPointer(),i->getConstPointer()+i->getNumberOfTuples(),a2Ptr); + for(int i=0;i<3;i++) + if(thisArr[i]) + a2Ptr=std::copy(thisArr[i]->getConstPointer(),thisArr[i]->getConstPointer()+thisArr[i]->getNumberOfTuples(),a2Ptr); } -void MEDCouplingCMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType * /*a1*/, DataArrayDouble *a2, +void MEDCouplingCMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { setName(littleStrings[0]); @@ -868,10 +857,10 @@ void MEDCouplingCMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData { std::ostringstream extent; DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array}; - for(auto & i : thisArr) + for(int i=0;i<3;i++) { - if(i) - { extent << "0 " << i->getNumberOfTuples()-1 << " "; } + if(thisArr[i]) + { extent << "0 " << thisArr[i]->getNumberOfTuples()-1 << " "; } else { extent << "0 0 "; } } @@ -882,10 +871,10 @@ void MEDCouplingCMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData ofs << " \n" << cellData << std::endl; ofs << " \n"; ofs << " \n"; - for(auto & i : thisArr) + for(int i=0;i<3;i++) { - if(i) - i->writeVTK(ofs,8,"Array",byteData); + if(thisArr[i]) + thisArr[i]->writeVTK(ofs,8,"Array",byteData); else { MCAuto coo=DataArrayDouble::New(); coo->alloc(1,1); @@ -907,19 +896,19 @@ void MEDCouplingCMesh::reprQuickOverview(std::ostream& stream) const mcIdType nbOfCells=1,nbOfNodes=1; for(int i=0;i<3;i++) { - isDef[i]=thisArr[i]!=nullptr; + isDef[i]=thisArr[i]!=0; if(isDef[i]) { - char const tmp=(char)((int)('X')+i); + char tmp=(char)((int)('X')+i); stream2[i] << tmp << " positions array "; if(!thisArr[i]->isAllocated()) stream2[i] << "set but not allocated."; else { - std::size_t const nbCompo=thisArr[i]->getNumberOfComponents(); + std::size_t nbCompo=thisArr[i]->getNumberOfComponents(); if(nbCompo==1) { - mcIdType const nbTuples=thisArr[i]->getNumberOfTuples(); + mcIdType nbTuples=thisArr[i]->getNumberOfTuples(); if(nbTuples<1) { stream2[i] << "set and allocated - WARNING number of elements < 1 !"; nbOfCells=-1; nbOfNodes=-1; } else diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index aee43cdb9..6272b3130 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -21,16 +21,8 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGCMESH_HXX__ #define __PARAMEDMEM_MEDCOUPLINGCMESH_HXX__ -#include "MCType.hxx" #include "MEDCoupling.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingStructuredMesh.hxx" -#include -#include -#include -#include -#include namespace MEDCoupling { @@ -42,65 +34,65 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(); MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(const std::string& meshName); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingCMesh"); } - MEDCOUPLING_EXPORT MEDCouplingCMesh *deepCopy() const override; - MEDCOUPLING_EXPORT MEDCouplingCMesh *clone(bool recDeepCpy) const override; - MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override; + MEDCOUPLING_EXPORT MEDCouplingCMesh *deepCopy() const; + MEDCOUPLING_EXPORT MEDCouplingCMesh *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const; MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *buildCurveLinear() const; - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return CARTESIAN; } - MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return CARTESIAN; } + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor) const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override; - MEDCOUPLING_EXPORT int getSpaceDimension() const override; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const override; - MEDCOUPLING_EXPORT std::string simpleRepr() const override; - MEDCOUPLING_EXPORT std::string advancedRepr() const override; + DataArrayIdType *&cellCor) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; + MEDCOUPLING_EXPORT int getSpaceDimension() const; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const; + MEDCOUPLING_EXPORT std::string simpleRepr() const; + MEDCOUPLING_EXPORT std::string advancedRepr() const; MEDCOUPLING_EXPORT const DataArrayDouble *getCoordsAt(int i) const; MEDCOUPLING_EXPORT DataArrayDouble *getCoordsAt(int i); MEDCOUPLING_EXPORT void setCoordsAt(int i, const DataArrayDouble *arr); MEDCOUPLING_EXPORT void setCoords(const DataArrayDouble *coordsX, - const DataArrayDouble *coordsY=nullptr, - const DataArrayDouble *coordsZ=nullptr); + const DataArrayDouble *coordsY=0, + const DataArrayDouble *coordsZ=0); // tools - MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override; - MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const override; - MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override; - MEDCOUPLING_EXPORT void translate(const double *vector) override; - MEDCOUPLING_EXPORT void scale(const double *point, double factor) override; - MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override; - MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override; - MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override; + MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; + MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle); + MEDCOUPLING_EXPORT void translate(const double *vector); + MEDCOUPLING_EXPORT void scale(const double *point, double factor); + MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; + MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); //some useful methods - MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const override; - MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const override; - MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const override; + MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const; + MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const; + MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; //serialisation-unserialization - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, - const std::vector& littleStrings) override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; - MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override; + const std::vector& littleStrings); + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; + MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; private: MEDCouplingCMesh(); MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy); - ~MEDCouplingCMesh() override; - void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override; - std::string getVTKDataSetType() const override; + ~MEDCouplingCMesh(); + void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; + std::string getVTKDataSetType() const; private: DataArrayDouble *_x_array; DataArrayDouble *_y_array; diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx old mode 100644 new mode 100755 index 38ce2a790..36dfdb2ca --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -19,31 +19,15 @@ // Author : Anthony Geay #include "MEDCouplingCartesianAMRMesh.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "BoxSplittingOptions.hxx" #include "MEDCouplingAMRAttribute.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingIMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingStructuredMesh.hxx" #include "MEDCouplingUMesh.hxx" -#include -#include -#include -#include -#include -#include #include -#include #include -#include -#include -#include +#include using namespace MEDCoupling; @@ -178,7 +162,7 @@ bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt(const MEDCouplingCartes const MEDCouplingCartesianAMRMeshGen *com(FindCommonAncestor(this,other,lev));//check that factors are OK if(lev==0) return isInMyNeighborhood(other,ghostLev); - std::vector const offset(ComputeOffsetFromTwoToOne(com,lev,this,other)); + std::vector offset(ComputeOffsetFromTwoToOne(com,lev,this,other)); const std::vector< std::pair >& thisp(getBLTRRange()); std::vector< std::pair > otherp(other->getBLTRRange()); otherp=MEDCouplingStructuredMesh::TranslateCompactFrmt(otherp,offset); @@ -218,7 +202,7 @@ std::vector< std::pair > MEDCouplingCartesianAMRPatch::getBLT if(!fath) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF : not valid 2 !"); std::vector factors(fath->getFactors()); - std::size_t const sz(ret.size()); + std::size_t sz(ret.size()); for(std::size_t ii=0;ii > MEDCouplingCartesianAMRPatch::getBLT fath=oldFather->getFather(); while(fath) { - mcIdType const pos(fath->getPatchIdFromChildMesh(oldFather)); + mcIdType pos(fath->getPatchIdFromChildMesh(oldFather)); const MEDCouplingCartesianAMRPatch *p(fath->getPatch(pos)); const std::vector< std::pair >& tmp(p->getBLTRRange()); const std::vector& factors2(fath->getFactors()); std::transform(factors.begin(),factors.end(),factors2.begin(),factors.begin(),std::multiplies()); for(std::size_t ii=0;ii MEDCouplingCartesianAMRPatch::computeCellGridSt() const bool MEDCouplingCartesianAMRPatch::IsInMyNeighborhood(mcIdType ghostLev, const std::vector< std::pair >& p1, const std::vector< std::pair >& p2) { - std::size_t const thispsize(p1.size()); + std::size_t thispsize(p1.size()); if(thispsize!=p2.size()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhood : the dimensions must be the same !"); for(std::size_t i=0;i > retTmp; std::vector p1Work2,p2Work2; - for(auto it1 : p1Work) + for(std::vector::const_iterator it1=p1Work.begin();it1!=p1Work.end();it1++) { - for(auto it2 : p2Work) + for(std::vector::const_iterator it2=p2Work.begin();it2!=p2Work.end();it2++) { - if(it1->isInMyNeighborhoodExt(it2,ghostLev>0?1:0))//1 not ghostLev ! It is not a bug ( I hope :) ) ! Because as \a this is a refinement of \a other ghostLev is supposed to be <= factors - retTmp.push_back(std::pair(it1,it2)); + if((*it1)->isInMyNeighborhoodExt(*it2,ghostLev>0?1:0))//1 not ghostLev ! It is not a bug ( I hope :) ) ! Because as \a this is a refinement of \a other ghostLev is supposed to be <= factors + retTmp.push_back(std::pair(*it1,*it2)); } - std::vector tmp1(it1->getMesh()->getPatches()); + std::vector tmp1((*it1)->getMesh()->getPatches()); p1Work2.insert(p1Work2.end(),tmp1.begin(),tmp1.end()); } - for(auto it2 : p2Work) + for(std::vector::const_iterator it2=p2Work.begin();it2!=p2Work.end();it2++) { - std::vector tmp2(it2->getMesh()->getPatches()); + std::vector tmp2((*it2)->getMesh()->getPatches()); p2Work2.insert(p2Work2.end(),tmp2.begin(),tmp2.end()); } ret.push_back(retTmp); @@ -334,11 +318,11 @@ void MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf(mcIdType ghostLev while(!p1Work.empty()) { std::vector p1Work2; - for(auto it0 : p1Work) + for(std::vector::const_iterator it0=p1Work.begin();it0!=p1Work.end();it0++) { - if(it0->isInMyNeighborhoodDiffLev(p2,ghostLev)) - ret.push_back(std::pair(it0,p2)); - std::vector tmp2(it0->getMesh()->getPatches()); + if((*it0)->isInMyNeighborhoodDiffLev(p2,ghostLev)) + ret.push_back(std::pair(*it0,p2)); + std::vector tmp2((*it0)->getMesh()->getPatches()); p1Work2.insert(p1Work2.end(),tmp2.begin(),tmp2.end()); } p1Work=p1Work2; @@ -368,7 +352,7 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoExt(mcIdType ghost std::vector< std::pair > p2BLTR(p2->getBLTRRange());//p2BLTR=[(0,1),(0,5)] mcIdType lev(0); const MEDCouplingCartesianAMRMeshGen *ca(FindCommonAncestor(p1,p2,lev)); - std::vector const offset(ComputeOffsetFromTwoToOne(ca,lev,p1,p2));//[12,4] + std::vector offset(ComputeOffsetFromTwoToOne(ca,lev,p1,p2));//[12,4] p2BLTR=MEDCouplingStructuredMesh::TranslateCompactFrmt(p2BLTR,offset);//p2BLTR=[(12,13),(4,9)] UpdateNeighborsOfOneWithTwoInternal(ghostLev,p1->getMesh()->getFather()->getFactors(),p1BLTR,p2BLTR,dataOnP1,dataOnP2); } @@ -385,14 +369,14 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(mcIdType std::vector dimsP2NotRefined(p2->computeCellGridSt()); std::vector dimsP2Refined(dimsP2NotRefined); std::transform(dimsP2NotRefined.begin(),dimsP2NotRefined.end(),factors.begin(),dimsP2Refined.begin(),std::multiplies()); - std::vector< std::pair > const p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined)); + std::vector< std::pair > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined)); std::vector dimsP2RefinedGhost(dimsP2Refined.size()); std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostLev)); MCAuto fineP2(DataArrayDouble::New()); fineP2->alloc(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(dimsP2RefinedGhost),dataOnP2->getNumberOfComponents()); MEDCouplingIMesh::SpreadCoarseToFineGhost(dataOnP2,dimsP2NotRefined,fineP2,p2RefinedAbs,factors,ghostLev); if(isConservative) { - mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(factors)); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(factors)); std::transform(fineP2->begin(),fineP2->end(),fineP2->getPointer(),std::bind(std::multiplies(),std::placeholders::_1,1./((double)fact))); } // @@ -404,10 +388,10 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(mcIdType * This method has 3 outputs. 2 two first are the resp the position of \a p1 and \a p2 relative to \a p1. And \a factToApplyOn2 is the coeff of refinement to be applied on \a p2 to be virtually * on the same level as \a p1. */ -void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType /*ghostLev*/, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& p1Zone, std::vector< std::pair >& p2Zone, std::vector& factToApplyOn2) +void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& p1Zone, std::vector< std::pair >& p2Zone, std::vector& factToApplyOn2) { std::vector ancestorsOfThis; - const MEDCouplingCartesianAMRMeshGen *work(p1->getMesh()),*work2(nullptr); + const MEDCouplingCartesianAMRMeshGen *work(p1->getMesh()),*work2(0); ancestorsOfThis.push_back(work); while(work) { @@ -426,7 +410,7 @@ void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(mcIdTyp if(work) { levOther++; - auto const it(std::find(ancestorsOfThis.begin(),ancestorsOfThis.end(),work)); + std::vector::iterator it(std::find(ancestorsOfThis.begin(),ancestorsOfThis.end(),work)); if(it!=ancestorsOfThis.end()) { levThis=std::distance(ancestorsOfThis.begin(),it); @@ -442,11 +426,11 @@ void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(mcIdTyp const MEDCouplingCartesianAMRMeshGen *comAncestor(ancestorsOfThis[levThis]); mcIdType idThis(comAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-1])),idOther(comAncestor->getPatchIdFromChildMesh(work2)); const MEDCouplingCartesianAMRPatch *thisp(comAncestor->getPatch(idThis)),*otherp(comAncestor->getPatch(idOther)); - std::vector const offset(ComputeOffsetFromTwoToOne(comAncestor,ToIdType(levOther),thisp,otherp)); + std::vector offset(ComputeOffsetFromTwoToOne(comAncestor,ToIdType(levOther),thisp,otherp)); p1Zone=thisp->getBLTRRange(); p2Zone=MEDCouplingStructuredMesh::TranslateCompactFrmt(otherp->getBLTRRange(),offset); factToApplyOn2.resize(p1Zone.size()); std::fill(factToApplyOn2.begin(),factToApplyOn2.end(),1); // - std::size_t const nbOfTurn(levThis-levOther); + std::size_t nbOfTurn(levThis-levOther); for(std::size_t i=0;i > tmp0; @@ -457,7 +441,7 @@ void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(mcIdTyp curAncestor=ancestorsOfThis[levThis-1-i]; const std::vector& factors(curAncestor->getFactors()); std::transform(factToApplyOn2.begin(),factToApplyOn2.end(),factors.begin(),factToApplyOn2.begin(),std::multiplies()); - mcIdType const tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i])); + mcIdType tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i])); p1Zone=curAncestor->getPatch(tmpId)->getBLTRRange(); } } @@ -473,7 +457,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatch::FindCommonAn { const MEDCouplingCartesianAMRMeshGen *f1(p1->_mesh),*f2(p2->_mesh); lev=0; - while(f1!=f2 || f1==nullptr || f2==nullptr) + while(f1!=f2 || f1==0 || f2==0) { f1=f1->getFather(); f2=f2->getFather(); if(f1->getFactors()!=f2->getFactors()) @@ -485,19 +469,19 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatch::FindCommonAn return f1; } -std::vector MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen * /*comAncestor*/, mcIdType lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2) +std::vector MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, mcIdType lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2) { if(lev<=0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne : this method is useful only for lev > 0 !"); - mcIdType const zeLev(lev-1); - mcIdType const dim(p1->getMesh()->getSpaceDimension()); + mcIdType zeLev(lev-1); + mcIdType dim(p1->getMesh()->getSpaceDimension()); if(p2->getMesh()->getSpaceDimension()!=dim) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne : dimension must be the same !"); std::vector< mcIdType > ret(dim,0); for(mcIdType i=0;i_mesh),*f2(p2->_mesh); - const MEDCouplingCartesianAMRPatch *p1h(nullptr),*p2h(nullptr); + const MEDCouplingCartesianAMRPatch *p1h(0),*p2h(0); for(mcIdType j=0;jgetFather()),*f2tmp(f2->getFather()); @@ -522,18 +506,18 @@ std::vector MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(co void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoInternal(mcIdType ghostLev, const std::vector& factors, const std::vector< std::pair >&p1 ,const std::vector< std::pair >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) {//p1=[(1,4),(2,4)] p2=[(4,5),(3,4)] - mcIdType const dim(ToIdType(factors.size())); + mcIdType dim(ToIdType(factors.size())); std::vector dimsCoarse(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(p1));//[3,2] std::transform(dimsCoarse.begin(),dimsCoarse.end(),factors.begin(),dimsCoarse.begin(),std::multiplies());//[12,8] std::transform(dimsCoarse.begin(),dimsCoarse.end(),dimsCoarse.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostLev));//[14,10] - std::vector< std::pair > const rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)] - std::vector const fakeFactors(dim,1); + std::vector< std::pair > rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)] + std::vector fakeFactors(dim,1); // std::vector< std::pair > tmp0,tmp1,tmp2; MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(p1,p2,tmp0,false);//tmp0=[(3,4),(1,2)] ApplyFactorsOnCompactFrmt(tmp0,factors);//tmp0=[(12,16),(4,8)] MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(tmp0,ghostLev);//tmp0=[(13,17),(5,9)] - std::vector< std::pair > const interstRange(MEDCouplingStructuredMesh::IntersectRanges(tmp0,rangeCoarse));//interstRange=[(13,14),(5,9)] + std::vector< std::pair > interstRange(MEDCouplingStructuredMesh::IntersectRanges(tmp0,rangeCoarse));//interstRange=[(13,14),(5,9)] MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(p2,p1,tmp1,false);//tmp1=[(-3,0),(-1,1)] ApplyFactorsOnCompactFrmt(tmp1,factors);//tmp1=[(-12,-4),(-4,0)] MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(tmp1,interstRange,tmp2,false);//tmp2=[(1,2),(1,5)] @@ -556,7 +540,7 @@ MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(const MEDCouplingCart */ void MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt(std::vector< std::pair >& partBeforeFact, const std::vector& factors) { - std::size_t const sz(factors.size()); + std::size_t sz(factors.size()); if(sz!=partBeforeFact.size()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt : size of input vectors must be the same !"); for(std::size_t i=0;i= 0 !"); - std::size_t const sz(partBeforeFact.size()); + std::size_t sz(partBeforeFact.size()); for(std::size_t i=0;i& new mcIdType MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const { mcIdType ret(1); - for(const auto & _patche : _patches) - ret=std::max(ret,_patche->getMaxNumberOfLevelsRelativeToThis()+1); + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) + ret=std::max(ret,(*it)->getMaxNumberOfLevelsRelativeToThis()+1); return ret; } @@ -664,9 +648,9 @@ mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(mcI mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const { mcIdType ret=_mesh->getNumberOfCells(); - for(const auto & _patche : _patches) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { - ret+=_patche->getNumberOfCellsRecursiveWithOverlap(); + ret+=(*it)->getNumberOfCellsRecursiveWithOverlap(); } return ret; } @@ -681,10 +665,10 @@ mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const { mcIdType ret=_mesh->getNumberOfCells(); - for(const auto & _patche : _patches) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { - ret-=_patche->getNumberOfOverlapedCellsForFather(); - ret+=_patche->getNumberOfCellsRecursiveWithoutOverlap(); + ret-=(*it)->getNumberOfOverlapedCellsForFather(); + ret+=(*it)->getNumberOfCellsRecursiveWithoutOverlap(); } return ret; } @@ -710,25 +694,25 @@ std::vector MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(cons */ const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatchAtPosition(const std::vector& pos) const { - std::size_t const sz(pos.size()); + std::size_t sz(pos.size()); if(sz==0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : empty input -> no patch by definition !"); - mcIdType const patchId(pos[0]); + mcIdType patchId(pos[0]); const MEDCouplingCartesianAMRPatch *elt(getPatch(patchId)); if(sz==1) return elt; if(!elt || !elt->getMesh()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !"); - std::vector const pos2(pos.begin()+1,pos.end()); + std::vector pos2(pos.begin()+1,pos.end()); return elt->getMesh()->getPatchAtPosition(pos2); } const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtPosition(const std::vector& pos) const { - std::size_t const sz(pos.size()); + std::size_t sz(pos.size()); if(sz==0) return this; - mcIdType const patchId(pos[0]); + mcIdType patchId(pos[0]); const MEDCouplingCartesianAMRPatch *elt(getPatch(patchId)); if(sz==1) { @@ -738,7 +722,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtP } if(!elt || !elt->getMesh()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !"); - std::vector const pos2(pos.begin()+1,pos.end()); + std::vector pos2(pos.begin()+1,pos.end()); return elt->getMesh()->getMeshAtPosition(pos2); } @@ -765,7 +749,7 @@ void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair mesh(static_cast(_mesh->buildStructuredSubPart(bottomLeftTopRight))); mesh->refineWithFactor(factors); MCAuto zeMesh(new MEDCouplingCartesianAMRMeshSub(this,mesh)); - MCAuto const elt(new MEDCouplingCartesianAMRPatch(zeMesh,bottomLeftTopRight)); + MCAuto elt(new MEDCouplingCartesianAMRPatch(zeMesh,bottomLeftTopRight)); _patches.push_back(elt); declareAsNew(); } @@ -775,7 +759,7 @@ void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair extractPart(const std::vector< std::pair >&partInGlobal) const; MCAuto deepCopy() const; protected: - ~InternalPatch() override = default; + ~InternalPatch() { } private: - mutable mcIdType _nb_of_true{0}; + mutable mcIdType _nb_of_true; std::vector _crit; //! _part is global std::vector< std::pair > _part; @@ -804,10 +788,10 @@ private: void InternalPatch::zipToFitOnCriterion(mcIdType minPatchLgth) { - std::vector const cgs(computeCGS()); + std::vector cgs(computeCGS()); std::vector newCrit; std::vector< std::pair > newPart,newPart2; - mcIdType const newNbOfTrue(MEDCouplingStructuredMesh::FindMinimalPartOf(minPatchLgth,cgs,_crit,newCrit,newPart)); + mcIdType newNbOfTrue(MEDCouplingStructuredMesh::FindMinimalPartOf(minPatchLgth,cgs,_crit,newCrit,newPart)); MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(_part,newPart,newPart2); if(newNbOfTrue!=_nb_of_true) throw INTERP_KERNEL::Exception("InternalPatch::zipToFitOnCrit : internal error !"); @@ -822,7 +806,7 @@ void InternalPatch::updateNumberOfTrue() const MCAuto InternalPatch::extractPart(const std::vector< std::pair >&partInGlobal) const { MCAuto ret(new InternalPatch); - std::vector const cgs(computeCGS()); + std::vector cgs(computeCGS()); std::vector< std::pair > newPart; MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(_part,partInGlobal,newPart); MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(cgs,_crit,newPart,ret->getCriterion()); @@ -840,7 +824,7 @@ MCAuto InternalPatch::deepCopy() const void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType largestLength, mcIdType& cutPlace) { - mcIdType const minimumPatchLength(bso.getMinimumPatchLength()); + mcIdType minimumPatchLength(bso.getMinimumPatchLength()); std::vector ratio(largestLength-minimumPatchLength,std::numeric_limits::max()); mcIdType index_min = -1; double minSemiEfficiencyRatio(std::numeric_limits::max()); @@ -876,15 +860,15 @@ void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const Intern bool FindHole(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType& cutPlace) { cutPlace=-1; - mcIdType const minimumPatchLength(bso.getMinimumPatchLength()); + mcIdType minimumPatchLength(bso.getMinimumPatchLength()); const mcIdType dim(patchToBeSplit->getDimension()); std::vector< std::vector > signatures(patchToBeSplit->computeSignature()); for(mcIdType id=0;id& signature(signatures[id]); std::vector hole; - std::vector const distance; - mcIdType const len(ToIdType(signature.size())); + std::vector distance; + mcIdType len(ToIdType(signature.size())); for(mcIdType i=minimumPatchLength-1;igetConstPart()[axisId].first; @@ -951,18 +935,18 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna } if ( zero_cross.size() > 0 ) { - mcIdType const max_cross=*max_element(edge.begin(),edge.end()) ; + mcIdType max_cross=*max_element(edge.begin(),edge.end()) ; for (std::size_t i=0;i(signature.size())/2.0); - for (long const i : max_cross_list) - distance.push_back(fabs(FromIdType(i)+1-center)); + double center(static_cast(signature.size())/2.0); + for (std::size_t i=0;i(max_cross_list[i])+1-center)); - double const distance_min=*min_element(distance.begin(),distance.end()) ; - mcIdType const pos_distance_min=ToIdType(find(distance.begin(),distance.end(),distance_min)-distance.begin()); - mcIdType const best_place = max_cross_list[pos_distance_min] + part[id].first ; + double distance_min=*min_element(distance.begin(),distance.end()) ; + mcIdType pos_distance_min=ToIdType(find(distance.begin(),distance.end(),distance_min)-distance.begin()); + mcIdType best_place = max_cross_list[pos_distance_min] + part[id].first ; if ( max_cross >=0 ) { zeroCrossDims[id] = best_place ; @@ -983,8 +967,8 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna if (zeroCrossVals[0]==max_cross_dims && zeroCrossVals[1]==max_cross_dims ) { - mcIdType const nl_left(part[0].second-part[0].first); - mcIdType const nc_left(part[1].second-part[1].first); + mcIdType nl_left(part[0].second-part[0].first); + mcIdType nc_left(part[1].second-part[1].first); if ( nl_left >= nc_left ) max_cross_dims = 0 ; else @@ -1032,7 +1016,7 @@ MCAuto DealWithNoCut(const InternalPatch *patch) void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, mcIdType cutPlace, std::vector >& listOfPatches) { MCAuto leftPart,rightPart; - std::vector< std::pair > const rect(patchToBeSplit->getConstPart()); + std::vector< std::pair > rect(patchToBeSplit->getConstPart()); std::vector< std::pair > leftRect(rect),rightRect(rect); leftRect[axisId].second=cutPlace+1; rightRect[axisId].first=cutPlace+1; @@ -1088,11 +1072,11 @@ mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfPatches() const */ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector& criterion, const std::vector& factors) { - mcIdType const nbCells(getNumberOfCellsAtCurrentLevel()); + mcIdType nbCells(getNumberOfCellsAtCurrentLevel()); if(nbCells!=ToIdType(criterion.size())) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : the number of tuples of criterion array must be equal to the number of cells at the current level !"); _patches.clear(); - std::vector const cgs(_mesh->getCellGridStructure()); + std::vector cgs(_mesh->getCellGridStructure()); std::vector< MCAuto > listOfPatches,listOfPatchesOK; // MCAuto p(new InternalPatch); @@ -1102,31 +1086,31 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER while(!listOfPatches.empty()) { std::vector< MCAuto > listOfPatchesTmp; - for(auto & listOfPatche : listOfPatches) + for(std::vector< MCAuto >::iterator it=listOfPatches.begin();it!=listOfPatches.end();it++) { // int axisId; mcIdType largestLength,cutPlace; - MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt(listOfPatche->getConstPart(),axisId,largestLength); - if(listOfPatche->getEfficiency()>=bso.getEfficiencyThreshold() && (listOfPatche->getNumberOfCells()>bso.getMaximumNbOfCellsInPatch() || largestLength>bso.getMaximumPatchLength())) + MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt((*it)->getConstPart(),axisId,largestLength); + if((*it)->getEfficiency()>=bso.getEfficiencyThreshold() && ((*it)->getNumberOfCells()>bso.getMaximumNbOfCellsInPatch() || largestLength>bso.getMaximumPatchLength())) { - DissectBigPatch(bso,listOfPatche,axisId,largestLength,cutPlace); - DealWithCut(bso.getMinimumPatchLength(),listOfPatche,axisId,cutPlace,listOfPatchesTmp); + DissectBigPatch(bso,*it,axisId,largestLength,cutPlace); + DealWithCut(bso.getMinimumPatchLength(),*it,axisId,cutPlace,listOfPatchesTmp); continue; }//action 1 - if(FindHole(bso,listOfPatche,axisId,cutPlace))//axisId overwritten here if FindHole equal to true ! - { DealWithCut(bso.getMinimumPatchLength(),listOfPatche,axisId,cutPlace,listOfPatchesTmp); continue; }//action 2 - if(FindInflection(bso,listOfPatche,cutPlace,axisId))//axisId overwritten here if cutFound equal to true ! - { DealWithCut(bso.getMinimumPatchLength(),listOfPatche,axisId,cutPlace,listOfPatchesTmp); continue; }//action 3 - if(TryAction4(bso,listOfPatche,axisId,largestLength,cutPlace)) - { DealWithCut(bso.getMinimumPatchLength(),listOfPatche,axisId,cutPlace,listOfPatchesTmp); continue; }//action 4 + if(FindHole(bso,*it,axisId,cutPlace))//axisId overwritten here if FindHole equal to true ! + { DealWithCut(bso.getMinimumPatchLength(),*it,axisId,cutPlace,listOfPatchesTmp); continue; }//action 2 + if(FindInflection(bso,*it,cutPlace,axisId))//axisId overwritten here if cutFound equal to true ! + { DealWithCut(bso.getMinimumPatchLength(),*it,axisId,cutPlace,listOfPatchesTmp); continue; }//action 3 + if(TryAction4(bso,*it,axisId,largestLength,cutPlace)) + { DealWithCut(bso.getMinimumPatchLength(),*it,axisId,cutPlace,listOfPatchesTmp); continue; }//action 4 else - listOfPatchesOK.push_back(DealWithNoCut(listOfPatche)); + listOfPatchesOK.push_back(DealWithNoCut(*it)); } listOfPatches=listOfPatchesTmp; } - for(const auto & it : listOfPatchesOK) - addPatch(it->getConstPart(),factors); + for(std::vector< MCAuto >::const_iterator it=listOfPatchesOK.begin();it!=listOfPatchesOK.end();it++) + addPatch((*it)->getConstPart(),factors); declareAsNew(); } @@ -1138,7 +1122,7 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER { if(!criterion || !criterion->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : the criterion DataArrayByte instance must be allocated and not NULL !"); - std::vector const crit(criterion->toVectorOfBool());//check that criterion has one component. + std::vector crit(criterion->toVectorOfBool());//check that criterion has one component. createPatchesFromCriterion(bso,crit,factors); declareAsNew(); } @@ -1147,14 +1131,14 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER { if(!criterion) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : null criterion pointer !"); - std::vector const inp(criterion->toVectorOfBool(eps)); + std::vector inp(criterion->toVectorOfBool(eps)); createPatchesFromCriterion(bso,inp,factors); } mcIdType MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const { mcIdType ret(0); - for(auto it=_patches.begin();it!=_patches.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ret++) { if((*it)->getMesh()==mesh) return ret; @@ -1164,7 +1148,7 @@ mcIdType MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCoupli std::vector< const MEDCouplingCartesianAMRPatch *> MEDCouplingCartesianAMRMeshGen::getPatches() const { - std::size_t const sz(_patches.size()); + std::size_t sz(_patches.size()); std::vector< const MEDCouplingCartesianAMRPatch *> ret(sz); for(std::size_t i=0;igetCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors()); if(isConservative) { - mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind(std::multiplies(),std::placeholders::_1,1./((double)fact))); } } @@ -1254,7 +1238,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(mcIdType patchId, MEDCouplingIMesh::SpreadCoarseToFineGhost(cellFieldOnThis,_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),ghostLev); if(isConservative) { - mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind(std::multiplies(),std::placeholders::_1,1./((double)fact))); } } @@ -1289,13 +1273,13 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZone(mcIdTyp */ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, const std::vector& arrsOnPatches, bool isConservative) const { - mcIdType const nbp(getNumberOfPatches()); + mcIdType nbp(getNumberOfPatches()); if(nbp!=ToIdType(arrsOnPatches.size())) { std::ostringstream oss; oss << "MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchGhostAdv : there are " << nbp << " patches in this and " << arrsOnPatches.size() << " arrays in the last parameter !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - auto *theFieldToFill(const_cast(arrsOnPatches[patchId])); + DataArrayDouble *theFieldToFill(const_cast(arrsOnPatches[patchId])); // first, do as usual fillCellFieldOnPatchGhost(patchId,cellFieldOnThis,theFieldToFill,ghostLev,isConservative); fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches); @@ -1309,19 +1293,19 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(mcIdType patch */ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, const std::vector& arrsOnPatches) const { - mcIdType const nbp(getNumberOfPatches()); + mcIdType nbp(getNumberOfPatches()); if(nbp!=ToIdType(arrsOnPatches.size())) { std::ostringstream oss; oss << "MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchOnlyGhostAdv : there are " << nbp << " patches in this and " << arrsOnPatches.size() << " arrays in the last parameter !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } const MEDCouplingCartesianAMRPatch *refP(getPatch(patchId)); - auto *theFieldToFill(const_cast(arrsOnPatches[patchId])); - std::vector const ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); - for(long const id : ids) + DataArrayDouble *theFieldToFill(const_cast(arrsOnPatches[patchId])); + std::vector ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); + for(std::vector::const_iterator it=ids.begin();it!=ids.end();it++) { - const MEDCouplingCartesianAMRPatch *otherP(getPatch(id)); - MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(ghostLev,_factors,refP,otherP,theFieldToFill,arrsOnPatches[id]); + const MEDCouplingCartesianAMRPatch *otherP(getPatch(*it)); + MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(ghostLev,_factors,refP,otherP,theFieldToFill,arrsOnPatches[*it]); } } @@ -1350,7 +1334,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatch(mcIdType patch MEDCouplingIMesh::CondenseFineToCoarse(_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),cellFieldOnThis); if(!isConservative) { - mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); MEDCouplingStructuredMesh::MultiplyPartOf(_mesh->getCellGridStructure(),patch->getBLTRRange(),1./((double)fact),cellFieldOnThis); } } @@ -1377,7 +1361,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(mcIdType MEDCouplingIMesh::CondenseFineToCoarseGhost(_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),cellFieldOnThis,ghostLev); if(!isConservative) { - mcIdType const fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); MEDCouplingStructuredMesh::MultiplyPartOfByGhost(_mesh->getCellGridStructure(),patch->getBLTRRange(),ghostLev,1./((double)fact),cellFieldOnThis); } } @@ -1392,7 +1376,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(mcIdType */ DataArrayIdType *MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const { - mcIdType const nbp(getNumberOfPatches()); + mcIdType nbp(getNumberOfPatches()); MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); for(mcIdType i=0;i part(_mesh->buildUnstructured()); std::vector bs(_mesh->getNumberOfCells(),false); - std::vector const cgs(_mesh->getCellGridStructure()); + std::vector cgs(_mesh->getCellGridStructure()); std::vector< MCAuto > msSafe(_patches.size()+1); std::size_t ii(0); - for(auto it=_patches.begin();it!=_patches.end();it++,ii++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) { MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs); msSafe[ii+1]=(*it)->getMesh()->buildUnstructured(); @@ -1433,12 +1417,12 @@ MEDCoupling1SGTUMesh *MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop( { std::vector cells; std::vector< MCAuto > cellsSafe; - for(const auto & _patche : _patches) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { - const MEDCouplingCartesianAMRPatch *patch(_patche); + const MEDCouplingCartesianAMRPatch *patch(*it); if(patch) { - MCAuto const cell(patch->getMesh()->getImageMesh()->asSingleCell()); + MCAuto cell(patch->getMesh()->getImageMesh()->asSingleCell()); MCAuto cell1SGT(cell->build1SGTUnstructured()); cellsSafe.push_back(cell1SGT); cells.push_back(cell1SGT); } @@ -1450,9 +1434,9 @@ MEDCoupling1SGTUMesh *MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenO { std::vector patches; std::vector< MCAuto > patchesSafe; - for(const auto & _patche : _patches) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { - const MEDCouplingCartesianAMRPatch *patch(_patche); + const MEDCouplingCartesianAMRPatch *patch(*it); if(patch) { MCAuto patchMesh(patch->getMesh()->getImageMesh()->build1SGTUnstructured()); @@ -1473,13 +1457,13 @@ MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseW throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost : array is empty ! Should never happen !"); // std::vector bs(_mesh->getNumberOfCells(),false); - std::vector const cgs(_mesh->getCellGridStructure()); + std::vector cgs(_mesh->getCellGridStructure()); std::vector< MCAuto > msSafe(_patches.size()+1); std::size_t ii(0); - for(auto it=_patches.begin();it!=_patches.end();it++,ii++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) { MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs); - std::vector const tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs)); + std::vector tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs)); msSafe[ii+1]=(*it)->getMesh()->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,tmpArrs); } MCAuto eltsOff(DataArrayIdType::BuildListOfSwitchedOff(bs)); @@ -1523,7 +1507,7 @@ DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(mcIdType ghost std::vector MEDCouplingCartesianAMRMeshGen::getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const { std::vector ret; - mcIdType const nbp(getNumberOfPatches()); + mcIdType nbp(getNumberOfPatches()); // for(mcIdType i=0;i(mesh->deepCopy()); - std::size_t const sz(other._patches.size()); + std::size_t sz(other._patches.size()); for(std::size_t i=0;i=sz) { std::ostringstream oss; oss << "MEDCouplingCartesianAMRMeshGen::checkPatchId : invalid patchId (" << patchId << ") ! Must be in [0," << sz << ") !"; @@ -1612,27 +1596,27 @@ void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(mcIdType lev, std:: { if(lev==0) { - const auto *thisc(dynamic_cast(this));//tony + const MEDCouplingCartesianAMRMesh *thisc(dynamic_cast(this));//tony MCAuto elt(new MEDCouplingCartesianAMRPatchGF(const_cast(thisc))); grids.push_back(DynamicCastSafe(elt)); } else if(lev==1) { - for(const auto & _patche : _patches) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { - const MEDCouplingCartesianAMRPatch *pt(_patche); + const MEDCouplingCartesianAMRPatch *pt(*it); if(pt) { - MCAuto tmp1(_patche); + MCAuto tmp1(*it); grids.push_back(DynamicCastSafe(tmp1)); } } } else { - for(const auto & _patche : _patches) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { - const MEDCouplingCartesianAMRPatch *pt(_patche); + const MEDCouplingCartesianAMRPatch *pt(*it); if(pt) pt->getMesh()->retrieveGridsAtInternal(lev-1,grids); } @@ -1651,8 +1635,8 @@ mcIdType MEDCouplingCartesianAMRMeshGen::GetGhostLevelInFineRef(mcIdType ghostLe else { ghostLevInPatchRef=(ghostLev-1)/factors[0]+1; - for(long const factor : factors) - ghostLevInPatchRef=std::max(ghostLevInPatchRef,(ghostLev-1)/factor+1); + for(std::size_t i=0;i MEDCouplingCartesianAMRMeshGen::extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector& all) const { - mcIdType const maxLev(getMaxNumberOfLevelsRelativeToThis()); + mcIdType maxLev(getMaxNumberOfLevelsRelativeToThis()); std::vector ret; std::vector meshes(1,this); std::size_t kk(0); for(mcIdType i=0;i meshesTmp; - for(auto meshe : meshes) + for(std::vector::const_iterator it=meshes.begin();it!=meshes.end();it++) { - if(meshe==head || head->isObjectInTheProgeny(meshe)) + if((*it)==head || head->isObjectInTheProgeny(*it)) ret.push_back(all[kk]); kk++; - std::vector< const MEDCouplingCartesianAMRPatch *> const ps(meshe->getPatches()); - for(auto p : ps) + std::vector< const MEDCouplingCartesianAMRPatch *> ps((*it)->getPatches()); + for(std::vector< const MEDCouplingCartesianAMRPatch *>::const_iterator it0=ps.begin();it0!=ps.end();it0++) { - const MEDCouplingCartesianAMRMeshGen *mesh(p->getMesh()); + const MEDCouplingCartesianAMRMeshGen *mesh((*it0)->getMesh()); meshesTmp.push_back(mesh); } } @@ -1692,14 +1676,14 @@ std::vector MEDCouplingCartesianAMRMeshGen::extractSubT void MEDCouplingCartesianAMRMeshGen::dumpPatchesOf(const std::string& varName, std::ostream& oss) const { std::size_t j(0); - for(const auto & _patche : _patches) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { - const MEDCouplingCartesianAMRPatch *patch(_patche); + const MEDCouplingCartesianAMRPatch *patch(*it); if(patch) { std::ostringstream oss2; oss2 << varName << ".addPatch(["; const std::vector< std::pair >& bltr(patch->getBLTRRange()); - std::size_t const sz(bltr.size()); + std::size_t sz(bltr.size()); for(std::size_t i=0;i MEDCouplingCartesianAMRMeshGen::getDirectCh { std::vector ret; ret.push_back((const MEDCouplingIMesh *)_mesh); - for(const auto & _patche : _patches) - ret.push_back((const MEDCouplingCartesianAMRPatch*)_patche); + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) + ret.push_back((const MEDCouplingCartesianAMRPatch*)*it); return ret; } @@ -1734,9 +1718,9 @@ void MEDCouplingCartesianAMRMeshGen::updateTime() const { if((const MEDCouplingIMesh *)_mesh) updateTimeWith(*_mesh); - for(const auto & _patche : _patches) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { - const MEDCouplingCartesianAMRPatch *elt(_patche); + const MEDCouplingCartesianAMRPatch *elt(*it); if(!elt) continue; const MEDCouplingCartesianAMRMeshGen *mesh(elt->getMesh()); @@ -1775,16 +1759,16 @@ mcIdType MEDCouplingCartesianAMRMeshSub::getAbsoluteLevel() const void MEDCouplingCartesianAMRMeshSub::detachFromFather() { - _father=nullptr; + _father=0; declareAsNew(); } std::vector< std::pair > MEDCouplingCartesianAMRMeshSub::positionRelativeToGodFather(std::vector& st) const { st=_father->getFactors(); - std::size_t const dim(st.size()); + std::size_t dim(st.size()); std::vector prev(st); - mcIdType const id(_father->getPatchIdFromChildMesh(this)); + mcIdType id(_father->getPatchIdFromChildMesh(this)); const MEDCouplingCartesianAMRPatch *p(_father->getPatch(id)); std::vector< std::pair > ret(p->getBLTRRange()); std::vector delta(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(ret)),start(dim); @@ -1795,8 +1779,8 @@ std::vector< std::pair > MEDCouplingCartesianAMRMeshSub::posi const MEDCouplingCartesianAMRMeshGen *it(_father); while(!dynamic_cast(it)) { - const auto *itc(static_cast(it)); - mcIdType const id2(itc->_father->getPatchIdFromChildMesh(itc)); + const MEDCouplingCartesianAMRMeshSub *itc(static_cast(it)); + mcIdType id2(itc->_father->getPatchIdFromChildMesh(itc)); const MEDCouplingCartesianAMRPatch *p2(itc->_father->getPatch(id2)); const std::vector< std::pair >& start2(p2->getBLTRRange()); std::vector tmp(dim); @@ -1821,7 +1805,7 @@ mcIdType MEDCouplingCartesianAMRMeshSub::getAbsoluteLevelRelativeTo(const MEDCou { if(this==ref) return 0; - if(_father==nullptr) + if(_father==0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshSub::getAbsoluteLevelRelativeTo : ref is not in the progeny of this !"); else return _father->getAbsoluteLevelRelativeTo(ref)+1; @@ -1845,7 +1829,7 @@ void MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal(const MEDCoup return ; if(!_father) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal : ref is not in the progeny of this !"); - mcIdType const myId(_father->getPatchIdFromChildMesh(this)); + mcIdType myId(_father->getPatchIdFromChildMesh(this)); ret.push_back(myId); _father->getPositionRelativeToInternal(ref,ret); } @@ -1864,7 +1848,7 @@ MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::New(MEDCouplingIMesh * const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMesh::getFather() const { //I'm god father ! No father ! - return nullptr; + return 0; } const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMesh::getGodFather() const @@ -1927,7 +1911,7 @@ MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::deepCopy(MEDCouplingCa */ void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector& bso, const DataArrayDouble *criterion, const std::vector< std::vector >& factors, double eps) { - std::size_t const nbOfLevs(bso.size()); + std::size_t nbOfLevs(bso.size()); if(nbOfLevs!=factors.size()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML : size of vectors must be the same !"); if(nbOfLevs==0) @@ -1941,7 +1925,7 @@ void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML : presence of a NULL BoxSplittingOptions in input vector !"); // std::vector elts(retrieveGridsAt(ToIdType((i)))); - std::size_t const sz(elts.size()); + std::size_t sz(elts.size()); std::vector< MCAuto > elts2(sz); std::vector< MCAuto > elts3(sz); for(std::size_t ii=0;ii > fieldNames(1); fieldNames[0].first=TMP_STR; fieldNames[0].second=1; MCAuto att(MEDCouplingAMRAttribute::New(this,fieldNames,0)); att->alloc(); - auto *tmpDa(const_cast(att->getFieldOn(this,TMP_STR))); + DataArrayDouble *tmpDa(const_cast(att->getFieldOn(this,TMP_STR))); tmpDa->deepCopyFrom(*criterion); att->synchronizeCoarseToFine(); for(std::size_t ii=0;iigetFieldOn(const_cast(elts[ii]->getMesh()),TMP_STR)); elts3[ii]=const_cast(critOnLeaf); elts3[ii]->incrRef(); } - att=nullptr; + att=0; for(std::size_t ii=0;ii(elts[ii]->getMesh())->createPatchesFromCriterion(*bso[i],elts3[ii],factors[i],eps); } @@ -1970,8 +1954,9 @@ void MEDCouplingCartesianAMRMesh::getPositionRelativeToInternal(const MEDCouplin } -MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other) -= default; +MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other):MEDCouplingCartesianAMRMeshGen(other) +{ +} MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop):MEDCouplingCartesianAMRMeshGen(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop) @@ -1989,4 +1974,5 @@ std::vector MEDCouplingCartesianAMRMesh::getDirectChild } MEDCouplingCartesianAMRMesh::~MEDCouplingCartesianAMRMesh() -= default; +{ +} diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx index e574f8780..65384f182 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx @@ -28,11 +28,7 @@ #include "MCType.hxx" #include "BoxSplittingOptions.hxx" -#include -#include -#include -#include -#include +#include "InterpKernelException.hxx" namespace MEDCoupling { @@ -65,7 +61,7 @@ namespace MEDCoupling const MEDCouplingCartesianAMRMeshGen *getMeshSafe() const; MEDCouplingCartesianAMRMeshGen *getMeshSafe(); private: - std::vector getDirectChildrenWithNull() const override; + std::vector getDirectChildrenWithNull() const; protected: MCAuto _mesh; }; @@ -78,7 +74,7 @@ namespace MEDCoupling public: MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair >& bottomLeftTopRight); std::string getClassName() const override { return std::string("MEDCouplingCartesianAMRPatch"); } - MEDCouplingCartesianAMRPatch *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const override; + MEDCouplingCartesianAMRPatch *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; // direct forward to _mesh MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors); // end of direct forward to _mesh @@ -100,7 +96,7 @@ namespace MEDCoupling private: static void ComputeZonesOfTwoRelativeToOneDiffLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& p1Zone, std::vector< std::pair >& p2Zone, std::vector& factToApplyOn2); private: - std::size_t getHeapMemorySizeWithoutChildren() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; static const MEDCouplingCartesianAMRMeshGen *FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, mcIdType& lev); static std::vector ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, mcIdType lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2); static void UpdateNeighborsOfOneWithTwoInternal(mcIdType ghostLev, const std::vector& factors, const std::vector< std::pair >&p1 ,const std::vector< std::pair >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2); @@ -122,9 +118,9 @@ namespace MEDCoupling public: MEDCouplingCartesianAMRPatchGF(MEDCouplingCartesianAMRMesh *mesh); std::string getClassName() const override { return std::string("MEDCouplingCartesianAMRPatchGF"); } - MEDCouplingCartesianAMRPatchGF *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const override; + MEDCouplingCartesianAMRPatchGF *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; private: - std::size_t getHeapMemorySizeWithoutChildren() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; private: MEDCouplingCartesianAMRPatchGF(const MEDCouplingCartesianAMRPatchGF& other, MEDCouplingCartesianAMRMeshGen *father); }; @@ -208,9 +204,9 @@ namespace MEDCoupling public: virtual void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const = 0; protected: - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT void updateTime() const override; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT void updateTime() const; protected: MCAuto _mesh; std::vector< MCAuto > _patches; @@ -222,16 +218,16 @@ namespace MEDCoupling public: MEDCouplingCartesianAMRMeshSub(MEDCouplingCartesianAMRMeshGen *father, MEDCouplingIMesh *mesh); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingCartesianAMRMeshSub"); } - MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const override; - MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const override; - MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const override; - MEDCOUPLING_EXPORT void detachFromFather() override; - MEDCOUPLING_EXPORT std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const override; - MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const override; + MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const; + MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const; + MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const; + MEDCOUPLING_EXPORT void detachFromFather(); + MEDCOUPLING_EXPORT std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const; + MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; private: MEDCouplingCartesianAMRMeshSub(const MEDCouplingCartesianAMRMeshSub& other, MEDCouplingCartesianAMRMeshGen *father); - MEDCouplingCartesianAMRMeshSub *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const override; - void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const override; + MEDCouplingCartesianAMRMeshSub *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; + void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const; protected: MEDCouplingCartesianAMRMeshGen *_father; }; @@ -243,23 +239,23 @@ namespace MEDCoupling const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop); MEDCOUPLING_EXPORT static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingCartesianAMRMesh"); } - MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const override; - MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const override; - MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const override; - MEDCOUPLING_EXPORT void detachFromFather() override; - MEDCOUPLING_EXPORT std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const override; - MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const override; - MEDCOUPLING_EXPORT std::vector retrieveGridsAt(mcIdType absoluteLev) const override; - MEDCouplingCartesianAMRMesh *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const override; + MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const; + MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const; + MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const; + MEDCOUPLING_EXPORT void detachFromFather(); + MEDCOUPLING_EXPORT std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const; + MEDCOUPLING_EXPORT mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + MEDCOUPLING_EXPORT std::vector retrieveGridsAt(mcIdType absoluteLev) const; + MEDCouplingCartesianAMRMesh *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; MEDCOUPLING_EXPORT void createPatchesFromCriterionML(const std::vector& bso, const DataArrayDouble *criterion, const std::vector< std::vector >& factors, double eps); private: - void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const override; + void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const; MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other); MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop); MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh); - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - ~MEDCouplingCartesianAMRMesh() override; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + ~MEDCouplingCartesianAMRMesh(); }; } diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx old mode 100644 new mode 100755 index fbb392360..278313fc4 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -19,34 +19,21 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingCurveLinearMesh.hxx" -#include "MCType.hxx" -#include "MEDCouplingMesh.hxx" -#include "MCIdType.hxx" -#include "MCAuto.hxx" #include "MEDCouplingPointSet.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingStructuredMesh.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "NormalizedGeometricTypes" -#include "MEDCouplingRefCountObject.hxx" #include "VolSurfUser.txx" #include "PointLocatorAlgos.txx" -#include #include #include -#include -#include #include -#include -#include -#include +#include using namespace MEDCoupling; -MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh():_coords(nullptr),_structure(0) +MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh():_coords(0),_structure(0) { } @@ -62,7 +49,8 @@ MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh(const MEDCouplingCurveLin } MEDCouplingCurveLinearMesh::~MEDCouplingCurveLinearMesh() -= default; +{ +} MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New() { @@ -71,7 +59,7 @@ MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New() MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New(const std::string& meshName) { - auto *ret=new MEDCouplingCurveLinearMesh; + MEDCouplingCurveLinearMesh *ret=new MEDCouplingCurveLinearMesh; ret->setName(meshName); return ret; } @@ -112,7 +100,7 @@ std::vector MEDCouplingCurveLinearMesh::getDirectChildr */ void MEDCouplingCurveLinearMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingCurveLinearMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::copyTinyStringsFrom : meshes have not same type !"); MEDCouplingStructuredMesh::copyTinyStringsFrom(other); @@ -124,7 +112,7 @@ bool MEDCouplingCurveLinearMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, d { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::isEqualIfNotWhy : input other pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCouplingCurveLinearMesh *otherC=dynamic_cast(other); if(!otherC) { reason="mesh given in input is not castable in MEDCouplingCurveLinearMesh !"; @@ -133,7 +121,7 @@ bool MEDCouplingCurveLinearMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, d if(!MEDCouplingStructuredMesh::isEqualIfNotWhy(other,prec,reason)) return false; std::ostringstream oss; oss.precision(15); - if(((const DataArrayDouble *)_coords && ((const DataArrayDouble *)otherC->_coords)==nullptr) || (((const DataArrayDouble *)_coords)==nullptr && (const DataArrayDouble *)otherC->_coords)) + if(((const DataArrayDouble *)_coords && ((const DataArrayDouble *)otherC->_coords)==0) || (((const DataArrayDouble *)_coords)==0 && (const DataArrayDouble *)otherC->_coords)) { oss << "Only one CurveLinearMesh between the two this and other has its coordinates defined !"; reason=oss.str(); @@ -155,10 +143,10 @@ bool MEDCouplingCurveLinearMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, d bool MEDCouplingCurveLinearMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingCurveLinearMesh *otherC=dynamic_cast(other); if(!otherC) return false; - if(((const DataArrayDouble *)_coords && ((const DataArrayDouble *)otherC->_coords)==nullptr) || (((const DataArrayDouble *)_coords)==nullptr && (const DataArrayDouble *)otherC->_coords)) + if(((const DataArrayDouble *)_coords && ((const DataArrayDouble *)otherC->_coords)==0) || (((const DataArrayDouble *)_coords)==0 && (const DataArrayDouble *)otherC->_coords)) return false; if((const DataArrayDouble *)_coords) { @@ -170,8 +158,8 @@ bool MEDCouplingCurveLinearMesh::isEqualWithoutConsideringStr(const MEDCouplingM return true; } -void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec, - DataArrayIdType *& /*cellCor*/, DataArrayIdType *& /*nodeCor*/) const +void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalWith : Meshes are not the same !"); @@ -181,8 +169,8 @@ void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *oth * Nothing is done here (except to check that the other is a MEDCoupling::MEDCouplingCurveLinearMesh instance too). * The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingCurveLinearMesh, \a this and \a other are the same ! */ -void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec, - DataArrayIdType *& /*cellCor*/) const +void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayIdType *&cellCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !"); @@ -194,7 +182,7 @@ void MEDCouplingCurveLinearMesh::checkConsistencyLight() const mcIdType nbOfNodes=1; if(sz<1) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : structure should have a lgth of size 1 at least !"); - for(auto it=_structure.begin();it!=_structure.end();it++,i++) + for(std::vector::const_iterator it=_structure.begin();it!=_structure.end();it++,i++) { if((*it)<1) { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : At pos #" << i << " of structure value is " << *it << "should be >= 1 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -213,7 +201,7 @@ void MEDCouplingCurveLinearMesh::checkConsistencyLight() const } } -void MEDCouplingCurveLinearMesh::checkConsistency(double /*eps*/) const +void MEDCouplingCurveLinearMesh::checkConsistency(double eps) const { checkConsistencyLight(); } @@ -252,7 +240,7 @@ void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(mcIdType nodeId, std::vect { if(!((const DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCoordinatesOfNode : Coordinates not set !"); - std::size_t const nbOfCompo=_coords->getNumberOfComponents(); + std::size_t nbOfCompo=_coords->getNumberOfComponents(); if(nodeId>=0 && nodeId<_coords->getNumberOfTuples()) coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo); else @@ -265,7 +253,7 @@ std::string MEDCouplingCurveLinearMesh::simpleRepr() const ret << "Curve linear mesh with name : \"" << getName() << "\"\n"; ret << "Description of mesh : \"" << getDescription() << "\"\n"; int tmpp1,tmpp2; - double const tt=getTime(tmpp1,tmpp2); + double tt=getTime(tmpp1,tmpp2); ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n"; ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; ret << "The nodal structure of curve linear mesh is : ["; @@ -311,7 +299,7 @@ void MEDCouplingCurveLinearMesh::setCoords(const DataArrayDouble *coords) void MEDCouplingCurveLinearMesh::setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd) { - std::size_t const sz=std::distance(gridStructBg,gridStructEnd); + std::size_t sz=std::distance(gridStructBg,gridStructEnd); if(sz>=1 && sz<=3) { _structure.resize(0); @@ -332,7 +320,7 @@ std::vector MEDCouplingCurveLinearMesh::getNodeGridStructure() const MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { checkConsistencyLight(); - int const dim(getSpaceDimension()); + int dim(getSpaceDimension()); std::vector dims(getMeshDimension()); if(dim!=ToIdType(cellPart.size())) { @@ -340,8 +328,8 @@ MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(co throw INTERP_KERNEL::Exception(oss.str().c_str()); } std::vector< std::pair > nodePartFormat(cellPart); - for(auto & it : nodePartFormat) - it.second++; + for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) + (*it).second++; MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); MCAuto ret(dynamic_cast(deepCopy())); const DataArrayDouble *coo(ret->getCoords()); @@ -370,7 +358,7 @@ void MEDCouplingCurveLinearMesh::getBoundingBox(double *bbox) const MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs) const { checkConsistencyLight(); - int const meshDim=getMeshDimension(); + int meshDim=getMeshDimension(); std::string name="MeasureOfMesh_"; name+=getName(); MCAuto field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); field->setMesh(const_cast(this)); field->synchronizeTimeWithMesh(); @@ -394,8 +382,8 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs) */ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCouplingFieldDouble *field) const { - mcIdType const nbnodes=getNumberOfNodes(); - int const spaceDim=getSpaceDimension(); + mcIdType nbnodes=getNumberOfNodes(); + int spaceDim=getSpaceDimension(); MCAuto arr=DataArrayDouble::New(); field->setArray(arr); if(nbnodes==0) { arr->alloc(0,1); return; } @@ -421,15 +409,15 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCoupling */ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const { - mcIdType const nbcells=getNumberOfCells(); - int const spaceDim=getSpaceDimension(); + mcIdType nbcells=getNumberOfCells(); + int spaceDim=getSpaceDimension(); if(spaceDim!=2 && spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !"); MCAuto arr=DataArrayDouble::New(); field->setArray(arr); arr->alloc(nbcells,1); double *pt=arr->getPointer(); const double *coords=_coords->begin(); - mcIdType const nX=_structure[0]-1; + mcIdType nX=_structure[0]-1; mcIdType conn[4]; for(mcIdType i=0;i arr=DataArrayDouble::New(); field->setArray(arr); @@ -457,13 +445,13 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCoupling double *pt=arr->getPointer(); const double *coords=_coords->begin(); mcIdType nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1); - mcIdType const nY1=_structure[0]*_structure[1]; + mcIdType nY1=_structure[0]*_structure[1]; mcIdType conn[8]; for(mcIdType i=0;i(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3); @@ -475,7 +463,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCoupling /*! * not implemented yet ! */ -MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureFieldOnNode(bool /*isAbs*/) const +MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureFieldOnNode(bool isAbs) const { throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldOnNode : not implemented yet !"); } @@ -486,7 +474,7 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::buildOrthogonalField() const throw INTERP_KERNEL::Exception("Expected a cmesh with meshDim == 2 !"); MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); DataArrayDouble *array=DataArrayDouble::New(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); array->alloc(nbOfCells,3); double *vals=array->getPointer(); for(mcIdType i=0;igetConstPointer(); mcIdType nodeId=-1; _coords->distanceToTuple(pos,pos+spaceDim,nodeId); if(nodeId<0) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : internal problem 1 !"); mcIdType conn[8]; - mcIdType const nbOfNodes=getNumberOfNodes(); + mcIdType nbOfNodes=getNumberOfNodes(); if(nbOfNodes==1) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : No cells in this !"); switch(getMeshDimension()) @@ -587,8 +575,8 @@ mcIdType MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, d { if(spaceDim==3) { - mcIdType const nY=_structure[0]*_structure[1]; - mcIdType const nz=nodeId/_structure[1]; mcIdType const ny=(nodeId-nz*nY)/_structure[0]; mcIdType const nx=(nodeId-nz*nY)-_structure[0]*ny; + mcIdType nY=_structure[0]*_structure[1]; + mcIdType nz=nodeId/_structure[1]; mcIdType ny=(nodeId-nz*nY)/_structure[0]; mcIdType nx=(nodeId-nz*nY)-_structure[0]*ny; if(nx>0 && ny>0 && nz>0) { conn[0]=nx-1+_structure[0]*(ny-1)+nY*(nz-1); conn[1]=nx-1+_structure[2]*ny+nY*(nz-1); conn[2]=nx+_structure[2]*ny+nY*(nz-1); conn[3]=nx+_structure[0]*(ny-1)+nY*(nz-1); @@ -664,8 +652,8 @@ void MEDCouplingCurveLinearMesh::rotate(const double *center, const double *vect { if(!((DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::rotate : no coordinates set !"); - int const spaceDim=getSpaceDimension(); - mcIdType const nbNodes(_coords->getNumberOfTuples()); + int spaceDim=getSpaceDimension(); + mcIdType nbNodes(_coords->getNumberOfTuples()); double *coords=_coords->getPointer(); if(spaceDim==3) DataArrayDouble::Rotate3DAlg(center,vector,angle,nbNodes,coords,coords); @@ -684,8 +672,8 @@ void MEDCouplingCurveLinearMesh::translate(const double *vector) if(!((DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::translate : no coordinates set !"); double *coords=_coords->getPointer(); - mcIdType const nbNodes=getNumberOfNodes(); - int const dim=getSpaceDimension(); + mcIdType nbNodes=getNumberOfNodes(); + int dim=getSpaceDimension(); for(mcIdType i=0; igetPointer(); - mcIdType const nbNodes(_coords->getNumberOfTuples()); - std::size_t const dim(_coords->getNumberOfComponents()); + mcIdType nbNodes(_coords->getNumberOfTuples()); + std::size_t dim(_coords->getNumberOfComponents()); for(mcIdType i=0;i()); @@ -712,14 +700,14 @@ void MEDCouplingCurveLinearMesh::scale(const double *point, double factor) updateTime(); } -MEDCouplingMesh *MEDCouplingCurveLinearMesh::mergeMyselfWith(const MEDCouplingMesh * /*other*/) const +MEDCouplingMesh *MEDCouplingCurveLinearMesh::mergeMyselfWith(const MEDCouplingMesh *other) const { throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::mergeMyselfWith : not available for CurveLinear Mesh !"); } DataArrayDouble *MEDCouplingCurveLinearMesh::getCoordinatesAndOwner() const { - auto *ret=const_cast((const DataArrayDouble *)_coords); + DataArrayDouble *ret=const_cast((const DataArrayDouble *)_coords); if(ret) ret->incrRef(); return ret; @@ -729,9 +717,9 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::computeCellCenterOfMass() const { checkConsistencyLight(); MCAuto ret=DataArrayDouble::New(); - int const spaceDim=getSpaceDimension(); - int const meshDim=getMeshDimension(); - mcIdType const nbOfCells=getNumberOfCells(); + int spaceDim=getSpaceDimension(); + int meshDim=getMeshDimension(); + mcIdType nbOfCells=getNumberOfCells(); ret->alloc(nbOfCells,spaceDim); ret->copyStringInfoFrom(*getCoords()); switch(meshDim) @@ -758,19 +746,19 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::computeIsoBarycenterOfNodesPerCell( */ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble *bary) const { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); double *ptToFill=bary->getPointer(); const double *coor=_coords->getConstPointer(); if(getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3 : with meshDim 3 only space dimension 3 is possible !"); mcIdType nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1); - mcIdType const nY1=_structure[0]*_structure[1]; + mcIdType nY1=_structure[0]*_structure[1]; mcIdType conn[8]; for(mcIdType i=0;i(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill); @@ -784,13 +772,13 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble * */ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble *bary) const { - mcIdType const nbcells=getNumberOfCells(); - int const spaceDim=getSpaceDimension(); + mcIdType nbcells=getNumberOfCells(); + int spaceDim=getSpaceDimension(); double *ptToFill=bary->getPointer(); const double *coor=_coords->getConstPointer(); if(spaceDim!=2 && spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !"); - mcIdType const nX=_structure[0]-1; + mcIdType nX=_structure[0]-1; mcIdType conn[4]; for(mcIdType i=0;ibegin()+spaceDim,_coords->end(),_coords->begin(),bary->getPointer(),std::plus()); std::transform(bary->begin(),bary->end(),bary->getPointer(),std::bind(std::multiplies(),std::placeholders::_1,0.5)); } -void MEDCouplingCurveLinearMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*check*/) +void MEDCouplingCurveLinearMesh::renumberCells(const mcIdType *old2NewBg, bool check) { throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for CurveLinear Mesh !"); } @@ -870,7 +858,7 @@ void MEDCouplingCurveLinearMesh::serialize(DataArrayIdType *&a1, DataArrayDouble std::copy(_coords->begin(),_coords->end(),a2->getPointer()); } -void MEDCouplingCurveLinearMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType * /*a1*/, DataArrayDouble *a2, +void MEDCouplingCurveLinearMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { setName(littleStrings[0]); @@ -895,11 +883,11 @@ void MEDCouplingCurveLinearMesh::unserialization(const std::vector& tiny void MEDCouplingCurveLinearMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const { std::ostringstream extent; - std::size_t const meshDim=_structure.size(); + std::size_t meshDim=_structure.size(); if(meshDim==0 || meshDim>3) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::writeVTKLL : meshDim invalid ! must be in [1,2,3] !"); for(std::size_t i=0;i<3;i++) - { mcIdType const val=i\n"; ofs << " \n"; ofs << " \n" << pointData << std::endl; @@ -923,10 +911,10 @@ void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const { stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << ". Name : \"" << getName() << "\"."; stream << " Nodal structure : ["; - std::size_t const s_size=_structure.size(); + std::size_t s_size=_structure.size(); for(std::size_t i=0;iisAllocated()) { stream << std::endl << "Coordinates set but not allocated !"; return ; } - std::size_t const nbOfCompo(coo->getNumberOfComponents()); + std::size_t nbOfCompo(coo->getNumberOfComponents()); std::size_t nbOfCompoExp(-1); try { diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx index fbac8ac5a..a987ac611 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx @@ -21,17 +21,9 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGCURVELINEARMESH_HXX__ #define __PARAMEDMEM_MEDCOUPLINGCURVELINEARMESH_HXX__ -#include "MCType.hxx" #include "MEDCoupling.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingMesh.hxx" #include "MEDCouplingStructuredMesh.hxx" #include "MCAuto.hxx" -#include -#include -#include -#include -#include namespace MEDCoupling { @@ -41,59 +33,59 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(); MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(const std::string& meshName); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingCurveLinearMesh"); } - MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *deepCopy() const override; - MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const override; - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return CURVE_LINEAR; } - MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override; + MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *deepCopy() const; + MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return CURVE_LINEAR; } + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor) const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const override; - MEDCOUPLING_EXPORT int getSpaceDimension() const override; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const override; - MEDCOUPLING_EXPORT std::string simpleRepr() const override; - MEDCOUPLING_EXPORT std::string advancedRepr() const override; - MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override; + DataArrayIdType *&cellCor) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const; + MEDCOUPLING_EXPORT int getSpaceDimension() const; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const; + MEDCOUPLING_EXPORT std::string simpleRepr() const; + MEDCOUPLING_EXPORT std::string advancedRepr() const; + MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const; MEDCOUPLING_EXPORT DataArrayDouble *getCoords(); MEDCOUPLING_EXPORT const DataArrayDouble *getCoords() const; MEDCOUPLING_EXPORT void setCoords(const DataArrayDouble *coords); MEDCOUPLING_EXPORT void setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd); - MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const override; - MEDCOUPLING_EXPORT MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const override; + MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const; + MEDCOUPLING_EXPORT MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; // tools - MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override; - MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const override; - MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override; - MEDCOUPLING_EXPORT void translate(const double *vector) override; - MEDCOUPLING_EXPORT void scale(const double *point, double factor) override; - MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override; - MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override; - MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override; + MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; + MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle); + MEDCOUPLING_EXPORT void translate(const double *vector); + MEDCOUPLING_EXPORT void scale(const double *point, double factor); + MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; + MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); //some useful methods - MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const override; + MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const; //serialisation-unserialization - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, - const std::vector& littleStrings) override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; - MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override; + const std::vector& littleStrings); + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; + MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; private: void getMeasureFieldMeshDim1(bool isAbs, MEDCouplingFieldDouble *field) const; void getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const; @@ -104,9 +96,9 @@ namespace MEDCoupling private: MEDCouplingCurveLinearMesh(); MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCpy); - ~MEDCouplingCurveLinearMesh() override; - void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override; - std::string getVTKDataSetType() const override; + ~MEDCouplingCurveLinearMesh(); + void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; + std::string getVTKDataSetType() const; private: MCAuto _coords; std::vector _structure; diff --git a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx index 0011aaca2..be3a764fe 100644 --- a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx +++ b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx @@ -19,15 +19,9 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingDefinitionTime.hxx" -#include "MCIdType.hxx" -#include "MCAuto.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingRefCountObject.hxx" #include -#include -#include -#include using namespace MEDCoupling; @@ -80,7 +74,7 @@ MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(TypeOfTimeDi } } -bool MEDCouplingDefinitionTimeSlice::isEqual(const MEDCouplingDefinitionTimeSlice& other, double /*eps*/) const +bool MEDCouplingDefinitionTimeSlice::isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const { if(_mesh_id!=other._mesh_id) return false; @@ -109,8 +103,8 @@ void MEDCouplingDefinitionTimeSlice::appendRepr(std::ostream& stream) const MEDCouplingDefinitionTimeSlice::MEDCouplingDefinitionTimeSlice(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId):_mesh_id(meshId),_array_id(arrId),_field_id(fieldId) { int tmp1,tmp2; - double const t1=f->getStartTime(tmp1,tmp2); - double const t2=f->getEndTime(tmp1,tmp2); + double t1=f->getStartTime(tmp1,tmp2); + double t2=f->getEndTime(tmp1,tmp2); if(t2 MEDCouplingDefinitionTimeSlice::getDirectCh bool MEDCouplingDefinitionTimeSlice::isFullyIncludedInMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const { - double const t1=getStartTime(); - double const t2=getEndTime(); - double const o1=other->getStartTime(); - double const o2=other->getEndTime(); + double t1=getStartTime(); + double t2=getEndTime(); + double o1=other->getStartTime(); + double o2=other->getEndTime(); return o1>t1-eps && o2getStartTime(); - double const o2=other->getEndTime(); + double t1=getStartTime(); + double t2=getEndTime(); + double o1=other->getStartTime(); + double o2=other->getEndTime(); return (o1t2-eps && o2>t2-eps); } bool MEDCouplingDefinitionTimeSlice::isAfterMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const { - double const t2=getEndTime(); - double const o1=other->getStartTime(); - double const o2=other->getEndTime(); + double t2=getEndTime(); + double o1=other->getStartTime(); + double o2=other->getEndTime(); return (o1>t2-eps && o2>t2-eps); } bool MEDCouplingDefinitionTimeSlice::isBeforeMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const { - double const t1=getStartTime(); - double const o1=other->getStartTime(); - double const o2=other->getEndTime(); + double t1=getStartTime(); + double o1=other->getStartTime(); + double o2=other->getEndTime(); return (o1& tiI, const std::vector& tiD) { - auto *ret=new MEDCouplingDefinitionTimeSliceInst; + MEDCouplingDefinitionTimeSliceInst *ret=new MEDCouplingDefinitionTimeSliceInst; ret->unserialize(tiI,tiD); return ret; } @@ -194,7 +188,7 @@ bool MEDCouplingDefinitionTimeSliceInst::isEqual(const MEDCouplingDefinitionTime { if(!MEDCouplingDefinitionTimeSlice::isEqual(other,eps)) return false; - const auto *otherC=dynamic_cast(&other); + const MEDCouplingDefinitionTimeSliceInst *otherC=dynamic_cast(&other); if(!otherC) return false; return fabs(otherC->_instant-_instant)& re ret[0]=_instant; } -void MEDCouplingDefinitionTimeSliceInst::getIdsOnTime(double /*tm*/, double /*eps*/, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const +void MEDCouplingDefinitionTimeSliceInst::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const { meshId=_mesh_id; arrId=_array_id; @@ -238,9 +232,9 @@ double MEDCouplingDefinitionTimeSliceInst::getEndTime() const MEDCouplingDefinitionTimeSliceInst::MEDCouplingDefinitionTimeSliceInst(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId) { int tmp1,tmp2; - double const t1=f->getStartTime(tmp1,tmp2); - double const t2=f->getEndTime(tmp1,tmp2); - double const eps=f->getTimeTolerance(); + double t1=f->getStartTime(tmp1,tmp2); + double t2=f->getEndTime(tmp1,tmp2); + double eps=f->getTimeTolerance(); if(fabs(t1-t2)>eps) throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSliceInst : times differs in this"); _instant=t1; @@ -248,7 +242,7 @@ MEDCouplingDefinitionTimeSliceInst::MEDCouplingDefinitionTimeSliceInst(const MED MEDCouplingDefinitionTimeSliceCstOnTI *MEDCouplingDefinitionTimeSliceCstOnTI::New(const std::vector& tiI, const std::vector& tiD) { - auto *ret=new MEDCouplingDefinitionTimeSliceCstOnTI; + MEDCouplingDefinitionTimeSliceCstOnTI *ret=new MEDCouplingDefinitionTimeSliceCstOnTI; ret->unserialize(tiI,tiD); return ret; } @@ -262,7 +256,7 @@ bool MEDCouplingDefinitionTimeSliceCstOnTI::isEqual(const MEDCouplingDefinitionT { if(!MEDCouplingDefinitionTimeSlice::isEqual(other,eps)) return false; - const auto *otherC=dynamic_cast(&other); + const MEDCouplingDefinitionTimeSliceCstOnTI *otherC=dynamic_cast(&other); if(!otherC) return false; if(fabs(otherC->_start-_start)>eps) @@ -276,7 +270,7 @@ void MEDCouplingDefinitionTimeSliceCstOnTI::getHotSpotsTime(std::vector& ret[0]=(_start+_end)/2.; } -void MEDCouplingDefinitionTimeSliceCstOnTI::getIdsOnTime(double /*tm*/, double /*eps*/, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const +void MEDCouplingDefinitionTimeSliceCstOnTI::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const { meshId=_mesh_id; arrId=_array_id; @@ -327,15 +321,15 @@ TypeOfTimeDiscretization MEDCouplingDefinitionTimeSliceCstOnTI::getTimeType() co MEDCouplingDefinitionTimeSliceCstOnTI::MEDCouplingDefinitionTimeSliceCstOnTI(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId) { int tmp1,tmp2; - double const t1=f->getStartTime(tmp1,tmp2); - double const t2=f->getEndTime(tmp1,tmp2); + double t1=f->getStartTime(tmp1,tmp2); + double t2=f->getEndTime(tmp1,tmp2); _start=t1; _end=t2; } MEDCouplingDefinitionTimeSliceLT *MEDCouplingDefinitionTimeSliceLT::New(const std::vector& tiI, const std::vector& tiD) { - auto *ret=new MEDCouplingDefinitionTimeSliceLT; + MEDCouplingDefinitionTimeSliceLT *ret=new MEDCouplingDefinitionTimeSliceLT; ret->unserialize(tiI,tiD); return ret; } @@ -349,7 +343,7 @@ bool MEDCouplingDefinitionTimeSliceLT::isEqual(const MEDCouplingDefinitionTimeSl { if(!MEDCouplingDefinitionTimeSlice::isEqual(other,eps)) return false; - const auto *otherC=dynamic_cast(&other); + const MEDCouplingDefinitionTimeSliceLT *otherC=dynamic_cast(&other); if(!otherC) return false; if(_array_id_end!=otherC->_array_id_end) @@ -436,8 +430,8 @@ TypeOfTimeDiscretization MEDCouplingDefinitionTimeSliceLT::getTimeType() const MEDCouplingDefinitionTimeSliceLT::MEDCouplingDefinitionTimeSliceLT(const MEDCouplingFieldDouble *f, int meshId, int arrId, int arr2Id, int fieldId):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId),_array_id_end(arr2Id) { int tmp1,tmp2; - double const t1=f->getStartTime(tmp1,tmp2); - double const t2=f->getEndTime(tmp1,tmp2); + double t1=f->getStartTime(tmp1,tmp2); + double t2=f->getEndTime(tmp1,tmp2); _start=t1; _end=t2; } @@ -448,7 +442,7 @@ MEDCouplingDefinitionTime::MEDCouplingDefinitionTime():_eps(EPS_DFT) MEDCouplingDefinitionTime::MEDCouplingDefinitionTime(const std::vector& fs, const std::vector& meshRefs, const std::vector >& arrRefs) { - std::size_t const sz=fs.size(); + std::size_t sz=fs.size(); if(sz!=arrRefs.size()) throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime constructor : internal error ! should never happen !"); _slices.resize(sz); @@ -487,7 +481,7 @@ std::vector MEDCouplingDefinitionTime::getDirectChildre void MEDCouplingDefinitionTime::assign(const MEDCouplingDefinitionTime& other) { - std::size_t const sz=other._slices.size(); + std::size_t sz=other._slices.size(); _slices.resize(sz); for(std::size_t i=0;icopy(); @@ -495,7 +489,7 @@ void MEDCouplingDefinitionTime::assign(const MEDCouplingDefinitionTime& other) bool MEDCouplingDefinitionTime::isEqual(const MEDCouplingDefinitionTime& other) const { - std::size_t const sz=_slices.size(); + std::size_t sz=_slices.size(); if(sz!=other._slices.size()) return false; for(std::size_t i=0;i& meshId { std::vector ids; int id=0; - for(auto it=_slices.begin();it!=_slices.end();it++,id++) + for(std::vector< MCAuto >::const_iterator it=_slices.begin();it!=_slices.end();it++,id++) if((*it)->isContaining(tm,_eps)) ids.push_back(id); if(ids.empty()) throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime::getIdsOnTime : No matching slice for such time !"); - std::size_t const sz=ids.size(); + std::size_t sz=ids.size(); if(sz>2) throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime::getIdsOnTime : Too many slices match this time !"); // @@ -554,10 +548,10 @@ void MEDCouplingDefinitionTime::getIdsOnTime(double tm, std::vector& meshId std::vector MEDCouplingDefinitionTime::getHotSpotsTime() const { std::vector ret; - for(const auto & _slice : _slices) + for(std::vector< MCAuto >::const_iterator it=_slices.begin();it!=_slices.end();it++) { std::vector tmp; - _slice->getHotSpotsTime(tmp); + (*it)->getHotSpotsTime(tmp); if(!ret.empty()) { if(fabs(ret.back()-tmp.front())>_eps) @@ -574,17 +568,17 @@ std::vector MEDCouplingDefinitionTime::getHotSpotsTime() const void MEDCouplingDefinitionTime::appendRepr(std::ostream& stream) const { stream << "Time definition :\n"; - for(const auto & _slice : _slices) + for(std::vector< MCAuto >::const_iterator it=_slices.begin();it!=_slices.end();it++) { stream << " - "; - _slice->appendRepr(stream); + (*it)->appendRepr(stream); stream << std::endl; } } void MEDCouplingDefinitionTime::getTinySerializationInformation(std::vector& tinyInfoI, std::vector& tinyInfoD) const { - int const sz=(int)_slices.size(); + int sz=(int)_slices.size(); tinyInfoD.resize(1); tinyInfoD[0]=_eps; tinyInfoI.resize(3*sz+2); @@ -607,18 +601,18 @@ void MEDCouplingDefinitionTime::getTinySerializationInformation(std::vector void MEDCouplingDefinitionTime::unserialize(const std::vector& tinyInfoI, const std::vector& tinyInfoD) { - int const sz=tinyInfoI[0]; + int sz=tinyInfoI[0]; _slices.resize(sz); _eps=tinyInfoD[0]; int offset1=0; int offset2=1; for(int i=0;i const tmp1(tinyInfoI.begin()+3*sz+2+offset1,tinyInfoI.begin()+3*sz+2+offset1+sz1); - std::vector const tmp2(tinyInfoD.begin()+offset2,tinyInfoD.begin()+offset2+sz2); + TypeOfTimeDiscretization ty=(TypeOfTimeDiscretization) tinyInfoI[i+2]; + int sz1=tinyInfoI[i+sz+2]; + int sz2=tinyInfoI[i+2*sz+2]; + std::vector tmp1(tinyInfoI.begin()+3*sz+2+offset1,tinyInfoI.begin()+3*sz+2+offset1+sz1); + std::vector tmp2(tinyInfoD.begin()+offset2,tinyInfoD.begin()+offset2+sz2); MEDCouplingDefinitionTimeSlice *pt=MEDCouplingDefinitionTimeSlice::New(ty,tmp1,tmp2); _slices[i]=pt; offset1+=sz1; diff --git a/src/MEDCoupling/MEDCouplingDefinitionTime.hxx b/src/MEDCoupling/MEDCouplingDefinitionTime.hxx index 2c757ae6f..4ef21dd7c 100644 --- a/src/MEDCoupling/MEDCouplingDefinitionTime.hxx +++ b/src/MEDCoupling/MEDCouplingDefinitionTime.hxx @@ -21,15 +21,13 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__ #define __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__ -#include "MEDCoupling.hxx" #include "MEDCouplingRefCountObject.hxx" #include "MCAuto.hxx" +#include "InterpKernelException.hxx" -#include -#include -#include #include +#include namespace MEDCoupling { @@ -53,8 +51,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual double getEndTime() const = 0; MEDCOUPLING_EXPORT virtual void getTinySerializationInformation(std::vector& tiI, std::vector& tiD) const = 0; MEDCOUPLING_EXPORT virtual TypeOfTimeDiscretization getTimeType() const = 0; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT bool isFullyIncludedInMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const; MEDCOUPLING_EXPORT bool isOverllapingWithMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const; MEDCOUPLING_EXPORT bool isAfterMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const; @@ -73,17 +71,17 @@ namespace MEDCoupling public: static MEDCouplingDefinitionTimeSliceInst *New(const std::vector& tiI, const std::vector& tiD); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingDefinitionTimeSliceInst"); } - MEDCouplingDefinitionTimeSlice *copy() const override; - bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const override; - void getHotSpotsTime(std::vector& ret) const override; - void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const override; - bool isContaining(double tmp, double eps) const override; - void appendRepr(std::ostream& stream) const override; - double getStartTime() const override; - double getEndTime() const override; - void getTinySerializationInformation(std::vector& tiI, std::vector& tiD) const override; + MEDCouplingDefinitionTimeSlice *copy() const; + bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const; + void getHotSpotsTime(std::vector& ret) const; + void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const; + bool isContaining(double tmp, double eps) const; + void appendRepr(std::ostream& stream) const; + double getStartTime() const; + double getEndTime() const; + void getTinySerializationInformation(std::vector& tiI, std::vector& tiD) const; void unserialize(const std::vector& tiI, const std::vector& tiD); - TypeOfTimeDiscretization getTimeType() const override; + TypeOfTimeDiscretization getTimeType() const; public: MEDCouplingDefinitionTimeSliceInst(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId); protected: @@ -97,17 +95,17 @@ namespace MEDCoupling public: static MEDCouplingDefinitionTimeSliceCstOnTI *New(const std::vector& tiI, const std::vector& tiD); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingDefinitionTimeSliceCstOnTI"); } - MEDCouplingDefinitionTimeSlice *copy() const override; - bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const override; - void getHotSpotsTime(std::vector& ret) const override; - void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const override; - bool isContaining(double tmp, double eps) const override; - void appendRepr(std::ostream& stream) const override; - double getStartTime() const override; - double getEndTime() const override; - void getTinySerializationInformation(std::vector& tiI, std::vector& tiD) const override; + MEDCouplingDefinitionTimeSlice *copy() const; + bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const; + void getHotSpotsTime(std::vector& ret) const; + void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const; + bool isContaining(double tmp, double eps) const; + void appendRepr(std::ostream& stream) const; + double getStartTime() const; + double getEndTime() const; + void getTinySerializationInformation(std::vector& tiI, std::vector& tiD) const; void unserialize(const std::vector& tiI, const std::vector& tiD); - TypeOfTimeDiscretization getTimeType() const override; + TypeOfTimeDiscretization getTimeType() const; public: MEDCouplingDefinitionTimeSliceCstOnTI(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId); protected: @@ -122,18 +120,18 @@ namespace MEDCoupling public: static MEDCouplingDefinitionTimeSliceLT *New(const std::vector& tiI, const std::vector& tiD); std::string getClassName() const override { return std::string("MEDCouplingDefinitionTimeSliceLT"); } - MEDCouplingDefinitionTimeSlice *copy() const override; - bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const override; - void getHotSpotsTime(std::vector& ret) const override; - void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const override; - bool isContaining(double tmp, double eps) const override; - void appendRepr(std::ostream& stream) const override; - double getStartTime() const override; - double getEndTime() const override; - int getEndId() const override; - void getTinySerializationInformation(std::vector& tiI, std::vector& tiD) const override; + MEDCouplingDefinitionTimeSlice *copy() const; + bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const; + void getHotSpotsTime(std::vector& ret) const; + void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const; + bool isContaining(double tmp, double eps) const; + void appendRepr(std::ostream& stream) const; + double getStartTime() const; + double getEndTime() const; + int getEndId() const; + void getTinySerializationInformation(std::vector& tiI, std::vector& tiD) const; void unserialize(const std::vector& tiI, const std::vector& tiD); - TypeOfTimeDiscretization getTimeType() const override; + TypeOfTimeDiscretization getTimeType() const; public: MEDCouplingDefinitionTimeSliceLT(const MEDCouplingFieldDouble *f, int meshId, int arrId, int arr2Id, int fieldId); protected: diff --git a/src/MEDCoupling/MEDCouplingField.cxx b/src/MEDCoupling/MEDCouplingField.cxx index 8dd250117..4ecfc5419 100644 --- a/src/MEDCoupling/MEDCouplingField.cxx +++ b/src/MEDCoupling/MEDCouplingField.cxx @@ -19,20 +19,10 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingField.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" #include "MEDCouplingMesh.hxx" #include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingNatureOfField.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "NormalizedGeometricTypes" -#include -#include #include -#include -#include using namespace MEDCoupling; @@ -72,16 +62,16 @@ bool MEDCouplingField::isEqualIfNotWhyProtected(const MEDCouplingField *other, d reason.insert(0,"Spatial discretizations differ :"); return false; } - if(_mesh==nullptr && other->_mesh==nullptr) + if(_mesh==0 && other->_mesh==0) return true; - if(_mesh==nullptr || other->_mesh==nullptr) + if(_mesh==0 || other->_mesh==0) { reason="Only one field between the two this and other has its underlying mesh defined !"; return false; } if(_mesh==other->_mesh) return true; - bool const ret=_mesh->isEqualIfNotWhy(other->_mesh,meshPrec,reason); + bool ret=_mesh->isEqualIfNotWhy(other->_mesh,meshPrec,reason); if(!ret) reason.insert(0,"Underlying meshes of fields differ for the following reason : "); return ret; @@ -106,9 +96,9 @@ bool MEDCouplingField::isEqualWithoutConsideringStrProtected(const MEDCouplingFi return false; if(_nature!=other->_nature) return false; - if(_mesh==nullptr && other->_mesh==nullptr) + if(_mesh==0 && other->_mesh==0) return true; - if(_mesh==nullptr || other->_mesh==nullptr) + if(_mesh==0 || other->_mesh==0) return false; if(_mesh==other->_mesh) return true; @@ -486,16 +476,16 @@ MEDCouplingField::~MEDCouplingField() _mesh->decrRef(); } -MEDCouplingField::MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature):_nature(nature),_mesh(nullptr),_type(type) +MEDCouplingField::MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature):_nature(nature),_mesh(0),_type(type) { } -MEDCouplingField::MEDCouplingField(TypeOfField type):_nature(NoNature),_mesh(nullptr),_type(MEDCouplingFieldDiscretization::New(type)) +MEDCouplingField::MEDCouplingField(TypeOfField type):_nature(NoNature),_mesh(0),_type(MEDCouplingFieldDiscretization::New(type)) { } MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy):RefCountObject(other),_name(other._name),_desc(other._desc),_nature(other._nature), - _mesh(nullptr),_type(nullptr) + _mesh(0),_type(0) { if(other._mesh) { @@ -579,7 +569,7 @@ mcIdType MEDCouplingField::getNumberOfTuplesExpected() const void MEDCouplingField::setDiscretization(MEDCouplingFieldDiscretization *newDisc) { - bool const needUpdate=(const MEDCouplingFieldDiscretization *)_type!=newDisc; + bool needUpdate=(const MEDCouplingFieldDiscretization *)_type!=newDisc; _type=newDisc; if(newDisc) newDisc->incrRef(); diff --git a/src/MEDCoupling/MEDCouplingField.hxx b/src/MEDCoupling/MEDCouplingField.hxx index 948ac7934..0b1539af5 100644 --- a/src/MEDCoupling/MEDCouplingField.hxx +++ b/src/MEDCoupling/MEDCouplingField.hxx @@ -21,18 +21,15 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGFIELD_HXX__ #define __PARAMEDMEM_MEDCOUPLINGFIELD_HXX__ -#include "MCType.hxx" #include "MEDCoupling.hxx" -#include "MEDCouplingNatureOfFieldEnum" #include "MEDCouplingTimeLabel.hxx" +#include "MEDCouplingNatureOfField.hxx" #include "MEDCouplingRefCountObject.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "MCAuto.hxx" #include "MEDCouplingFieldDiscretization.hxx" -#include "NormalizedGeometricTypes" +#include "InterpKernelException.hxx" -#include -#include -#include #include #include @@ -85,9 +82,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const; MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector& cellIds) const; MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const; - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; // for MED file RW MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0; @@ -95,7 +92,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingField(TypeOfField type); MEDCOUPLING_EXPORT MEDCouplingField(const MEDCouplingField& other, bool deepCopy=true); MEDCOUPLING_EXPORT MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature=NoNature); - MEDCOUPLING_EXPORT ~MEDCouplingField() override; + MEDCOUPLING_EXPORT virtual ~MEDCouplingField(); MEDCOUPLING_EXPORT bool isEqualIfNotWhyProtected(const MEDCouplingField *other, double meshPrec, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStrProtected(const MEDCouplingField *other, double meshPrec) const; protected: diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx old mode 100644 new mode 100755 index ba6e740e4..1e5021283 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -19,13 +19,8 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingFieldDiscretization.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MEDCouplingFieldDiscretizationOnNodesFE.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingGaussLocalization.hxx" -#include "MEDCouplingNatureOfFieldEnum" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MCAuto.hxx" @@ -36,21 +31,14 @@ #include "InterpKernelGaussCoords.hxx" #include "InterpKernelMatrixTools.hxx" #include "InterpKernelDenseMatrix.hxx" -#include "NormalizedGeometricTypes" -#include -#include -#include -#include -#include -#include #include +#include +#include #include #include #include #include -#include -#include using namespace MEDCoupling; @@ -214,7 +202,7 @@ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::deepCopy() const /*! * For all field discretization excepted GaussPts the [ \a startCellIds, \a endCellIds ) has no impact on the cloned instance. */ -MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePart(const mcIdType * /*startCellIds*/, const mcIdType * /*endCellIds*/) const +MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const { return clone(); } @@ -222,7 +210,7 @@ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePart(const /*! * For all field discretization excepted GaussPts the slice( \a beginCellId, \a endCellIds, \a stepCellId ) has no impact on the cloned instance. */ -MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePartRange(mcIdType /*beginCellIds*/, mcIdType /*endCellIds*/, mcIdType /*stepCellIds*/) const +MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const { return clone(); } @@ -252,15 +240,15 @@ std::vector MEDCouplingFieldDiscretization::getDirectCh void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const { MCAuto vol=getMeasureField(mesh,true); - std::size_t const nbOfCompo=arr->getNumberOfComponents(); - mcIdType const nbOfElems=getNumberOfTuples(mesh); + std::size_t nbOfCompo=arr->getNumberOfComponents(); + mcIdType nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); const double *arrPtr=arr->getConstPointer(); const double *volPtr=vol->getArray()->getConstPointer(); double deno=0.; for(mcIdType i=0;i vol=getMeasureField(mesh,true); - std::size_t const nbOfCompo=arr->getNumberOfComponents(); - mcIdType const nbOfElems=getNumberOfTuples(mesh); + std::size_t nbOfCompo=arr->getNumberOfComponents(); + mcIdType nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); const double *arrPtr=arr->getConstPointer(); const double *volPtr=vol->getArray()->getConstPointer(); double deno=0.; for(mcIdType i=0;i vol=getMeasureField(mesh,isWAbs); - std::size_t const nbOfCompo(arr->getNumberOfComponents()); - mcIdType const nbOfElems(getNumberOfTuples(mesh)); + std::size_t nbOfCompo(arr->getNumberOfComponents()); + mcIdType nbOfElems(getNumberOfTuples(mesh)); if(nbOfElems!=arr->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretization::integral : field is not correct ! number of tuples in array is " << arr->getNumberOfTuples(); @@ -333,7 +321,7 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const * * \sa MEDCouplingFieldDiscretization::buildSubMeshData */ -MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& /*beginOut*/, mcIdType& /*endOut*/, mcIdType& /*stepOut*/, DataArrayIdType *&di) const +MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const { MCAuto da=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds); return buildSubMeshData(mesh,da->begin(),da->end(),di); @@ -341,7 +329,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MED void MEDCouplingFieldDiscretization::getSerializationIntArray(DataArrayIdType *& arr) const { - arr=nullptr; + arr=0; } /*! @@ -358,9 +346,9 @@ void MEDCouplingFieldDiscretization::getTinySerializationDbleInformation(std::ve { } -void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector& /*tinyInfo*/, DataArrayIdType *& arr) +void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *& arr) { - arr=nullptr; + arr=0; } /*! @@ -385,19 +373,19 @@ void MEDCouplingFieldDiscretization::renumberCells(const mcIdType *old2NewBg, bo { } -double MEDCouplingFieldDiscretization::getIJK(const MEDCouplingMesh * /*mesh*/, const DataArrayDouble * /*da*/, mcIdType /*cellId*/, mcIdType /*nodeIdInCell*/, int /*compoId*/) const +double MEDCouplingFieldDiscretization::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const { throw INTERP_KERNEL::Exception("getIJK Invalid ! only for GaussPoint and GaussNE discretizations !"); } -void MEDCouplingFieldDiscretization::setGaussLocalizationOnType(const MEDCouplingMesh * /*m*/, INTERP_KERNEL::NormalizedCellType /*type*/, const std::vector& /*refCoo*/, - const std::vector& /*gsCoo*/, const std::vector& /*wg*/) +void MEDCouplingFieldDiscretization::setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, + const std::vector& gsCoo, const std::vector& wg) { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -void MEDCouplingFieldDiscretization::setGaussLocalizationOnCells(const MEDCouplingMesh * /*m*/, const mcIdType * /*begin*/, const mcIdType * /*end*/, const std::vector& /*refCoo*/, - const std::vector& /*gsCoo*/, const std::vector& /*wg*/) +void MEDCouplingFieldDiscretization::setGaussLocalizationOnCells(const MEDCouplingMesh *m, const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, + const std::vector& gsCoo, const std::vector& wg) { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } @@ -407,12 +395,12 @@ void MEDCouplingFieldDiscretization::clearGaussLocalizations() throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType /*locId*/) +MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType locId) { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -const MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType /*locId*/) const +const MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(mcIdType locId) const { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } @@ -422,22 +410,22 @@ mcIdType MEDCouplingFieldDiscretization::getNbOfGaussLocalization() const throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneCell(mcIdType /*cellId*/) const +mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneCell(mcIdType cellId) const { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType /*type*/) const +mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -std::set MEDCouplingFieldDiscretization::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType /*type*/) const +std::set MEDCouplingFieldDiscretization::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -void MEDCouplingFieldDiscretization::getCellIdsHavingGaussLocalization(mcIdType /*locId*/, std::vector& /*cellIds*/) const +void MEDCouplingFieldDiscretization::getCellIdsHavingGaussLocalization(mcIdType locId, std::vector& cellIds) const { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } @@ -446,9 +434,9 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons { if(!arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !"); - mcIdType const oldNbOfElems=arr->getNumberOfTuples(); - std::size_t const nbOfComp=arr->getNumberOfComponents(); - mcIdType const newNbOfTuples=newNbOfEntity; + mcIdType oldNbOfElems=arr->getNumberOfTuples(); + std::size_t nbOfComp=arr->getNumberOfComponents(); + mcIdType newNbOfTuples=newNbOfEntity; MCAuto arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); arr->reAlloc(newNbOfTuples); @@ -457,7 +445,7 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons INTERP_KERNEL::AutoPtr tmp=new double[nbOfComp]; for(mcIdType i=0;i=0)//if newNb<0 the node is considered as out. { if(std::find_if(ptToFill+newNb*nbOfComp,ptToFill+(newNb+1)*nbOfComp,std::bind(std::not_equal_to(),std::placeholders::_1,std::numeric_limits::max())) @@ -480,22 +468,23 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons } } -void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const mcIdType *new2OldPtr, mcIdType new2OldSz, DataArrayDouble *arr, const std::string& /*msg*/) +void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const mcIdType *new2OldPtr, mcIdType new2OldSz, DataArrayDouble *arr, const std::string& msg) { - std::size_t const nbOfComp=arr->getNumberOfComponents(); + std::size_t nbOfComp=arr->getNumberOfComponents(); MCAuto arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); arr->reAlloc(new2OldSz); double *ptToFill=arr->getPointer(); for(mcIdType i=0;i(other); - bool const ret=otherC!=nullptr; + const MEDCouplingFieldDiscretizationP0 *otherC=dynamic_cast(other); + bool ret=otherC!=0; if(!ret) reason="Spatial discrtization of this is ON_CELLS, which is not the case of other."; return ret; @@ -553,15 +542,15 @@ mcIdType MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCod { if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : invalid input code !"); - mcIdType const nbOfSplit=ToIdType(idsPerType.size()); - mcIdType const nbOfTypes=ToIdType(code.size()/3); + mcIdType nbOfSplit=ToIdType(idsPerType.size()); + mcIdType nbOfTypes=ToIdType(code.size()/3); mcIdType ret=0; for(mcIdType i=0;i=nbOfSplit) @@ -592,7 +581,7 @@ DataArrayIdType *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplin { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getOffsetArr : NULL input mesh !"); - std::size_t const nbOfTuples=mesh->getNumberOfCells(); + std::size_t nbOfTuples=mesh->getNumberOfCells(); DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(nbOfTuples+1,1); ret->iota(0); @@ -607,10 +596,10 @@ void MEDCouplingFieldDiscretizationP0::renumberArraysForCell(const MEDCouplingMe const mcIdType *array=old2NewBg; if(check) array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); - for(auto it : arrays) + for(std::vector::const_iterator it=arrays.begin();it!=arrays.end();it++) { - if(it) - it->renumberInPlace(array); + if(*it) + (*it)->renumberInPlace(array); } if(check) free(const_cast(array)); @@ -669,7 +658,7 @@ void MEDCouplingFieldDiscretizationP0::getValueOn(const DataArrayDouble *arr, co { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOn : NULL input mesh !"); - mcIdType const id=mesh->getCellContainingPoint(loc,_precision); + mcIdType id=mesh->getCellContainingPoint(loc,_precision); if(id==-1) throw INTERP_KERNEL::Exception("Specified point is detected outside of mesh : unable to apply P0::getValueOn !"); arr->getTuple(id,res); @@ -677,10 +666,10 @@ void MEDCouplingFieldDiscretizationP0::getValueOn(const DataArrayDouble *arr, co void MEDCouplingFieldDiscretizationP0::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const { - const auto *meshC=dynamic_cast(mesh); + const MEDCouplingCMesh *meshC=dynamic_cast(mesh); if(!meshC) throw INTERP_KERNEL::Exception("P0::getValueOnPos is only accessible for structured meshes !"); - mcIdType const id=meshC->getCellIdFromPos(i,j,k); + mcIdType id=meshC->getCellIdFromPos(i,j,k); arr->getTuple(id,res); } @@ -691,8 +680,8 @@ DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArr MCAuto eltsArr,eltsIndexArr; mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr); const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); - int const spaceDim=mesh->getSpaceDimension(); - std::size_t const nbOfComponents=arr->getNumberOfComponents(); + int spaceDim=mesh->getSpaceDimension(); + std::size_t nbOfComponents=arr->getNumberOfComponents(); MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); @@ -716,12 +705,12 @@ void MEDCouplingFieldDiscretizationP0::renumberValuesOnNodes(double , const mcId { } -void MEDCouplingFieldDiscretizationP0::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh * /*mesh*/, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const +void MEDCouplingFieldDiscretizationP0::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const { RenumberEntitiesFromO2NArr(epsOnVals,old2New,newSz,arr,"Cell"); } -void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingMesh * /*mesh*/, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const +void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const { RenumberEntitiesFromN2OArr(new2old,newSz,arr,"Cell"); } @@ -734,7 +723,7 @@ void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingM * \return a newly allocated array containing ids to select into the DataArrayDouble of the field. * */ -DataArrayIdType *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh * /*mesh*/, const mcIdType *startCellIds, const mcIdType *endCellIds) const +DataArrayIdType *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const { MCAuto ret=DataArrayIdType::New(); ret->alloc(std::distance(startCellIds,endCellIds),1); @@ -776,7 +765,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange(const M if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange : NULL input mesh !"); MCAuto ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds); - di=nullptr; beginOut=beginCellIds; endOut=endCellIds; stepOut=stepCellIds; + di=0; beginOut=beginCellIds; endOut=endCellIds; stepOut=stepCellIds; return ret.retn(); } @@ -802,15 +791,15 @@ mcIdType MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardi { if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : invalid input code !"); - mcIdType const nbOfSplit=ToIdType(idsPerType.size()); - mcIdType const nbOfTypes=ToIdType(code.size()/3); + mcIdType nbOfSplit=ToIdType(idsPerType.size()); + mcIdType nbOfTypes=ToIdType(code.size()/3); mcIdType ret=0; for(mcIdType i=0;i=nbOfSplit) @@ -849,7 +838,7 @@ DataArrayIdType *MEDCouplingFieldDiscretizationOnNodes::getOffsetArr(const MEDCo { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getOffsetArr : NULL input mesh !"); - mcIdType const nbOfTuples=mesh->getNumberOfNodes(); + mcIdType nbOfTuples=mesh->getNumberOfNodes(); DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(nbOfTuples+1,1); ret->iota(0); @@ -869,7 +858,7 @@ void MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds(c if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : NULL input mesh !"); MCAuto ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd); - const auto *meshc=dynamic_cast(mesh); + const MEDCouplingUMesh *meshc=dynamic_cast(mesh); if(!meshc) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : trying to subpart field on nodes by node ids ! Your mesh has to be unstructured !"); MCAuto meshPart=static_cast(meshc->buildPartOfMySelf(ret1->begin(),ret1->end(),true)); @@ -900,7 +889,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const M { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::buildSubMeshData : NULL input mesh !"); - DataArrayIdType *diTmp=nullptr; + DataArrayIdType *diTmp=0; MCAuto ret=mesh->buildPartAndReduceNodes(start,end,diTmp); MCAuto diTmpSafe(diTmp); MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); @@ -922,7 +911,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange(co { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange : NULL input mesh !"); - DataArrayIdType *diTmp=nullptr; + DataArrayIdType *diTmp=0; MCAuto ret=mesh->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,diTmp); if(diTmp) { @@ -971,10 +960,10 @@ void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnCellsR(const MEDCoup void MEDCouplingFieldDiscretizationOnNodes::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const { - const auto *meshC=dynamic_cast(mesh); + const MEDCouplingCMesh *meshC=dynamic_cast(mesh); if(!meshC) throw INTERP_KERNEL::Exception("OnNodes::getValueOnPos(i,j,k) is only accessible for structured meshes !"); - mcIdType const id=meshC->getNodeIdFromPos(i,j,k); + mcIdType id=meshC->getNodeIdFromPos(i,j,k); arr->getTuple(id,res); } @@ -1003,15 +992,15 @@ const char *MEDCouplingFieldDiscretizationP1::getRepr() const return REPR; } -bool MEDCouplingFieldDiscretizationP1::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const +bool MEDCouplingFieldDiscretizationP1::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const { if(!other) { reason="other spatial discretization is NULL, and this spatial discretization (P1) is defined."; return false; } - const auto *otherC=dynamic_cast(other); - bool const ret=otherC!=nullptr; + const MEDCouplingFieldDiscretizationP1 *otherC=dynamic_cast(other); + bool ret=otherC!=0; if(!ret) reason="Spatial discrtization of this is ON_NODES, which is not the case of other."; return ret; @@ -1034,10 +1023,10 @@ void MEDCouplingFieldDiscretizationP1::getValueOn(const DataArrayDouble *arr, co { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueOn : NULL input mesh !"); - mcIdType const id=mesh->getCellContainingPoint(loc,_precision); + mcIdType id=mesh->getCellContainingPoint(loc,_precision); if(id==-1) throw INTERP_KERNEL::Exception("Specified point is detected outside of mesh : unable to apply P1::getValueOn !"); - INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(id); + INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(id); if(type!=INTERP_KERNEL::NORM_SEG2 && type!=INTERP_KERNEL::NORM_TRI3 && type!=INTERP_KERNEL::NORM_TETRA4) throw INTERP_KERNEL::Exception("P1 getValueOn is not specified for not simplex cells !"); getValueInCell(mesh,id,arr,loc,res); @@ -1054,17 +1043,17 @@ void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mes std::vector conn; std::vector coo; mesh->getNodeIdsOfCell(cellId,conn); - for(long const iter : conn) - mesh->getCoordinatesOfNode(iter,coo); - int const spaceDim=mesh->getSpaceDimension(); - std::size_t const nbOfNodes=conn.size(); + for(std::vector::const_iterator iter=conn.begin();iter!=conn.end();iter++) + mesh->getCoordinatesOfNode(*iter,coo); + int spaceDim=mesh->getSpaceDimension(); + std::size_t nbOfNodes=conn.size(); std::vector vec(nbOfNodes); for(std::size_t i=0;i tmp=new double[nbOfNodes]; - INTERP_KERNEL::NormalizedCellType const ct(mesh->getTypeOfCell(cellId)); + INTERP_KERNEL::NormalizedCellType ct(mesh->getTypeOfCell(cellId)); INTERP_KERNEL::barycentric_coords(ct,vec,loc,tmp); - std::size_t const sz=arr->getNumberOfComponents(); + std::size_t sz=arr->getNumberOfComponents(); INTERP_KERNEL::AutoPtr tmp2=new double[sz]; std::fill(res,res+sz,0.); for(std::size_t i=0;i eltsArr,eltsIndexArr; mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr); const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); - int const spaceDim=mesh->getSpaceDimension(); - std::size_t const nbOfComponents=arr->getNumberOfComponents(); + int spaceDim=mesh->getSpaceDimension(); + std::size_t nbOfComponents=arr->getNumberOfComponents(); MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); @@ -1110,7 +1099,7 @@ MCAuto MEDCouplingFieldDiscretizationP1::aggrega return EasyAggregate(fds); } -MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell():_discr_per_cell(nullptr) +MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell():_discr_per_cell(0) { } @@ -1123,19 +1112,19 @@ MEDCouplingFieldDiscretizationPerCell::~MEDCouplingFieldDiscretizationPerCell() /*! * This constructor deep copies MEDCoupling::DataArrayIdType instance from other (if any). */ -MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds):_discr_per_cell(nullptr) +MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds):_discr_per_cell(0) { DataArrayIdType *arr=other._discr_per_cell; if(arr) { - if(startCellIds==nullptr && endCellIds==nullptr) + if(startCellIds==0 && endCellIds==0) _discr_per_cell=arr->deepCopy(); else _discr_per_cell=arr->selectByTupleIdSafe(startCellIds,endCellIds); } } -MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds):_discr_per_cell(nullptr) +MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds):_discr_per_cell(0) { DataArrayIdType *arr=other._discr_per_cell; if(arr) @@ -1158,7 +1147,7 @@ void MEDCouplingFieldDiscretizationPerCell::updateTime() const std::size_t MEDCouplingFieldDiscretizationPerCell::getHeapMemorySizeWithoutChildren() const { - std::size_t const ret(MEDCouplingFieldDiscretization::getHeapMemorySizeWithoutChildren()); + std::size_t ret(MEDCouplingFieldDiscretization::getHeapMemorySizeWithoutChildren()); return ret; } @@ -1169,48 +1158,48 @@ std::vector MEDCouplingFieldDiscretizationPerCell::getD return ret; } -void MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray * /*da*/) const +void MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has no discretization per cell !"); if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween : NULL input mesh or DataArray !"); - mcIdType const nbOfTuples(_discr_per_cell->getNumberOfTuples()); + mcIdType nbOfTuples(_discr_per_cell->getNumberOfTuples()); if(nbOfTuples!=mesh->getNumberOfCells()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has a discretization per cell but it's not matching the underlying mesh !"); } -bool MEDCouplingFieldDiscretizationPerCell::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const +bool MEDCouplingFieldDiscretizationPerCell::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const { if(!other) { reason="other spatial discretization is NULL, and this spatial discretization (PerCell) is defined."; return false; } - const auto *otherC=dynamic_cast(other); + const MEDCouplingFieldDiscretizationPerCell *otherC=dynamic_cast(other); if(!otherC) { reason="Spatial discretization of this is ON_GAUSS, which is not the case of other."; return false; } - if(_discr_per_cell==nullptr) - return otherC->_discr_per_cell==nullptr; - if(otherC->_discr_per_cell==nullptr) + if(_discr_per_cell==0) + return otherC->_discr_per_cell==0; + if(otherC->_discr_per_cell==0) return false; - bool const ret=_discr_per_cell->isEqualIfNotWhy(*otherC->_discr_per_cell,reason); + bool ret=_discr_per_cell->isEqualIfNotWhy(*otherC->_discr_per_cell,reason); if(!ret) reason.insert(0,"Field discretization per cell DataArrayIdType given the discid per cell :"); return ret; } -bool MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double /*eps*/) const +bool MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingFieldDiscretizationPerCell *otherC=dynamic_cast(other); if(!otherC) return false; - if(_discr_per_cell==nullptr) - return otherC->_discr_per_cell==nullptr; - if(otherC->_discr_per_cell==nullptr) + if(_discr_per_cell==0) + return otherC->_discr_per_cell==0; + if(otherC->_discr_per_cell==0) return false; return _discr_per_cell->isEqualWithoutConsideringStr(*otherC->_discr_per_cell); } @@ -1221,7 +1210,7 @@ bool MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(const M */ void MEDCouplingFieldDiscretizationPerCell::renumberCells(const mcIdType *old2NewBg, bool check) { - mcIdType const nbCells=_discr_per_cell->getNumberOfTuples(); + mcIdType nbCells=_discr_per_cell->getNumberOfTuples(); const mcIdType *array=old2NewBg; if(check) array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells); @@ -1241,7 +1230,7 @@ void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const M if(!_discr_per_cell) { _discr_per_cell=DataArrayIdType::New(); - mcIdType const nbTuples=mesh->getNumberOfCells(); + mcIdType nbTuples=mesh->getNumberOfCells(); _discr_per_cell->alloc(nbTuples,1); mcIdType *ptr=_discr_per_cell->getPointer(); std::fill(ptr,ptr+nbTuples,DFT_INVALID_LOCID_VALUE); @@ -1293,7 +1282,8 @@ void MEDCouplingFieldDiscretizationPerCell::setArrayOfDiscIds(const DataArrayIdT } MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss() -= default; +{ +} MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const mcIdType *startCellIds, const mcIdType *endCellIds):MEDCouplingFieldDiscretizationPerCell(other,startCellIds,endCellIds),_loc(other._loc) { @@ -1315,7 +1305,7 @@ bool MEDCouplingFieldDiscretizationGauss::isEqualIfNotWhy(const MEDCouplingField reason="other spatial discretization is NULL, and this spatial discretization (Gauss) is defined."; return false; } - const auto *otherC=dynamic_cast(other); + const MEDCouplingFieldDiscretizationGauss *otherC=dynamic_cast(other); if(!otherC) { reason="Spatial discrtization of this is ON_GAUSS, which is not the case of other."; @@ -1328,7 +1318,7 @@ bool MEDCouplingFieldDiscretizationGauss::isEqualIfNotWhy(const MEDCouplingField reason="Gauss spatial discretization : localization sizes differ"; return false; } - std::size_t const sz=_loc.size(); + std::size_t sz=_loc.size(); for(std::size_t i=0;i_loc[i],eps)) { @@ -1341,14 +1331,14 @@ bool MEDCouplingFieldDiscretizationGauss::isEqualIfNotWhy(const MEDCouplingField bool MEDCouplingFieldDiscretizationGauss::isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingFieldDiscretizationGauss *otherC=dynamic_cast(other); if(!otherC) return false; if(!MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(other,eps)) return false; if(_loc.size()!=otherC->_loc.size()) return false; - std::size_t const sz=_loc.size(); + std::size_t sz=_loc.size(); for(std::size_t i=0;i_loc[i],eps)) return false; @@ -1389,7 +1379,7 @@ std::string MEDCouplingFieldDiscretizationGauss::getStringRepr() const } oss << "Presence of " << _loc.size() << " localizations." << std::endl; int i=0; - for(auto it=_loc.begin();it!=_loc.end();it++,i++) + for(std::vector::const_iterator it=_loc.begin();it!=_loc.end();it++,i++) { oss << "+++++ Localization #" << i << " +++++" << std::endl; oss << (*it).getStringRepr(); @@ -1402,8 +1392,8 @@ std::size_t MEDCouplingFieldDiscretizationGauss::getHeapMemorySizeWithoutChildre { std::size_t ret(MEDCouplingFieldDiscretizationPerCell::getHeapMemorySizeWithoutChildren()); ret+=_loc.capacity()*sizeof(MEDCouplingGaussLocalization); - for(const auto & it : _loc) - ret+=it.getMemorySize(); + for(std::vector::const_iterator it=_loc.begin();it!=_loc.end();it++) + ret+=(*it).getMemorySize(); return ret; } @@ -1424,15 +1414,15 @@ mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegarding throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode"); if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : invalid input code !"); - mcIdType const nbOfSplit=ToIdType(idsPerType.size()); - mcIdType const nbOfTypes=ToIdType(code.size()/3); + mcIdType nbOfSplit=ToIdType(idsPerType.size()); + mcIdType nbOfTypes=ToIdType(code.size()/3); mcIdType ret(0); for(mcIdType i=0;i=nbOfSplit) @@ -1454,17 +1444,17 @@ mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegarding std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : input code points to " << ret << " cells whereas discretization percell array lgth is " << _discr_per_cell->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - return getNumberOfTuples(nullptr);//0 is not an error ! It is to be sure that input mesh is not used + return getNumberOfTuples(0);//0 is not an error ! It is to be sure that input mesh is not used } mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfTuples(const MEDCouplingMesh *) const { mcIdType ret=0; - if (_discr_per_cell == nullptr) + if (_discr_per_cell == 0) throw INTERP_KERNEL::Exception("Discretization is not initialized!"); const mcIdType *dcPtr=_discr_per_cell->getConstPointer(); - mcIdType const nbOfTuples=_discr_per_cell->getNumberOfTuples(); - mcIdType const maxSz=ToIdType(_loc.size()); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); + mcIdType maxSz=ToIdType(_loc.size()); for(const mcIdType *w=dcPtr;w!=dcPtr+nbOfTuples;w++) { if(*w>=0 && *wgetNumberOfCells(); + mcIdType nbOfTuples=mesh->getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfTuples+1,1); mcIdType *retPtr(ret->getPointer()); const mcIdType *start(_discr_per_cell->begin()); if(_discr_per_cell->getNumberOfTuples()!=nbOfTuples) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : mismatch between the mesh and the discretization ids array length !"); - mcIdType const maxPossible=ToIdType(_loc.size()); + mcIdType maxPossible=ToIdType(_loc.size()); retPtr[0]=0; for(mcIdType i=0;igetNumberOfCells()); - mcIdType const nbOfCells=_discr_per_cell->getNumberOfTuples(); - mcIdType const nbOfTuples=getNumberOfTuples(nullptr); + mcIdType nbOfCells=_discr_per_cell->getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(0); const mcIdType *dcPtr=_discr_per_cell->getConstPointer(); - auto *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace. - auto *array3=new mcIdType[nbOfCells];//store for each cell in present dcp array (already renumbered) the offset needed by each cell in new numbering. + mcIdType *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace. + mcIdType *array3=new mcIdType[nbOfCells];//store for each cell in present dcp array (already renumbered) the offset needed by each cell in new numbering. array3[0]=0; for(mcIdType i=1;irenumberInPlace(array2); + for(std::vector::const_iterator it=arrays.begin();it!=arrays.end();it++) + if(*it) + (*it)->renumberInPlace(array2); delete [] array2; if(check) free(const_cast(array)); @@ -1553,9 +1543,9 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValue throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues : NULL input mesh !"); checkNoOrphanCells(); MCAuto umesh=mesh->buildUnstructured();//in general do nothing - mcIdType const nbOfTuples=getNumberOfTuples(mesh); + mcIdType nbOfTuples=getNumberOfTuples(mesh); MCAuto ret=DataArrayDouble::New(); - int const spaceDim=mesh->getSpaceDimension(); + int spaceDim=mesh->getSpaceDimension(); ret->alloc(nbOfTuples,spaceDim); std::vector< mcIdType > locIds; std::vector parts=splitIntoSingleGaussDicrPerCellType(locIds); @@ -1573,14 +1563,14 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValue INTERP_KERNEL::GaussCoords calculator; // const MEDCouplingGaussLocalization& cli(_loc[locIds[i]]);//curLocInfo - INTERP_KERNEL::NormalizedCellType const typ(cli.getType()); + INTERP_KERNEL::NormalizedCellType typ(cli.getType()); const std::vector& wg(cli.getWeights()); calculator.addGaussInfo(typ,INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension(), &cli.getGaussCoords()[0],ToIdType(wg.size()),&cli.getRefCoords()[0], INTERP_KERNEL::CellModel::GetCellModel(typ).getNumberOfNodes()); // - for(long const w : *parts2[i]) - calculator.calculateCoords(cli.getType(),coords,spaceDim,conn+connI[w]+1,valsToFill+spaceDim*(ptrOffsets[w])); + for(const mcIdType *w=parts2[i]->begin();w!=parts2[i]->end();w++) + calculator.calculateCoords(cli.getType(),coords,spaceDim,conn+connI[*w]+1,valsToFill+spaceDim*(ptrOffsets[*w])); } ret->copyStringInfoFrom(*umesh->getCoords()); return ret.retn(); @@ -1618,33 +1608,33 @@ void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std tinyInfo.push_back(-1); else tinyInfo.push_back(_loc[0].getDimension()); - for(const auto & iter : _loc) - iter.pushTinySerializationIntInfo(tinyInfo); + for(std::vector::const_iterator iter=_loc.begin();iter!=_loc.end();iter++) + (*iter).pushTinySerializationIntInfo(tinyInfo); } void MEDCouplingFieldDiscretizationGauss::getTinySerializationDbleInformation(std::vector& tinyInfo) const { - for(const auto & iter : _loc) - iter.pushTinySerializationDblInfo(tinyInfo); + for(std::vector::const_iterator iter=_loc.begin();iter!=_loc.end();iter++) + (*iter).pushTinySerializationDblInfo(tinyInfo); } void MEDCouplingFieldDiscretizationGauss::getSerializationIntArray(DataArrayIdType *& arr) const { - arr=nullptr; + arr=0; if(_discr_per_cell) arr=_discr_per_cell; } void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *& arr) { - mcIdType const val=tinyInfo[0]; + mcIdType val=tinyInfo[0]; if(val>=0) { _discr_per_cell=DataArrayIdType::New(); _discr_per_cell->alloc(val,1); } else - _discr_per_cell=nullptr; + _discr_per_cell=0; arr=_discr_per_cell; commonUnserialization(tinyInfo); } @@ -1652,7 +1642,7 @@ void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::ve void MEDCouplingFieldDiscretizationGauss::checkForUnserialization(const std::vector& tinyInfo, const DataArrayIdType *arr) { static const char MSG[]="MEDCouplingFieldDiscretizationGauss::checkForUnserialization : expect to have one not null DataArrayIdType !"; - mcIdType const val=tinyInfo[0]; + mcIdType val=tinyInfo[0]; if(val>=0) { if(!arr) @@ -1662,23 +1652,23 @@ void MEDCouplingFieldDiscretizationGauss::checkForUnserialization(const std::vec _discr_per_cell->incrRef(); } else - _discr_per_cell=nullptr; + _discr_per_cell=0; commonUnserialization(tinyInfo); } void MEDCouplingFieldDiscretizationGauss::finishUnserialization(const std::vector& tinyInfo) { - auto *tmp=new double[tinyInfo.size()]; + double *tmp=new double[tinyInfo.size()]; std::copy(tinyInfo.begin(),tinyInfo.end(),tmp); const double *work=tmp; - for(auto & iter : _loc) - work=iter.fillWithValues(work); + for(std::vector::iterator iter=_loc.begin();iter!=_loc.end();iter++) + work=(*iter).fillWithValues(work); delete [] tmp; } -double MEDCouplingFieldDiscretizationGauss::getIJK(const MEDCouplingMesh * /*mesh*/, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const +double MEDCouplingFieldDiscretizationGauss::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const { - mcIdType const offset=getOffsetOfCell(cellId); + mcIdType offset=getOffsetOfCell(cellId); return da->getIJ(offset+nodeIdInCell,compoId); } @@ -1687,10 +1677,10 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin if(!mesh || !da) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween : NULL input mesh or DataArray !"); MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da); - for(const auto & iter : _loc) - iter.checkConsistencyLight(); - mcIdType const nbOfDesc=ToIdType(_loc.size()); - mcIdType const nbOfCells=mesh->getNumberOfCells(); + for(std::vector::const_iterator iter=_loc.begin();iter!=_loc.end();iter++) + (*iter).checkConsistencyLight(); + mcIdType nbOfDesc=ToIdType(_loc.size()); + mcIdType nbOfCells=mesh->getNumberOfCells(); const mcIdType *dc=_discr_per_cell->getConstPointer(); for(mcIdType i=0;igetNumberOfTuples()) { std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " having " << da->getNumberOfTuples() << " !"; @@ -1718,7 +1708,7 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin } } -MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(const MEDCouplingMesh *mesh, bool /*isAbs*/) const +MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : mesh instance specified is NULL !"); @@ -1741,26 +1731,26 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con ret->setArray(arr); double *arrPtr=arr->getPointer(); const mcIdType *offsetPtr=offset->getConstPointer(); - mcIdType const maxGaussLoc=ToIdType(_loc.size()); + mcIdType maxGaussLoc=ToIdType(_loc.size()); std::vector locIds; std::vector ids=splitIntoSingleGaussDicrPerCellType(locIds); std::vector< MCAuto > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin()); for(std::size_t i=0;i=0 && locId const weights=new double[nbOfGaussPt]; - for(long const curId : *curIds) + mcIdType nbOfGaussPt=loc.getNumberOfGaussPt(); + INTERP_KERNEL::AutoPtr weights=new double[nbOfGaussPt]; + for(const mcIdType *cellId=curIds->begin();cellId!=curIds->end();cellId++) { std::vector conn; - umesh->getNodeIdsOfCell(curId,conn); + umesh->getNodeIdsOfCell(*cellId,conn); std::vector ptsInCell; ptsInCell.reserve(conn.size()*loc.getDimension()); std::for_each( conn.cbegin(), conn.cend(), [spaceDim,coordsOfMesh,&ptsInCell](mcIdType c) { ptsInCell.insert(ptsInCell.end(),coordsOfMesh+c*spaceDim,coordsOfMesh+(c+1)*spaceDim); } ); - std::size_t const nbPtsInCell(ptsInCell.size()/spaceDim); + std::size_t nbPtsInCell(ptsInCell.size()/spaceDim); INTERP_KERNEL::DenseMatrix jacobian(spaceDim,meshDim); MCAuto shapeFunc = loc.getDerivativeOfShapeFunctionValues(); for(mcIdType iGPt = 0 ; iGPt < nbOfGaussPt ; ++iGPt) @@ -1773,7 +1763,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con res += ptsInCell[spaceDim*k+i] * shapeFunc->getIJ(iGPt,meshDim*k+j); jacobian[ i ][ j ] = res; } - arrPtr[offsetPtr[curId]+iGPt]=std::abs( jacobian.toJacobian() )*loc.getWeight(FromIdType(iGPt)); + arrPtr[offsetPtr[*cellId]+iGPt]=std::abs( jacobian.toJacobian() )*loc.getWeight(FromIdType(iGPt)); } } } @@ -1787,17 +1777,17 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con return ret.retn(); } -void MEDCouplingFieldDiscretizationGauss::getValueOn(const DataArrayDouble * /*arr*/, const MEDCouplingMesh * /*mesh*/, const double * /*loc*/, double * /*res*/) const +void MEDCouplingFieldDiscretizationGauss::getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } -void MEDCouplingFieldDiscretizationGauss::getValueOnPos(const DataArrayDouble * /*arr*/, const MEDCouplingMesh * /*mesh*/, mcIdType /*i*/, mcIdType /*j*/, mcIdType /*k*/, double * /*res*/) const +void MEDCouplingFieldDiscretizationGauss::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const { throw INTERP_KERNEL::Exception("getValueOnPos(i,j,k) : Not applicable for Gauss points !"); } -DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getValueOnMulti(const DataArrayDouble * /*arr*/, const MEDCouplingMesh * /*mesh*/, const double * /*loc*/, mcIdType /*nbOfPoints*/) const +DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const { throw INTERP_KERNEL::Exception("getValueOnMulti : Not implemented yet for gauss points !"); } @@ -1830,18 +1820,18 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange(cons throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : NULL input mesh !"); if(!_discr_per_cell) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : no discretization array set !"); - di=nullptr; beginOut=0; endOut=0; stepOut=stepCellIds; + di=0; beginOut=0; endOut=0; stepOut=stepCellIds; const char msg[]="MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : cell #"; - mcIdType const nbOfTuples=_discr_per_cell->getNumberOfTuples(); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); const mcIdType *w=_discr_per_cell->begin(); - mcIdType const nbMaxOfLocId=ToIdType(_loc.size()); + mcIdType nbMaxOfLocId=ToIdType(_loc.size()); for(mcIdType i=0;i=0 && *w nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer - mcIdType const nbOfCells(mesh->getNumberOfCells()); + mcIdType nbOfCells(mesh->getNumberOfCells()); if(_discr_per_cell->getNumberOfTuples()!=nbOfCells) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : mismatch of nb of tuples of cell ids array and number of cells !"); nbOfNodesPerCell->computeOffsetsFull(); @@ -1885,12 +1875,12 @@ void MEDCouplingFieldDiscretizationGauss::renumberValuesOnNodes(double , const m { } -void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCells(double /*epsOnVals*/, const MEDCouplingMesh * /*mesh*/, const mcIdType * /*old2New*/, mcIdType /*newSz*/, DataArrayDouble * /*arr*/) const +void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } -void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCellsR(const MEDCouplingMesh * /*mesh*/, const mcIdType * /*new2old*/, mcIdType /*newSz*/, DataArrayDouble * /*arr*/) const +void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const { throw INTERP_KERNEL::Exception("Number of cells has changed and becomes higher with some cells that have been split ! Unable to conserve the Gauss field !"); } @@ -1904,7 +1894,7 @@ MCAuto MEDCouplingFieldDiscretizationGauss::aggr std::size_t i(0); for(auto it=fds.begin();it!=fds.end();++it,++i) { - const auto *itc(dynamic_cast(*it)); + const MEDCouplingFieldDiscretizationGauss *itc(dynamic_cast(*it)); if(!itc) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : same field discretization expected for all input discretizations !"); // @@ -1952,11 +1942,11 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType(const MEDCo throw INTERP_KERNEL::Exception(oss.str().c_str()); } buildDiscrPerCellIfNecessary(mesh); - mcIdType const id=ToIdType(_loc.size()); - MEDCouplingGaussLocalization const elt(type,refCoo,gsCoo,wg); + mcIdType id=ToIdType(_loc.size()); + MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg); _loc.push_back(elt); mcIdType *ptr=_discr_per_cell->getPointer(); - mcIdType const nbCells=mesh->getNumberOfCells(); + mcIdType nbCells=mesh->getNumberOfCells(); for(mcIdType i=0;igetTypeOfCell(i)==type) ptr[i]=id; @@ -1971,9 +1961,9 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDC buildDiscrPerCellIfNecessary(mesh); if(std::distance(begin,end)<1) throw INTERP_KERNEL::Exception("Size of [begin,end) must be equal or greater than 1 !"); - INTERP_KERNEL::NormalizedCellType const type=mesh->getTypeOfCell(*begin); - MEDCouplingGaussLocalization const elt(type,refCoo,gsCoo,wg); - mcIdType const id=ToIdType(_loc.size()); + INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(*begin); + MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg); + mcIdType id=ToIdType(_loc.size()); mcIdType *ptr=_discr_per_cell->getPointer(); for(const mcIdType *w=begin+1;w!=end;w++) { @@ -1996,7 +1986,7 @@ void MEDCouplingFieldDiscretizationGauss::clearGaussLocalizations() if(_discr_per_cell) { _discr_per_cell->decrRef(); - _discr_per_cell=nullptr; + _discr_per_cell=0; } _loc.clear(); } @@ -2005,8 +1995,8 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalization(mcIdType locId, c { if(locId<0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalization : localization id has to be >=0 !"); - mcIdType const sz=ToIdType(_loc.size()); - MEDCouplingGaussLocalization const gLoc(INTERP_KERNEL::NORM_ERROR); + mcIdType sz=ToIdType(_loc.size()); + MEDCouplingGaussLocalization gLoc(INTERP_KERNEL::NORM_ERROR); if(locId>=sz) _loc.resize(locId+1,gLoc); _loc[locId]=loc; @@ -2016,7 +2006,7 @@ void MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector(mcIdType newS { if(newSz<0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector : new size has to be >=0 !"); - MEDCouplingGaussLocalization const gLoc(INTERP_KERNEL::NORM_ERROR); + MEDCouplingGaussLocalization gLoc(INTERP_KERNEL::NORM_ERROR); _loc.resize(newSz,gLoc); } @@ -2035,7 +2025,7 @@ mcIdType MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneCell(mc { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("No Gauss localization still set !"); - mcIdType const locId=_discr_per_cell->begin()[cellId]; + mcIdType locId=_discr_per_cell->begin()[cellId]; if(locId<0) throw INTERP_KERNEL::Exception("No Gauss localization set for the specified cell !"); return locId; @@ -2043,7 +2033,7 @@ mcIdType MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneCell(mc mcIdType MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const { - std::set const ret=getGaussLocalizationIdsOfOneType(type); + std::set ret=getGaussLocalizationIdsOfOneType(type); if(ret.empty()) throw INTERP_KERNEL::Exception("No gauss discretization found for the specified type !"); if(ret.size()>1) @@ -2057,7 +2047,7 @@ std::set MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdsO throw INTERP_KERNEL::Exception("No Gauss localization still set !"); std::set ret; mcIdType id=0; - for(auto iter=_loc.begin();iter!=_loc.end();iter++,id++) + for(std::vector::const_iterator iter=_loc.begin();iter!=_loc.end();iter++,id++) if((*iter).getType()==type) ret.insert(id); return ret; @@ -2067,7 +2057,7 @@ void MEDCouplingFieldDiscretizationGauss::getCellIdsHavingGaussLocalization(mcId { if(locId<0 || locId>=ToIdType(_loc.size())) throw INTERP_KERNEL::Exception("Invalid locId given : must be in range [0:getNbOfGaussLocalization()) !"); - mcIdType const nbOfTuples=_discr_per_cell->getNumberOfTuples(); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); const mcIdType *ptr=_discr_per_cell->getConstPointer(); for(mcIdType i=0;igetNumberOfTuples(); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); MCAuto ret=DataArrayIdType::New(); const mcIdType *w=_discr_per_cell->begin(); ret->alloc(nbOfTuples,1); mcIdType *valsToFill=ret->getPointer(); - mcIdType const nbMaxOfLocId=ToIdType(_loc.size()); + mcIdType nbMaxOfLocId=ToIdType(_loc.size()); for(mcIdType i=0;ibegin(); - mcIdType const nbOfTuples=_discr_per_cell->getNumberOfTuples(); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); INTERP_KERNEL::AutoPtr tmp=new mcIdType[_loc.size()]; std::fill((mcIdType *)tmp,(mcIdType *)tmp+_loc.size(),-2); for(const mcIdType *w=start;w!=start+nbOfTuples;w++) @@ -2169,22 +2159,23 @@ void MEDCouplingFieldDiscretizationGauss::zipGaussLocalizations() void MEDCouplingFieldDiscretizationGauss::commonUnserialization(const std::vector& tinyInfo) { - mcIdType const nbOfLoc=tinyInfo[1]; + mcIdType nbOfLoc=tinyInfo[1]; _loc.clear(); - mcIdType const dim=tinyInfo[2]; + mcIdType dim=tinyInfo[2]; mcIdType delta=-1; if(nbOfLoc>0) delta=(ToIdType(tinyInfo.size())-3)/nbOfLoc; for(mcIdType i=0;i const tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta); - MEDCouplingGaussLocalization const elt=MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(dim,tmp); + std::vector tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta); + MEDCouplingGaussLocalization elt=MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(dim,tmp); _loc.push_back(elt); } } MEDCouplingFieldDiscretizationGaussNE::MEDCouplingFieldDiscretizationGaussNE() -= default; +{ +} TypeOfField MEDCouplingFieldDiscretizationGaussNE::getEnum() const { @@ -2211,15 +2202,15 @@ const char *MEDCouplingFieldDiscretizationGaussNE::getRepr() const return REPR; } -bool MEDCouplingFieldDiscretizationGaussNE::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const +bool MEDCouplingFieldDiscretizationGaussNE::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const { if(!other) { reason="other spatial discretization is NULL, and this spatial discretization (GaussNE) is defined."; return false; } - const auto *otherC=dynamic_cast(other); - bool const ret=otherC!=nullptr; + const MEDCouplingFieldDiscretizationGaussNE *otherC=dynamic_cast(other); + bool ret=otherC!=0; if(!ret) reason="Spatial discrtization of this is ON_GAUSS_NE, which is not the case of other."; return ret; @@ -2235,8 +2226,8 @@ mcIdType MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardi { if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : invalid input code !"); - mcIdType const nbOfSplit=ToIdType(idsPerType.size()); - mcIdType const nbOfTypes=ToIdType(code.size()/3); + mcIdType nbOfSplit=ToIdType(idsPerType.size()); + mcIdType nbOfTypes=ToIdType(code.size()/3); mcIdType ret(0); for(mcIdType i=0;i=nbOfSplit) @@ -2274,10 +2265,10 @@ mcIdType MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples(const MEDCoupl if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples : NULL input mesh !"); mcIdType ret=0; - mcIdType const nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); for(mcIdType i=0;igetTypeOfCell(i); + INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); if(cm.isDynamic()) throw INTERP_KERNEL::Exception("Not implemented yet Gauss node on elements for polygons and polyedrons !"); @@ -2297,14 +2288,14 @@ DataArrayIdType *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCo { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getOffsetArr : NULL input mesh !"); - mcIdType const nbOfTuples=mesh->getNumberOfCells(); + mcIdType nbOfTuples=mesh->getNumberOfCells(); DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(nbOfTuples+1,1); mcIdType *retPtr=ret->getPointer(); retPtr[0]=0; for(mcIdType i=0;igetTypeOfCell(i); + INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); if(cm.isDynamic()) throw INTERP_KERNEL::Exception("Not implemented yet Gauss node on elements for polygons and polyedrons !"); @@ -2321,29 +2312,29 @@ void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCoupl const mcIdType *array=old2NewBg; if(check) array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); - mcIdType const nbOfCells=mesh->getNumberOfCells(); - mcIdType const nbOfTuples=getNumberOfTuples(mesh); - auto *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace. - auto *array3=new mcIdType[nbOfCells];//store for each cell in after renumbering the offset needed by each cell in new numbering. + mcIdType nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfTuples=getNumberOfTuples(mesh); + mcIdType *array2=new mcIdType[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace. + mcIdType *array3=new mcIdType[nbOfCells];//store for each cell in after renumbering the offset needed by each cell in new numbering. array3[0]=0; for(mcIdType i=1;igetTypeOfCell(ToIdType(std::distance(array,std::find(array,array+nbOfCells,i-1)))); + INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(ToIdType(std::distance(array,std::find(array,array+nbOfCells,i-1)))); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); array3[i]=array3[i-1]+cm.getNumberOfNodes(); } mcIdType j=0; for(mcIdType i=0;igetTypeOfCell(i); + INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); for(mcIdType k=0;krenumberInPlace(array2); + for(std::vector::const_iterator it=arrays.begin();it!=arrays.end();it++) + if(*it) + (*it)->renumberInPlace(array2); delete [] array2; if(check) free(const_cast(array)); @@ -2355,13 +2346,13 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscVal throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues : NULL input mesh !"); MCAuto ret=DataArrayDouble::New(); MCAuto umesh=mesh->buildUnstructured();//in general do nothing - mcIdType const nbOfTuples=getNumberOfTuples(umesh); - int const spaceDim=mesh->getSpaceDimension(); + mcIdType nbOfTuples=getNumberOfTuples(umesh); + int spaceDim=mesh->getSpaceDimension(); ret->alloc(nbOfTuples,spaceDim); const double *coords=umesh->getCoords()->begin(); const mcIdType *connI=umesh->getNodalConnectivityIndex()->getConstPointer(); const mcIdType *conn=umesh->getNodalConnectivity()->getConstPointer(); - mcIdType const nbCells=umesh->getNumberOfCells(); + mcIdType nbCells=umesh->getNumberOfCells(); double *retPtr=ret->getPointer(); for(mcIdType i=0;igetNumberOfComponents(); + std::size_t nbOfCompo=arr->getNumberOfComponents(); std::fill(res,res+nbOfCompo,0.); // MCAuto vol=mesh->getMeasureField(isWAbs); - std::set const types=mesh->getAllGeoTypes(); + std::set types=mesh->getAllGeoTypes(); MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); nbOfNodesPerCell->computeOffsetsFull(); const double *arrPtr=arr->begin(),*volPtr=vol->getArray()->begin(); - for(auto type : types) + for(std::set::const_iterator it=types.begin();it!=types.end();it++) { std::size_t wArrSz=-1; - const double *wArr=GetWeightArrayFromGeometricType(type,wArrSz); + const double *wArr=GetWeightArrayFromGeometricType(*it,wArrSz); INTERP_KERNEL::AutoPtr wArr2=new double[wArrSz]; - double const sum=std::accumulate(wArr,wArr+wArrSz,0.); + double sum=std::accumulate(wArr,wArr+wArrSz,0.); std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind(std::multiplies(),std::placeholders::_1,1./sum)); - MCAuto ids=mesh->giveCellsWithType(type); + MCAuto ids=mesh->giveCellsWithType(*it); MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin(); - mcIdType const nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); + mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); for(mcIdType i=0;igetTypeOfCell(i); + INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); offset+=cm.getNumberOfNodes(); } @@ -2690,7 +2681,7 @@ double MEDCouplingFieldDiscretizationGaussNE::getIJK(const MEDCouplingMesh *mesh void MEDCouplingFieldDiscretizationGaussNE::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const { - mcIdType const nbOfTuples(getNumberOfTuples(mesh)); + mcIdType nbOfTuples(getNumberOfTuples(mesh)); if(nbOfTuples!=da->getNumberOfTuples()) { std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " !"; @@ -2707,24 +2698,24 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(c MCAuto ret=MEDCouplingFieldDouble::New(ON_GAUSS_NE); ret->setMesh(mesh); // - std::set const types=mesh->getAllGeoTypes(); + std::set types=mesh->getAllGeoTypes(); MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); - mcIdType const nbTuples=nbOfNodesPerCell->accumulate((std::size_t)0); + mcIdType nbTuples=nbOfNodesPerCell->accumulate((std::size_t)0); nbOfNodesPerCell->computeOffsetsFull(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbTuples,1); ret->setArray(arr); double *arrPtr=arr->getPointer(); - for(auto type : types) + for(std::set::const_iterator it=types.begin();it!=types.end();it++) { std::size_t wArrSz=-1; - const double *wArr=GetWeightArrayFromGeometricType(type,wArrSz); + const double *wArr=GetWeightArrayFromGeometricType(*it,wArrSz); INTERP_KERNEL::AutoPtr wArr2=new double[wArrSz]; - double const sum=std::accumulate(wArr,wArr+wArrSz,0.); + double sum=std::accumulate(wArr,wArr+wArrSz,0.); std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind(std::multiplies(),std::placeholders::_1,1./sum)); - MCAuto ids=mesh->giveCellsWithType(type); + MCAuto ids=mesh->giveCellsWithType(*it); MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin(); - mcIdType const nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); + mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); for(mcIdType i=0;igetNumberOfCells(); - di=nullptr; beginOut=0; endOut=0; stepOut=stepCellIds; + mcIdType nbOfCells=mesh->getNumberOfCells(); + di=0; beginOut=0; endOut=0; stepOut=stepCellIds; const char msg[]="MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : cell #"; for(mcIdType i=0;igetTypeOfCell(i); + INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); if(cm.isDynamic()) { std::ostringstream oss; oss << msg << i << " presence of dynamic cell (polygons and polyedrons) ! Not implemented !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType const delta=cm.getNumberOfNodes(); + mcIdType delta=cm.getNumberOfNodes(); if(i MEDCouplingFieldDiscretizationGaussNE::ag return EasyAggregate(fds); } -void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCellsR(const MEDCouplingMesh * /*mesh*/, const mcIdType * /*new2old*/, mcIdType /*newSz*/, DataArrayDouble * /*arr*/) const +void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } @@ -2839,8 +2830,9 @@ void MEDCouplingFieldDiscretizationGaussNE::reprQuickOverview(std::ostream& stre stream << "Gauss points on nodes per element spatial discretization."; } -MEDCouplingFieldDiscretizationGaussNE::MEDCouplingFieldDiscretizationGaussNE(const MEDCouplingFieldDiscretizationGaussNE& other) -= default; +MEDCouplingFieldDiscretizationGaussNE::MEDCouplingFieldDiscretizationGaussNE(const MEDCouplingFieldDiscretizationGaussNE& other):MEDCouplingFieldDiscretization(other) +{ +} TypeOfField MEDCouplingFieldDiscretizationKriging::getEnum() const { @@ -2873,21 +2865,21 @@ void MEDCouplingFieldDiscretizationKriging::checkCompatibilityWithNature(NatureO throw INTERP_KERNEL::Exception("Invalid nature for Kriging field : expected IntensiveMaximum !"); } -bool MEDCouplingFieldDiscretizationKriging::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const +bool MEDCouplingFieldDiscretizationKriging::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const { if(!other) { reason="other spatial discretization is NULL, and this spatial discretization (Kriginig) is defined."; return false; } - const auto *otherC=dynamic_cast(other); - bool const ret=otherC!=nullptr; + const MEDCouplingFieldDiscretizationKriging *otherC=dynamic_cast(other); + bool ret=otherC!=0; if(!ret) reason="Spatial discrtization of this is ON_NODES_KR, which is not the case of other."; return ret; } -MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationKriging::getMeasureField(const MEDCouplingMesh *mesh, bool /*isAbs*/) const +MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationKriging::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getMeasureField : mesh instance specified is NULL !"); @@ -2904,14 +2896,14 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::getValueOnMulti(const Da { if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !"); - mcIdType const nbOfRows=getNumberOfMeshPlaces(mesh); + mcIdType nbOfRows=getNumberOfMeshPlaces(mesh); if(arr->getNumberOfTuples()!=nbOfRows) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } mcIdType nbCols(-1); - std::size_t const nbCompo=arr->getNumberOfComponents(); + std::size_t nbCompo=arr->getNumberOfComponents(); MCAuto m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols)); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTargetPoints,nbCompo); @@ -2940,8 +2932,8 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixO MCAuto matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); // MCAuto coords=getLocalizationOfDiscValues(mesh); - mcIdType const nbOfPts(coords->getNumberOfTuples()); - std::size_t const dimension(coords->getNumberOfComponents()); + mcIdType nbOfPts(coords->getNumberOfTuples()); + std::size_t dimension(coords->getNumberOfComponents()); MCAuto locArr=DataArrayDouble::New(); locArr->useArray(loc,false,DeallocType::CPP_DEALLOC,nbOfTargetPoints,dimension); nbCols=nbOfPts; @@ -3000,7 +2992,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDC if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeMatrix : NULL input mesh !"); MCAuto coords(getLocalizationOfDiscValues(mesh)); - mcIdType const nbOfPts(coords->getNumberOfTuples()); + mcIdType nbOfPts(coords->getNumberOfTuples()); MCAuto matrix(coords->buildEuclidianDistanceDenseMatrix()); operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfPts*nbOfPts,matrix->getPointer()); // Drift @@ -3065,7 +3057,7 @@ void MEDCouplingFieldDiscretizationKriging::OperateOnDenseMatrixH3(mcIdType nbOf { for(mcIdType i=0;iisAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input array of coordiantes ! Must be allocated and not NULL !"); - std::size_t const spaceDimension(arr->getNumberOfComponents()); + std::size_t spaceDimension(arr->getNumberOfComponents()); mcIdType nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples()); delta=ToIdType(spaceDimension)+1; - mcIdType const nbOfCols(nbOfEltInMatrx/nbOfPts); + mcIdType nbOfCols(nbOfEltInMatrx/nbOfPts); if(nbOfEltInMatrx%nbOfPts!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : size of input dense matrix and input arrays mismatch ! NbOfElems in matrix % nb of tuples in array must be equal to 0 !"); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfPts*(nbOfCols+delta)); @@ -3142,9 +3134,9 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec(const */ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, mcIdType& delta) const { - std::size_t const spaceDimension(arr->getNumberOfComponents()); + std::size_t spaceDimension(arr->getNumberOfComponents()); delta=ToIdType(spaceDimension)+1; - mcIdType const szOfMatrix(arr->getNumberOfTuples()); + mcIdType szOfMatrix(arr->getNumberOfTuples()); if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size"); MCAuto ret=DataArrayDouble::New(); diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx index 5f644d24a..c15020adb 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx @@ -21,20 +21,15 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGFIELDDISCRETIZATION_HXX__ #define __PARAMEDMEM_MEDCOUPLINGFIELDDISCRETIZATION_HXX__ -#include "MCType.hxx" #include "MEDCoupling.hxx" -#include "MEDCouplingNatureOfFieldEnum" #include "MEDCouplingRefCountObject.hxx" #include "InterpKernelException.hxx" #include "MEDCouplingTimeLabel.hxx" +#include "MEDCouplingNatureOfField.hxx" #include "MEDCouplingGaussLocalization.hxx" #include "MCAuto.hxx" -#include "NormalizedGeometricTypes" -#include -#include #include -#include #include namespace MEDCoupling @@ -51,9 +46,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingFieldDiscretization *New(TypeOfField type); MEDCOUPLING_EXPORT double getPrecision() const { return _precision; } MEDCOUPLING_EXPORT void setPrecision(double val) { _precision=val; } - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT static TypeOfField GetTypeOfFieldFromStringRepr(const std::string& repr); MEDCOUPLING_EXPORT static std::string GetTypeOfFieldRepr(TypeOfField type); MEDCOUPLING_EXPORT virtual TypeOfField getEnum() const = 0; @@ -112,7 +107,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector& cellIds) const; MEDCOUPLING_EXPORT virtual const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const; MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0; - MEDCOUPLING_EXPORT ~MEDCouplingFieldDiscretization() override; + MEDCOUPLING_EXPORT virtual ~MEDCouplingFieldDiscretization(); protected: MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization(); MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const mcIdType *old2NewPtr, mcIdType newNbOfEntity, DataArrayDouble *arr, const std::string& msg); @@ -127,35 +122,35 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationP0 : public MEDCouplingFieldDiscretization { public: - MEDCOUPLING_EXPORT TypeOfField getEnum() const override; + MEDCOUPLING_EXPORT TypeOfField getEnum() const; MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationP0"); } MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override; - MEDCOUPLING_EXPORT std::string getStringRepr() const override; - MEDCOUPLING_EXPORT const char *getRepr() const override; + MEDCOUPLING_EXPORT std::string getStringRepr() const; + MEDCOUPLING_EXPORT const char *getRepr() const; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const override; - MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const override; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; + MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const; MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector& arrays, - const mcIdType *old2NewBg, bool check) override; - MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const override; + const mcIdType *old2NewBg, bool check); + MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const; MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override; MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, - DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const override; - MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override; + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const; + MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override; - MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const override; + MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const; MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override; - MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const override; - MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const override; - MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const override; + MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const; MEDCOUPLING_EXPORT MCAuto aggregate(std::vector& fds) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const; + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; public: static const char REPR[]; static constexpr TypeOfField TYPE = ON_CELLS; @@ -164,40 +159,40 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationOnNodes : public MEDCouplingFieldDiscretization { public: - MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const override; - MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const override; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; + MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const; MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector& arrays, - const mcIdType *old2NewBg, bool check) override; - MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const override; + const mcIdType *old2NewBg, bool check); + MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const; MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, - DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const override; - MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const override; - MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const override; - MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const override; - MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const override; + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const; + MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const; + MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const; public: - MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const override; + MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const; }; class MEDCouplingFieldDiscretizationP1 : public MEDCouplingFieldDiscretizationOnNodes { public: - MEDCOUPLING_EXPORT TypeOfField getEnum() const override; + MEDCOUPLING_EXPORT TypeOfField getEnum() const; MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationP1"); } MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override; - MEDCOUPLING_EXPORT std::string getStringRepr() const override; - MEDCOUPLING_EXPORT const char *getRepr() const override; + MEDCOUPLING_EXPORT std::string getStringRepr() const; + MEDCOUPLING_EXPORT const char *getRepr() const; MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override; MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT MCAuto aggregate(std::vector& fds) const override; public: static const char REPR[]; @@ -222,14 +217,14 @@ namespace MEDCoupling MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds); MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds); MEDCouplingFieldDiscretizationPerCell(DataArrayIdType *dpc); - ~MEDCouplingFieldDiscretizationPerCell() override; - void updateTime() const override; - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; - void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override; + ~MEDCouplingFieldDiscretizationPerCell(); + void updateTime() const; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; + void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const; bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override; - bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const override; - void renumberCells(const mcIdType *old2NewBg, bool check) override; + bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const; + void renumberCells(const mcIdType *old2NewBg, bool check); protected: void buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh); protected: @@ -241,63 +236,63 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationGauss(); - MEDCOUPLING_EXPORT TypeOfField getEnum() const override; + MEDCOUPLING_EXPORT TypeOfField getEnum() const; MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationGauss"); } MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const override; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const; MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const override; - MEDCOUPLING_EXPORT std::string getStringRepr() const override; - MEDCOUPLING_EXPORT const char *getRepr() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const override; - MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const override; + MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const; + MEDCOUPLING_EXPORT std::string getStringRepr() const; + MEDCOUPLING_EXPORT const char *getRepr() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; + MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const; MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector& arrays, - const mcIdType *old2NewBg, bool check) override; - MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const override; + const mcIdType *old2NewBg, bool check); + MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const; MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, - DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const override; + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const; MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfo) override; - MEDCOUPLING_EXPORT void getSerializationIntArray(DataArrayIdType *& arr) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *& arr) override; - MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfo, const DataArrayIdType *arr) override; - MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const override; - MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfo); + MEDCOUPLING_EXPORT void getSerializationIntArray(DataArrayIdType *& arr) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *& arr); + MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfo, const DataArrayIdType *arr); + MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const; + MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override; - MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const override; + MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const; MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const override; - MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const override; - MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const override; - MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const override; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const; + MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const; MEDCOUPLING_EXPORT MCAuto aggregate(std::vector& fds) const override; MEDCOUPLING_EXPORT void setGaussLocalizationOnType(const MEDCouplingMesh *mesh, INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, - const std::vector& gsCoo, const std::vector& wg) override; + const std::vector& gsCoo, const std::vector& wg); MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, - const std::vector& gsCoo, const std::vector& wg) override; - MEDCOUPLING_EXPORT void clearGaussLocalizations() override; + const std::vector& gsCoo, const std::vector& wg); + MEDCOUPLING_EXPORT void clearGaussLocalizations(); MEDCOUPLING_EXPORT void setGaussLocalization(mcIdType locId, const MEDCouplingGaussLocalization& loc); MEDCOUPLING_EXPORT void resizeLocalizationVector(mcIdType newSz); - MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) override; - MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const override; - MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const override; - MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT std::set getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector& cellIds) const override; - MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const override; + MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId); + MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const; + MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT std::set getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(mcIdType locId, std::vector& cellIds) const; + MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const; MEDCOUPLING_EXPORT DataArrayIdType *buildNbOfGaussPointPerCellField() const; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; protected: - MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const mcIdType *startCellIds=nullptr, const mcIdType *endCellIds=nullptr); + MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const mcIdType *startCellIds=0, const mcIdType *endCellIds=0); MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds); MEDCouplingFieldDiscretizationGauss(DataArrayIdType *dpc, const std::vector& loc):MEDCouplingFieldDiscretizationPerCell(dpc),_loc(loc) { } void zipGaussLocalizations(); @@ -318,37 +313,37 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationGaussNE(); - MEDCOUPLING_EXPORT TypeOfField getEnum() const override; + MEDCOUPLING_EXPORT TypeOfField getEnum() const; MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationGaussNE"); } MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override; - MEDCOUPLING_EXPORT std::string getStringRepr() const override; - MEDCOUPLING_EXPORT const char *getRepr() const override; + MEDCOUPLING_EXPORT std::string getStringRepr() const; + MEDCOUPLING_EXPORT const char *getRepr() const; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const override; - MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const override; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; + MEDCOUPLING_EXPORT DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const; MEDCOUPLING_EXPORT void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector& arrays, - const mcIdType *old2NewBg, bool check) override; - MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const override; - MEDCOUPLING_EXPORT void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const override; + const mcIdType *old2NewBg, bool check); + MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const; + MEDCOUPLING_EXPORT void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const; MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, - DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const override; + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const; MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override; - MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const override; - MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const override; + MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const; + MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override; - MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const override; + MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const; MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const override; - MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const override; - MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const override; - MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const override; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const; + MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const; MEDCOUPLING_EXPORT MCAuto aggregate(std::vector& fds) const override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT static const double *GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth); MEDCOUPLING_EXPORT static const double *GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth); MEDCOUPLING_EXPORT static const double *GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth); @@ -420,17 +415,17 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationKriging : public MEDCouplingFieldDiscretizationOnNodes { public: - MEDCOUPLING_EXPORT TypeOfField getEnum() const override; + MEDCOUPLING_EXPORT TypeOfField getEnum() const; MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldDiscretizationKriging"); } - MEDCOUPLING_EXPORT const char *getRepr() const override; + MEDCOUPLING_EXPORT const char *getRepr() const; MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const override; - MEDCOUPLING_EXPORT std::string getStringRepr() const override; + MEDCOUPLING_EXPORT std::string getStringRepr() const; MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const override; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const override; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const override; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const override; MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT MCAuto aggregate(std::vector& fds) const override; public://specific part MEDCOUPLING_EXPORT DataArrayDouble *computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfTargetPoints, mcIdType& nbCols) const; diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretizationOnNodesFE.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretizationOnNodesFE.cxx old mode 100644 new mode 100755 index 89fbd91cd..d56bc6d56 --- a/src/MEDCoupling/MEDCouplingFieldDiscretizationOnNodesFE.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretizationOnNodesFE.cxx @@ -19,30 +19,14 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingFieldDiscretizationOnNodesFE.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingGaussLocalization.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCType.hxx" #include "MEDCouplingNormalizedUnstructuredMesh.txx" -#include "BBTreeStandAlone.txx" -#include "InterpKernelException.hxx" #include "InterpKernelDenseMatrix.hxx" #include "InterpKernelRootsMultiDim.hxx" #include "MEDCouplingUMesh.hxx" -#include "InterpKernelGaussCoords.hxx" -#include "NormalizedGeometricTypes" #include "InterpolationHelper.txx" +#include "InterpKernelGaussCoords.hxx" -#include -#include -#include -#include -#include -#include -#include +#include using namespace MEDCoupling; @@ -63,15 +47,15 @@ MCAuto MEDCouplingFieldDiscretizationOnNodesFE:: return EasyAggregate(fds); } -bool MEDCouplingFieldDiscretizationOnNodesFE::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double /*eps*/, std::string& reason) const +bool MEDCouplingFieldDiscretizationOnNodesFE::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const { if(!other) { reason="other spatial discretization is NULL, and this spatial discretization (Node FE) is defined."; return false; } - const auto *otherC=dynamic_cast(other); - bool const ret=otherC!=nullptr; + const MEDCouplingFieldDiscretizationOnNodesFE *otherC=dynamic_cast(other); + bool ret=otherC!=0; if(!ret) reason="Spatial discrtization of this is ON_NODES_FE, which is not the case of other."; return ret; @@ -93,7 +77,7 @@ void MEDCouplingFieldDiscretizationOnNodesFE::checkCompatibilityWithNature(Natur throw INTERP_KERNEL::Exception("Invalid nature for NodeFE field : expected IntensiveMaximum !"); } -MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationOnNodesFE::getMeasureField(const MEDCouplingMesh *mesh, bool /*isAbs*/) const +MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationOnNodesFE::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodesFE::getMeasureField : mesh instance specified is NULL !"); @@ -112,7 +96,7 @@ public: _pts_in_cell(ptsInCell),_point(point) { } std::vector operator()(const std::vector& x) { - MEDCouplingGaussLocalization const gl(_gl->getType(),_gl->getRefCoords(),x,{1.0}); + MEDCouplingGaussLocalization gl(_gl->getType(),_gl->getRefCoords(),x,{1.0}); MCAuto shapeFunc = gl.getShapeFunctionValues(); const double *shapeFuncPtr( shapeFunc->begin() ); std::vector ret(3,0); @@ -129,15 +113,15 @@ public: bool IsInside3D(const MEDCouplingGaussLocalization& gl, const std::vector& ptsInCell, const double locInReal[3], double locInRef[3]) { constexpr double EPS_IN_OUT = 1e-12; - std::size_t const nbPtsInCell(ptsInCell.size()/3); + std::size_t nbPtsInCell(ptsInCell.size()/3); bool ret(false); const double *refCoo(gl.getRefCoords().data()); - INTERP_KERNEL::NormalizedCellType const ct(gl.getType()); + INTERP_KERNEL::NormalizedCellType ct(gl.getType()); Functor func(gl,nbPtsInCell,ptsInCell.data(),locInReal); auto myJacobian = [&gl,nbPtsInCell,ptsInCell](const std::vector& x, const std::vector&, INTERP_KERNEL::DenseMatrix& jacobian) { - MEDCouplingGaussLocalization const mygl(gl.getType(),gl.getRefCoords(),x,{1.0}); + MEDCouplingGaussLocalization mygl(gl.getType(),gl.getRefCoords(),x,{1.0}); MCAuto shapeFunc = mygl.getDerivativeOfShapeFunctionValues(); for(std::size_t i = 0 ; i < 3 ; ++i) for(std::size_t j = 0 ; j < 3 ; ++j) @@ -189,8 +173,8 @@ void MEDCouplingFieldDiscretizationOnNodesFE::GetRefCoordOfListOf3DPtsIn3D(const std::function&)> customFunc) { const double *coordsOfMesh( umesh->getCoords()->begin() ); - MEDCouplingNormalizedUnstructuredMesh<3,3> const mesh_wrapper(umesh); - BBTreeStandAlone<3,mcIdType> tree( (INTERP_KERNEL::BuildBBTree( mesh_wrapper )) ); + MEDCouplingNormalizedUnstructuredMesh<3,3> mesh_wrapper(umesh); + BBTreeStandAlone<3,mcIdType> tree( INTERP_KERNEL::BuildBBTree( mesh_wrapper ) ); for(mcIdType iPt = 0 ; iPt < nbOfPts ; ++iPt) { std::vector elems; @@ -198,11 +182,11 @@ void MEDCouplingFieldDiscretizationOnNodesFE::GetRefCoordOfListOf3DPtsIn3D(const bool found(false); for(auto cellId = elems.cbegin() ; cellId != elems.cend() && !found ; ++cellId) { - INTERP_KERNEL::NormalizedCellType const gt( umesh->getTypeOfCell(*cellId) ); + INTERP_KERNEL::NormalizedCellType gt( umesh->getTypeOfCell(*cellId) ); std::vector conn; umesh->getNodeIdsOfCell(*cellId,conn); MCAuto refCoo( MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf(gt) ); - std::vector const refCooCpp(refCoo->begin(),refCoo->end()); + std::vector refCooCpp(refCoo->begin(),refCoo->end()); std::vector gsCoo(ptsCoo + iPt*3,ptsCoo + (iPt+1)*3); MEDCouplingGaussLocalization gl(gt,refCooCpp,{0,0,0},{1.}); std::vector ptsInCell; ptsInCell.reserve(conn.size()*gl.getDimension()); @@ -222,7 +206,7 @@ void MEDCouplingFieldDiscretizationOnNodesFE::GetRefCoordOfListOf3DPtsIn3D(const const MEDCouplingUMesh *MEDCouplingFieldDiscretizationOnNodesFE::checkConfig3D(const MEDCouplingMesh *mesh) const { - const auto *umesh( dynamic_cast(mesh) ); + const MEDCouplingUMesh *umesh( dynamic_cast(mesh) ); if( !umesh ) THROW_IK_EXCEPTION("getValueOn : not implemented yet for type != MEDCouplingUMesh !"); if(umesh->getSpaceDimension() != 3 || umesh->getMeshDimension() != 3) @@ -235,13 +219,13 @@ DataArrayDouble *MEDCouplingFieldDiscretizationOnNodesFE::getValueOnMulti(const { if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("getValueOnMulti : input array is null or not allocated !"); - mcIdType const nbOfRows=getNumberOfMeshPlaces(mesh); + mcIdType nbOfRows=getNumberOfMeshPlaces(mesh); if(arr->getNumberOfTuples()!=nbOfRows) { THROW_IK_EXCEPTION( "getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !") } const MEDCouplingUMesh *umesh = checkConfig3D(mesh); - std::size_t const nbCompo( arr->getNumberOfComponents() ); + std::size_t nbCompo( arr->getNumberOfComponents() ); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTargetPoints,nbCompo); double *res( ret->getPointer() ); @@ -276,7 +260,7 @@ MCAuto MEDCouplingFieldDiscretizationOnNodesFE::getCooInRefElem ret->alloc(nbOfPoints,3); double *retPtr(ret->getPointer() ); - auto arrayFeeder = [&retPtr](const MEDCouplingGaussLocalization& gl, const std::vector& /*conn*/) + auto arrayFeeder = [&retPtr](const MEDCouplingGaussLocalization& gl, const std::vector& conn) { std::vector resVector( gl.getGaussCoords() ); { diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretizationOnNodesFE.hxx b/src/MEDCoupling/MEDCouplingFieldDiscretizationOnNodesFE.hxx index 276be7c69..2fe400268 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretizationOnNodesFE.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretizationOnNodesFE.hxx @@ -20,18 +20,9 @@ #pragma once -#include "MEDCoupling.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" #include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingGaussLocalization.hxx" #include -#include -#include -#include namespace MEDCoupling { diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx old mode 100644 new mode 100755 index 18f246d45..c9bbb950f --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -19,40 +19,26 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingFieldT.txx" -#include "MCAuto.hxx" -#include "MCType.hxx" -#include "MEDCouplingField.hxx" -#include "MCIdType.hxx" -#include "CellModel.hxx" #include "MEDCouplingFieldTemplate.hxx" +#include "MEDCouplingFieldT.txx" #include "MEDCouplingFieldInt32.hxx" #include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingFieldFloat.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingPointSet.hxx" -#include "MEDCouplingTraits.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingGaussLocalization.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingTimeDiscretization.hxx" #include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingVoronoi.hxx" #include "MCAuto.txx" +#include "MEDCouplingVoronoi.hxx" +#include "MEDCouplingNatureOfField.hxx" +#include "MEDCouplingMemArray.txx" #include "InterpKernelAutoPtr.hxx" #include "InterpKernelGaussCoords.hxx" -#include "NormalizedGeometricTypes" -#include -#include #include #include #include #include -#include -#include using namespace MEDCoupling; @@ -220,20 +206,20 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfT MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const { checkConsistencyLight(); - TypeOfField const tf(getTypeOfField()); + TypeOfField tf(getTypeOfField()); if(tf!=ON_NODES) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::nodeToCellDiscretization : this field is expected to be on ON_NODES !"); MCAuto ret(clone(false)); MCAuto nsp(new MEDCouplingFieldDiscretizationP0); ret->setDiscretization(nsp); const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call - mcIdType const nbCells=ToIdType(m->getNumberOfCells()); + mcIdType nbCells=ToIdType(m->getNumberOfCells()); std::vector arrs(getArrays()); - std::size_t const sz(arrs.size()); + std::size_t sz(arrs.size()); std::vector< MCAuto > outArrsSafe(sz); std::vector outArrs(sz); for(std::size_t j=0;jgetNumberOfComponents()); + std::size_t nbCompo(arrs[j]->getNumberOfComponents()); outArrsSafe[j]=DataArrayDouble::New(); outArrsSafe[j]->alloc(nbCells,nbCompo); outArrsSafe[j]->copyStringInfoFrom(*arrs[j]); outArrs[j]=outArrsSafe[j]; @@ -244,7 +230,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const std::vector nodeIds; m->getNodeIdsOfCell(i,nodeIds); std::fill(pt,pt+nbCompo,0.); - std::size_t const nbNodesInCell(nodeIds.size()); + std::size_t nbNodesInCell(nodeIds.size()); for(std::size_t k=0;k()); if(nbNodesInCell!=0) @@ -276,7 +262,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const MEDCouplingFieldDouble *MEDCouplingFieldDouble::cellToNodeDiscretization() const { checkConsistencyLight(); - TypeOfField const tf(getTypeOfField()); + TypeOfField tf(getTypeOfField()); if(tf!=ON_CELLS) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::cellToNodeDiscretization : this field is expected to be on ON_CELLS !"); MCAuto ret(clone(false)); @@ -286,14 +272,14 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::cellToNodeDiscretization() const MCAuto rn(DataArrayIdType::New()),rni(DataArrayIdType::New()); m->getReverseNodalConnectivity(rn,rni); MCAuto rni2(rni->deltaShiftIndex()); - MCAuto rni3(rni2->convertToDblArr()); rni2=nullptr; + MCAuto rni3(rni2->convertToDblArr()); rni2=0; std::vector arrs(getArrays()); - std::size_t const sz(arrs.size()); + std::size_t sz(arrs.size()); std::vector< MCAuto > outArrsSafe(sz); std::vector outArrs(sz); for(std::size_t j=0;j tmp(arrs[j]->selectByTupleIdSafe(rn->begin(),rn->end())); - outArrsSafe[j]=(tmp->accumulatePerChunck(rni->begin(),rni->end())); tmp=nullptr; + outArrsSafe[j]=(tmp->accumulatePerChunck(rni->begin(),rni->end())); tmp=0; outArrsSafe[j]->divideEqual(rni3); outArrsSafe[j]->copyStringInfoFrom(*arrs[j]); outArrs[j]=outArrsSafe[j]; @@ -350,7 +336,7 @@ std::string MEDCouplingFieldDouble::advancedRepr() const std::string MEDCouplingFieldDouble::writeVTK(const std::string& fileName, bool isBinary) const { - std::vector const fs(1,this); + std::vector fs(1,this); return MEDCouplingFieldDouble::WriteVTK(fileName,fs,isBinary); } @@ -363,7 +349,7 @@ bool MEDCouplingFieldDouble::areCompatibleForMerge(const MEDCouplingField *other { if(!MEDCouplingField::areCompatibleForMerge(other)) return false; - const auto *otherC(dynamic_cast(other)); + const MEDCouplingFieldDouble *otherC(dynamic_cast(other)); if(!otherC) return false; if(!timeDiscr()->areCompatible(otherC->timeDiscr())) @@ -405,12 +391,12 @@ bool MEDCouplingFieldDouble::areCompatibleForMeld(const MEDCouplingFieldDouble * */ void MEDCouplingFieldDouble::renumberNodes(const mcIdType *old2NewBg, double eps) { - const auto *meshC=dynamic_cast(_mesh); + const MEDCouplingPointSet *meshC=dynamic_cast(_mesh); if(!meshC) throw INTERP_KERNEL::Exception("Invalid mesh to apply renumberNodes on it !"); - mcIdType const nbOfNodes=meshC->getNumberOfNodes(); + mcIdType nbOfNodes=meshC->getNumberOfNodes(); MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); - mcIdType const newNbOfNodes=*std::max_element(old2NewBg,old2NewBg+nbOfNodes)+1; + mcIdType newNbOfNodes=*std::max_element(old2NewBg,old2NewBg+nbOfNodes)+1; renumberNodesWithoutMesh(old2NewBg,newNbOfNodes,eps); meshC2->renumberNodes(old2NewBg,newNbOfNodes); setMesh(meshC2); @@ -444,9 +430,9 @@ void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const mcIdType *old2NewBg, throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !"); std::vector arrays; timeDiscr()->getArrays(arrays); - for(auto array : arrays) - if(array) - _type->renumberValuesOnNodes(eps,old2NewBg,newNbOfNodes,array); + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) + if(*iter) + _type->renumberValuesOnNodes(eps,old2NewBg,newNbOfNodes,*iter); } /*! @@ -464,7 +450,7 @@ void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const mcIdType *old2NewBg, */ DataArrayIdType *MEDCouplingFieldDouble::findIdsInRange(double vmin, double vmax) const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::findIdsInRange : no default array set !"); return getArray()->findIdsInRange(vmin,vmax); } @@ -474,7 +460,7 @@ typename Traits::FieldType *ConvertToUField(const MEDCouplingFieldDouble *sel { MCAuto tmp(MEDCouplingFieldTemplate::New(*self)); int t1,t2; - double const t0(self->getTime(t1,t2)); + double t0(self->getTime(t1,t2)); MCAuto::FieldType > ret(Traits::FieldType::New(*tmp,self->getTimeDiscretization())); ret->setTime(t0,t1,t2); if(self->getArray()) @@ -527,7 +513,7 @@ MEDCouplingFieldDouble::MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeD */ double MEDCouplingFieldDouble::accumulate(int compId) const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::accumulate : no default array defined !"); return getArray()->accumulate(compId); } @@ -541,7 +527,7 @@ double MEDCouplingFieldDouble::accumulate(int compId) const */ void MEDCouplingFieldDouble::accumulate(double *res) const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::accumulate : no default array defined !"); getArray()->accumulate(res); } @@ -560,13 +546,13 @@ double MEDCouplingFieldDouble::getMaxValue() const timeDiscr()->getArrays(arrays); double ret(-std::numeric_limits::max()); bool isExistingArr=false; - for(auto array : arrays) + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { - if(array) + if(*iter) { isExistingArr=true; mcIdType loc; - ret=std::max(ret,array->getMaxValue(loc)); + ret=std::max(ret,(*iter)->getMaxValue(loc)); } } if(!isExistingArr) @@ -590,16 +576,16 @@ double MEDCouplingFieldDouble::getMaxValue2(DataArrayIdType*& tupleIds) const timeDiscr()->getArrays(arrays); double ret(-std::numeric_limits::max()); bool isExistingArr=false; - tupleIds=nullptr; + tupleIds=0; MCAuto ret1; - for(auto array : arrays) + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { - if(array) + if(*iter) { isExistingArr=true; DataArrayIdType *tmp; - ret=std::max(ret,array->getMaxValue2(tmp)); - MCAuto const tmpSafe(tmp); + ret=std::max(ret,(*iter)->getMaxValue2(tmp)); + MCAuto tmpSafe(tmp); if(!((const DataArrayIdType *)ret1)) ret1=tmpSafe; } @@ -624,13 +610,13 @@ double MEDCouplingFieldDouble::getMinValue() const timeDiscr()->getArrays(arrays); double ret(std::numeric_limits::max()); bool isExistingArr=false; - for(auto array : arrays) + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { - if(array) + if(*iter) { isExistingArr=true; mcIdType loc; - ret=std::min(ret,array->getMinValue(loc)); + ret=std::min(ret,(*iter)->getMinValue(loc)); } } if(!isExistingArr) @@ -654,16 +640,16 @@ double MEDCouplingFieldDouble::getMinValue2(DataArrayIdType*& tupleIds) const timeDiscr()->getArrays(arrays); double ret(-std::numeric_limits::max()); bool isExistingArr=false; - tupleIds=nullptr; + tupleIds=0; MCAuto ret1; - for(auto array : arrays) + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { - if(array) + if(*iter) { isExistingArr=true; DataArrayIdType *tmp; - ret=std::max(ret,array->getMinValue2(tmp)); - MCAuto const tmpSafe(tmp); + ret=std::max(ret,(*iter)->getMinValue2(tmp)); + MCAuto tmpSafe(tmp); if(!((const DataArrayIdType *)ret1)) ret1=tmpSafe; } @@ -682,7 +668,7 @@ double MEDCouplingFieldDouble::getMinValue2(DataArrayIdType*& tupleIds) const */ double MEDCouplingFieldDouble::getAverageValue() const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getAverageValue : no default array defined !"); return getArray()->getAverageValue(); } @@ -696,7 +682,7 @@ double MEDCouplingFieldDouble::getAverageValue() const */ double MEDCouplingFieldDouble::norm2() const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::norm2 : no default array defined !"); return getArray()->norm2(); } @@ -716,14 +702,14 @@ double MEDCouplingFieldDouble::norm2() const */ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getWeightedAverageValue : no default array defined !"); MCAuto w=buildMeasureField(isWAbs); - double const deno=w->getArray()->accumulate((std::size_t)0); + double deno=w->getArray()->accumulate((std::size_t)0); MCAuto arr=getArray()->deepCopy(); arr->multiplyEqual(w->getArray()); arr->accumulate(res); - std::size_t const nCompo = getArray()->getNumberOfComponents(); + std::size_t nCompo = getArray()->getNumberOfComponents(); std::transform(res,res+nCompo,res,std::bind(std::multiplies(),std::placeholders::_1,1./deno)); } @@ -742,7 +728,7 @@ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) c */ double MEDCouplingFieldDouble::getWeightedAverageValue(int compId, bool isWAbs) const { - std::size_t const nbComps=getArray()->getNumberOfComponents(); + std::size_t nbComps=getArray()->getNumberOfComponents(); if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::getWeightedAverageValue : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -770,7 +756,7 @@ double MEDCouplingFieldDouble::normL1(int compId) const throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL1 !"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL1 !"); - std::size_t const nbComps=getArray()->getNumberOfComponents(); + std::size_t nbComps=getArray()->getNumberOfComponents(); if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL1 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -817,7 +803,7 @@ double MEDCouplingFieldDouble::normL2(int compId) const throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL2"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL2 !"); - std::size_t const nbComps=getArray()->getNumberOfComponents(); + std::size_t nbComps=getArray()->getNumberOfComponents(); if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL2 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -859,9 +845,9 @@ void MEDCouplingFieldDouble::normL2(double *res) const */ double MEDCouplingFieldDouble::normMax(int compId) const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !"); - std::size_t const nbComps=getArray()->getNumberOfComponents(); + std::size_t nbComps=getArray()->getNumberOfComponents(); if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normMax : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -884,7 +870,7 @@ double MEDCouplingFieldDouble::normMax(int compId) const */ void MEDCouplingFieldDouble::normMax(double *res) const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !"); getArray()->normMaxPerComponent(res); } @@ -909,7 +895,7 @@ double MEDCouplingFieldDouble::integral(int compId, bool isWAbs) const throw INTERP_KERNEL::Exception("No mesh underlying this field to perform integral"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform integral !"); - std::size_t const nbComps=getArray()->getNumberOfComponents(); + std::size_t nbComps=getArray()->getNumberOfComponents(); if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::integral : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -1044,17 +1030,17 @@ DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, */ void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, double *res) const { - std::vector< const DataArrayDouble *> const arrs=timeDiscr()->getArraysForTime(time); + std::vector< const DataArrayDouble *> arrs=timeDiscr()->getArraysForTime(time); if(!_mesh) throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOn"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getValueOn !"); std::vector res2; - for(auto arr : arrs) + for(std::vector< const DataArrayDouble *>::const_iterator iter=arrs.begin();iter!=arrs.end();iter++) { - std::size_t const sz=res2.size(); - res2.resize(sz+arr->getNumberOfComponents()); - _type->getValueOn(arr,_mesh,spaceLoc,&res2[sz]); + std::size_t sz=res2.size(); + res2.resize(sz+(*iter)->getNumberOfComponents()); + _type->getValueOn(*iter,_mesh,spaceLoc,&res2[sz]); } timeDiscr()->getValueForTime(time,res2,res); } @@ -1095,7 +1081,7 @@ MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator=(double value) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::operator= : no mesh defined !"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform operator = !"); - mcIdType const nbOfTuple=_type->getNumberOfTuples(_mesh); + mcIdType nbOfTuple=_type->getNumberOfTuples(_mesh); timeDiscr()->setOrCreateUniformValueOnAllComponents(nbOfTuple,value); return *this; } @@ -1306,7 +1292,7 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, double val) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::applyFunc : no mesh defined !"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform applyFunc !"); - mcIdType const nbOfTuple=_type->getNumberOfTuples(_mesh); + mcIdType nbOfTuple=_type->getNumberOfTuples(_mesh); timeDiscr()->setUniformValue(nbOfTuple,nbOfComp,val); } @@ -1486,7 +1472,7 @@ void MEDCouplingFieldDouble::applyFuncFast64(const std::string& func) */ std::size_t MEDCouplingFieldDouble::getNumberOfComponents() const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getNumberOfComponents : No array specified !"); return getArray()->getNumberOfComponents(); } @@ -1533,7 +1519,7 @@ mcIdType MEDCouplingFieldDouble::getNumberOfTuples() const */ mcIdType MEDCouplingFieldDouble::getNumberOfValues() const { - if(getArray()==nullptr) + if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getNumberOfValues : No array specified !"); return getArray()->getNbOfElems(); } @@ -1643,9 +1629,9 @@ double MEDCouplingFieldDouble::getIJK(mcIdType cellId, int nodeIdInCell, int com */ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps) { - if(_mesh==nullptr || other==nullptr) + if(_mesh==0 || other==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::changeUnderlyingMesh : is expected to operate on not null meshes !"); - DataArrayIdType *cellCor=nullptr,*nodeCor=nullptr; + DataArrayIdType *cellCor=0,*nodeCor=0; other->checkGeoEquivalWith(_mesh,levOfCheck,precOnMesh,cellCor,nodeCor); MCAuto cellCor2(cellCor),nodeCor2(nodeCor); if(cellCor) @@ -1719,7 +1705,7 @@ void MEDCouplingFieldDouble::substractInPlaceDM(const MEDCouplingFieldDouble *f, */ bool MEDCouplingFieldDouble::mergeNodes(double eps, double epsOnVals) { - const auto *meshC=dynamic_cast(_mesh); + const MEDCouplingPointSet *meshC=dynamic_cast(_mesh); if(!meshC) throw INTERP_KERNEL::Exception("Invalid support mesh to apply mergeNodes on it : must be a MEDCouplingPointSet one !"); if(_type.isNull()) @@ -1732,9 +1718,9 @@ bool MEDCouplingFieldDouble::mergeNodes(double eps, double epsOnVals) return ret; std::vector arrays; timeDiscr()->getArrays(arrays); - for(auto array : arrays) - if(array) - _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),array); + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) + if(*iter) + _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),*iter); setMesh(meshC2); return true; } @@ -1758,7 +1744,7 @@ bool MEDCouplingFieldDouble::mergeNodes(double eps, double epsOnVals) */ bool MEDCouplingFieldDouble::mergeNodesCenter(double eps, double epsOnVals) { - const auto *meshC=dynamic_cast(_mesh); + const MEDCouplingPointSet *meshC=dynamic_cast(_mesh); if(!meshC) throw INTERP_KERNEL::Exception("Invalid support mesh to apply mergeNodes on it : must be a MEDCouplingPointSet one !"); if(_type.isNull()) @@ -1771,9 +1757,9 @@ bool MEDCouplingFieldDouble::mergeNodesCenter(double eps, double epsOnVals) return ret; std::vector arrays; timeDiscr()->getArrays(arrays); - for(auto array : arrays) - if(array) - _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),array); + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) + if(*iter) + _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),*iter); setMesh(meshC2); return true; } @@ -1795,21 +1781,21 @@ bool MEDCouplingFieldDouble::mergeNodesCenter(double eps, double epsOnVals) */ bool MEDCouplingFieldDouble::zipCoords(double epsOnVals) { - const auto *meshC=dynamic_cast(_mesh); + const MEDCouplingPointSet *meshC=dynamic_cast(_mesh); if(!meshC) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::zipCoords : Invalid support mesh to apply zipCoords on it : must be a MEDCouplingPointSet one !"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipCoords !"); MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); - mcIdType const oldNbOfNodes=meshC2->getNumberOfNodes(); + mcIdType oldNbOfNodes=meshC2->getNumberOfNodes(); MCAuto arr=meshC2->zipCoordsTraducer(); if(meshC2->getNumberOfNodes()!=oldNbOfNodes) { std::vector arrays; timeDiscr()->getArrays(arrays); - for(auto array : arrays) - if(array) - _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),array); + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) + if(*iter) + _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),*iter); setMesh(meshC2); return true; } @@ -1836,21 +1822,21 @@ bool MEDCouplingFieldDouble::zipCoords(double epsOnVals) */ bool MEDCouplingFieldDouble::zipConnectivity(int compType, double epsOnVals) { - const auto *meshC=dynamic_cast(_mesh); + const MEDCouplingUMesh *meshC=dynamic_cast(_mesh); if(!meshC) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::zipConnectivity : Invalid support mesh to apply zipCoords on it : must be a MEDCouplingPointSet one !"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipConnectivity !"); MCAuto meshC2((MEDCouplingUMesh *)meshC->deepCopy()); - mcIdType const oldNbOfCells(meshC2->getNumberOfCells()); + mcIdType oldNbOfCells(meshC2->getNumberOfCells()); MCAuto arr=meshC2->zipConnectivityTraducer(compType); if(meshC2->getNumberOfCells()!=oldNbOfCells) { std::vector arrays; timeDiscr()->getArrays(arrays); - for(auto array : arrays) - if(array) - _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),ToIdType(meshC2->getNumberOfCells()),array); + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) + if(*iter) + _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),ToIdType(meshC2->getNumberOfCells()),*iter); setMesh(meshC2); return true; } @@ -1873,11 +1859,11 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::extractSlice3D(const double *ori const MCAuto umesh(mesh->buildUnstructured()); MCAuto ret(clone(false)); ret->setMesh(umesh); - DataArrayIdType *cellIds=nullptr; + DataArrayIdType *cellIds=0; MCAuto mesh2=umesh->buildSlice3D(origin,vec,eps,cellIds); - MCAuto const cellIds2=cellIds; + MCAuto cellIds2=cellIds; ret->setMesh(mesh2); - MCAuto const tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end()); + MCAuto tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end()); std::vector arrays; timeDiscr()->getArrays(arrays); int i=0; @@ -1916,17 +1902,17 @@ bool MEDCouplingFieldDouble::simplexize(int policy) throw INTERP_KERNEL::Exception("No underlying mesh on this field to perform simplexize !"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform simplexize !"); - std::size_t const oldNbOfCells=_mesh->getNumberOfCells(); + std::size_t oldNbOfCells=_mesh->getNumberOfCells(); MCAuto meshC2(_mesh->deepCopy()); MCAuto arr=meshC2->simplexize(policy); - std::size_t const newNbOfCells=meshC2->getNumberOfCells(); + std::size_t newNbOfCells=meshC2->getNumberOfCells(); if(oldNbOfCells==newNbOfCells) return false; std::vector arrays; timeDiscr()->getArrays(arrays); - for(auto array : arrays) - if(array) - _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),ToIdType(arr->getNbOfElems()),array); + for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) + if(*iter) + _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),ToIdType(arr->getNbOfElems()),*iter); setMesh(meshC2); return true; } @@ -1998,25 +1984,25 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::convertQuadraticCellsToLinear : null mesh !"); MCAuto umesh(mesh->buildUnstructured()); - std::set const gt(umesh->getAllGeoTypes()); + std::set gt(umesh->getAllGeoTypes()); MCAuto ret(MEDCouplingFieldDouble::New(ON_GAUSS_PT)); // const MEDCouplingFieldDiscretization *disc(getDiscretization()); - const auto *disc2(dynamic_cast(disc)); + const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) throw INTERP_KERNEL::Exception("convertQuadraticCellsToLinear : Not a ON_GAUSS_PT field"); - std::set const gt2(umesh->getAllGeoTypes()); + std::set gt2(umesh->getAllGeoTypes()); std::vector< MCAuto > cellIdsV; std::vector< MCAuto > meshesV; std::vector< MEDCouplingGaussLocalization > glV; bool isZipReq(false); - for(auto it : gt) + for(std::set::const_iterator it=gt.begin();it!=gt.end();it++) { - const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(it)); - MCAuto cellIds(umesh->giveCellsWithType(it)); + const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(*it)); + MCAuto cellIds(umesh->giveCellsWithType(*it)); cellIdsV.push_back(cellIds); MCAuto part(umesh->buildPartOfMySelf(cellIds->begin(),cellIds->end())); - mcIdType const id(disc2->getGaussLocalizationIdOfOneType(it)); + mcIdType id(disc2->getGaussLocalizationIdOfOneType(*it)); const MEDCouplingGaussLocalization& gl(disc2->getGaussLocalization(id)); if(!cm.isQuadratic()) { @@ -2026,9 +2012,9 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi { isZipReq=true; part->convertQuadraticCellsToLinear(); - INTERP_KERNEL::GaussInfo const gi(it,gl.getGaussCoords(),gl.getNumberOfGaussPt(),gl.getRefCoords(),gl.getNumberOfPtsInRefCell()); - INTERP_KERNEL::GaussInfo const gi2(gi.convertToLinear()); - MEDCouplingGaussLocalization const gl2(gi2.getGeoType(),gi2.getRefCoords(),gi2.getGaussCoords(),gl.getWeights()); + INTERP_KERNEL::GaussInfo gi(*it,gl.getGaussCoords(),gl.getNumberOfGaussPt(),gl.getRefCoords(),gl.getNumberOfPtsInRefCell()); + INTERP_KERNEL::GaussInfo gi2(gi.convertToLinear()); + MEDCouplingGaussLocalization gl2(gi2.getGeoType(),gi2.getRefCoords(),gi2.getGaussCoords(),gl.getWeights()); glV.push_back(gl2); } meshesV.push_back(part); @@ -2047,8 +2033,8 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi umesh->zipCoords(); ret->setArray(const_cast(getArray())); ret->setMesh(umesh); - for(const auto & it : glV) - ret->setGaussLocalizationOnType(it.getType(),it.getRefCoords(),it.getGaussCoords(),it.getWeights()); + for(std::vector< MEDCouplingGaussLocalization >::const_iterator it=glV.begin();it!=glV.end();it++) + ret->setGaussLocalizationOnType((*it).getType(),(*it).getRefCoords(),(*it).getGaussCoords(),(*it).getWeights()); ret->copyAllTinyAttrFrom(this); ret->checkConsistencyLight(); return ret; @@ -2409,7 +2395,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vector > ms(a.size()); std::vector< const MEDCouplingUMesh *> ms2(a.size()); std::vector< const MEDCouplingTimeDiscretization *> tds(a.size()); - auto it=a.begin(); + std::vector< const MEDCouplingFieldDouble *>::const_iterator it=a.begin(); std::vector fds(a.size()); const MEDCouplingFieldDouble *ref((*it++)); if(!ref) @@ -2426,7 +2412,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vectorgetMesh()) { ms[i]=a[i]->getMesh()->buildUnstructured(); ms2[i]=ms[i]; } else - { ms[i]=nullptr; ms2[i]=nullptr; } + { ms[i]=0; ms2[i]=0; } tds[i]=a[i]->timeDiscr(); fds[i]=a[i]->getDiscretization(); } @@ -2495,7 +2481,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::DotFields(const MEDCouplingField throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply DotFields on them! Check support mesh, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td(f1->timeDiscr()->dot(f2->timeDiscr())); td->copyTinyAttrFrom(*f1->timeDiscr()); - auto *ret(new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone())); + MEDCouplingFieldDouble *ret(new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone())); ret->setMesh(f1->getMesh()); return ret; } @@ -2878,7 +2864,7 @@ std::string MEDCouplingFieldDouble::WriteVTK(const std::string& fileName, const { if(fs.empty()) return std::string(); - std::size_t const nfs=fs.size(); + std::size_t nfs=fs.size(); if(!fs[0]) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::WriteVTK : 1st instance of field is NULL !"); const MEDCouplingMesh *m=fs[0]->getMesh(); @@ -2897,13 +2883,13 @@ std::string MEDCouplingFieldDouble::WriteVTK(const std::string& fileName, const for(std::size_t i=0;igetName()); + std::string name(cur->getName()); if(name.empty()) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::WriteVTK : Field in pos #" << i << " has no name !"; throw INTERP_KERNEL::Exception(oss.str()); } - TypeOfField const typ=cur->getTypeOfField(); + TypeOfField typ=cur->getTypeOfField(); if(typ==ON_CELLS) cur->getArray()->writeVTK(coss,8,cur->getName(),byteArr); else if(typ==ON_NODES) @@ -2923,7 +2909,7 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni MCAuto fieldToWO; const MEDCouplingMesh *inpMeshBase(getMesh()); MCAuto inpMesh(inpMeshBase->buildUnstructured()); - std::string const meshName(inpMesh->getName()); + std::string meshName(inpMesh->getName()); if(!inpMesh->isPresenceOfQuadratic()) fieldToWO=clone(false); else @@ -2932,12 +2918,12 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni inpMeshBase=fieldToWO->getMesh(); inpMesh=inpMeshBase->buildUnstructured(); } - mcIdType const nbCells(inpMesh->getNumberOfCells()); + mcIdType nbCells(inpMesh->getNumberOfCells()); const MEDCouplingFieldDiscretization *disc(fieldToWO->getDiscretization()); - const auto *disc2(dynamic_cast(disc)); + const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::voronoize2D : Not a ON_GAUSS_PT field"); - mcIdType const nbLocs(disc2->getNbOfGaussLocalization()); + mcIdType nbLocs(disc2->getNbOfGaussLocalization()); std::vector< MCAuto > cells(nbCells); for(mcIdType i=0;i MEDCouplingFieldDouble::voronoizeGen(const Voroni MCAuto coo2(DataArrayDouble::NewFromStdVector(coo)); coo2->rearrange(vor->getDimension()); // - MCAuto const coo3(MEDCouplingUMesh::Build0DMeshFromCoords(coo2)); + MCAuto coo3(MEDCouplingUMesh::Build0DMeshFromCoords(coo2)); // MCAuto vorCellsForCurDisc(vor->doIt(mesh,coo2,eps)); std::vector ids; @@ -2959,7 +2945,7 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni MCAuto subMesh(inpMesh->buildPartOfMySelf(&ids[0],&ids[0]+ids.size())); ptsInReal=gl.localizePtsInRefCooForEachCell(vorCellsForCurDisc->getCoords(),subMesh); } - mcIdType const nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes()); + mcIdType nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes()); for(mcIdType j=0;j elt(vorCellsForCurDisc->clone(false)); @@ -2980,7 +2966,7 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni onCells->setTimeUnit(getTimeUnit()); { int b,c; - double const a(getTime(b,c)); + double a(getTime(b,c)); onCells->setTime(a,b,c); } onCells->setName(getName()); @@ -2991,8 +2977,8 @@ MEDCouplingTimeDiscretization *MEDCouplingFieldDouble::timeDiscr() { MEDCouplingTimeDiscretizationTemplate *ret(_time_discr); if(!ret) - return nullptr; - auto *retc(dynamic_cast(ret)); + return 0; + MEDCouplingTimeDiscretization *retc(dynamic_cast(ret)); if(!retc) throw INTERP_KERNEL::Exception("Field Double Null invalid type of time discr !"); return retc; @@ -3002,8 +2988,8 @@ const MEDCouplingTimeDiscretization *MEDCouplingFieldDouble::timeDiscr() const { const MEDCouplingTimeDiscretizationTemplate *ret(_time_discr); if(!ret) - return nullptr; - const auto *retc(dynamic_cast(ret)); + return 0; + const MEDCouplingTimeDiscretization *retc(dynamic_cast(ret)); if(!retc) throw INTERP_KERNEL::Exception("Field Double Null invalid type of time discr !"); return retc; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index 335f677a5..4905b8ee7 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -21,20 +21,9 @@ #ifndef __MEDCOUPLINGFIELDDOUBLE_HXX__ #define __MEDCOUPLINGFIELDDOUBLE_HXX__ -#include "MCType.hxx" -#include "MCAuto.hxx" #include "MEDCoupling.hxx" -#include "MEDCouplingField.hxx" -#include "MEDCouplingFieldDiscretization.hxx" #include "MEDCouplingFieldT.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include -#include "MEDCouplingTraits.hxx" -#include -#include -#include "MEDCouplingTimeDiscretization.hxx" -#include "MEDCouplingNatureOfFieldEnum" namespace MEDCoupling { @@ -50,13 +39,13 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void synchronizeTimeWithSupport(); MEDCOUPLING_EXPORT std::string advancedRepr() const; MEDCOUPLING_EXPORT std::string writeVTK(const std::string& fileName, bool isBinary=true) const; - MEDCOUPLING_EXPORT bool areCompatibleForMerge(const MEDCouplingField *other) const override; + MEDCOUPLING_EXPORT bool areCompatibleForMerge(const MEDCouplingField *other) const; MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingFieldDouble *other) const; MEDCOUPLING_EXPORT void renumberNodes(const mcIdType *old2NewBg, double eps=1e-15); MEDCOUPLING_EXPORT void renumberNodesWithoutMesh(const mcIdType *old2NewBg, mcIdType newNbOfNodes, double eps=1e-15); MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(double vmin, double vmax) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *deepCopy() const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *clone(bool recDeepCpy) const override; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *nodeToCellDiscretization() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const; @@ -104,9 +93,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::size_t getNumberOfComponents() const; MEDCOUPLING_EXPORT mcIdType getNumberOfTuples() const; MEDCOUPLING_EXPORT mcIdType getNumberOfValues() const; - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; // MEDCOUPLING_EXPORT void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15); MEDCOUPLING_EXPORT void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15); @@ -165,7 +154,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT const MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() const { return timeDiscr(); } MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() { return timeDiscr(); } protected: - ~MEDCouplingFieldDouble() override = default; + ~MEDCouplingFieldDouble() { } private: MEDCOUPLING_EXPORT MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td); MEDCOUPLING_EXPORT MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td); diff --git a/src/MEDCoupling/MEDCouplingFieldFloat.cxx b/src/MEDCoupling/MEDCouplingFieldFloat.cxx index 0702daff5..a66119060 100644 --- a/src/MEDCoupling/MEDCouplingFieldFloat.cxx +++ b/src/MEDCoupling/MEDCouplingFieldFloat.cxx @@ -20,18 +20,12 @@ #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldT.txx" -#include "MEDCouplingFieldDiscretization.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingFieldInt32.hxx" +#include "MEDCouplingFieldInt.hxx" #include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTimeDiscretization.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingTraits.hxx" +#include "MEDCouplingMemArray.txx" using namespace MEDCoupling; diff --git a/src/MEDCoupling/MEDCouplingFieldFloat.hxx b/src/MEDCoupling/MEDCouplingFieldFloat.hxx index 8b3bcc77f..bd2f29ee6 100644 --- a/src/MEDCoupling/MEDCouplingFieldFloat.hxx +++ b/src/MEDCoupling/MEDCouplingFieldFloat.hxx @@ -22,12 +22,8 @@ #define __MEDCOUPLINGFIELDFLOAT_HXX__ #include "MEDCoupling.hxx" -#include "MEDCouplingFieldDiscretization.hxx" #include "MEDCouplingFieldT.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTraits.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingTimeDiscretization.hxx" +#include "MEDCouplingMemArray.hxx" #include @@ -42,7 +38,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); MEDCOUPLING_EXPORT static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); MEDCOUPLING_EXPORT MEDCouplingFieldFloat *deepCopy() const; - MEDCOUPLING_EXPORT MEDCouplingFieldFloat *clone(bool recDeepCpy) const override; + MEDCOUPLING_EXPORT MEDCouplingFieldFloat *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const; MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *convertToIntField() const; MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *convertToInt64Field() const; @@ -52,7 +48,7 @@ namespace MEDCoupling MEDCouplingFieldFloat(const MEDCouplingFieldFloat& other, bool deepCpy); MEDCouplingFieldFloat(NatureOfField n, MEDCouplingTimeDiscretizationFloat *td, MEDCouplingFieldDiscretization *type); MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td); - ~MEDCouplingFieldFloat() override = default; + ~MEDCouplingFieldFloat() { } }; } diff --git a/src/MEDCoupling/MEDCouplingFieldInt32.cxx b/src/MEDCoupling/MEDCouplingFieldInt32.cxx index 363a25636..edea743c2 100644 --- a/src/MEDCoupling/MEDCouplingFieldInt32.cxx +++ b/src/MEDCoupling/MEDCouplingFieldInt32.cxx @@ -19,19 +19,13 @@ // Author : Yann Pora (EDF R&D) #include "MEDCouplingFieldInt32.hxx" -#include "MCType.hxx" -#include "MEDCouplingFieldDiscretization.hxx" -#include "MCAuto.hxx" #include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingFieldT.txx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTimeDiscretization.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingTraits.hxx" +#include "MEDCouplingMemArray.txx" using namespace MEDCoupling; @@ -81,7 +75,7 @@ typename Traits::FieldType *ConvertToUField(const MEDCouplingFieldInt32 *self { MCAuto tmp(MEDCouplingFieldTemplate::New(*self)); int t1,t2; - double const t0(self->getTime(t1,t2)); + double t0(self->getTime(t1,t2)); MCAuto::FieldType > ret(Traits::FieldType::New(*tmp,self->getTimeDiscretization())); ret->setTime(t0,t1,t2); if(self->getArray()) @@ -105,4 +99,4 @@ MEDCouplingFieldInt64 *MEDCouplingFieldInt32::convertToInt64Field() const MEDCouplingFieldFloat *MEDCouplingFieldInt32::convertToFloatField() const { return ConvertToUField(this); -} +} \ No newline at end of file diff --git a/src/MEDCoupling/MEDCouplingFieldInt32.hxx b/src/MEDCoupling/MEDCouplingFieldInt32.hxx index 4b55cb264..b664ffe36 100644 --- a/src/MEDCoupling/MEDCouplingFieldInt32.hxx +++ b/src/MEDCoupling/MEDCouplingFieldInt32.hxx @@ -20,14 +20,9 @@ #pragma once -#include "MCType.hxx" #include "MEDCoupling.hxx" -#include "MEDCouplingFieldDiscretization.hxx" #include "MEDCouplingFieldT.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTraits.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingTimeDiscretization.hxx" +#include "MEDCouplingMemArray.hxx" #include @@ -42,7 +37,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingFieldInt32 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); MEDCOUPLING_EXPORT static MEDCouplingFieldInt32 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *deepCopy() const; - MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *clone(bool recDeepCpy) const override; + MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const; MEDCOUPLING_EXPORT MEDCouplingFieldFloat *convertToFloatField() const; MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *convertToInt64Field() const; @@ -52,6 +47,6 @@ namespace MEDCoupling MEDCouplingFieldInt32(const MEDCouplingFieldInt32& other, bool deepCopy); MEDCouplingFieldInt32(NatureOfField n, MEDCouplingTimeDiscretizationInt32 *td, MEDCouplingFieldDiscretization *type); MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td); - ~MEDCouplingFieldInt32() override = default; + ~MEDCouplingFieldInt32() { } }; } diff --git a/src/MEDCoupling/MEDCouplingFieldInt64.cxx b/src/MEDCoupling/MEDCouplingFieldInt64.cxx index 96f086008..cf26a258f 100644 --- a/src/MEDCoupling/MEDCouplingFieldInt64.cxx +++ b/src/MEDCoupling/MEDCouplingFieldInt64.cxx @@ -20,15 +20,10 @@ #include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingFieldT.txx" -#include "MCType.hxx" -#include "MEDCouplingFieldDiscretization.hxx" -#include "MCAuto.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTimeDiscretization.hxx" -#include "MEDCouplingNatureOfFieldEnum" +#include "MEDCouplingMemArray.txx" using namespace MEDCoupling; @@ -77,7 +72,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldInt64::convertToDblField() const { MCAuto tmp(MEDCouplingFieldTemplate::New(*this)); int t1,t2; - double const t0(getTime(t1,t2)); + double t0(getTime(t1,t2)); MCAuto ret(MEDCouplingFieldDouble::New(*tmp,getTimeDiscretization())); ret->setTime(t0,t1,t2); if(getArray()) diff --git a/src/MEDCoupling/MEDCouplingFieldInt64.hxx b/src/MEDCoupling/MEDCouplingFieldInt64.hxx index e754354a3..242b6bcc2 100644 --- a/src/MEDCoupling/MEDCouplingFieldInt64.hxx +++ b/src/MEDCoupling/MEDCouplingFieldInt64.hxx @@ -20,13 +20,9 @@ #pragma once -#include "MCType.hxx" #include "MEDCoupling.hxx" -#include "MEDCouplingFieldDiscretization.hxx" #include "MEDCouplingFieldT.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingTimeDiscretization.hxx" +#include "MEDCouplingMemArray.hxx" #include @@ -41,7 +37,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingFieldInt64 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); MEDCOUPLING_EXPORT static MEDCouplingFieldInt64 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *deepCopy() const; - MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *clone(bool recDeepCpy) const override; + MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const; MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldInt64"); } protected: @@ -49,6 +45,6 @@ namespace MEDCoupling MEDCouplingFieldInt64(const MEDCouplingFieldInt64& other, bool deepCopy); MEDCouplingFieldInt64(NatureOfField n, MEDCouplingTimeDiscretizationInt64 *td, MEDCouplingFieldDiscretization *type); MEDCouplingFieldInt64(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td); - ~MEDCouplingFieldInt64() override = default; + ~MEDCouplingFieldInt64() { } }; } diff --git a/src/MEDCoupling/MEDCouplingFieldOverTime.cxx b/src/MEDCoupling/MEDCouplingFieldOverTime.cxx index 0598c5989..20d61cbc4 100644 --- a/src/MEDCoupling/MEDCouplingFieldOverTime.cxx +++ b/src/MEDCoupling/MEDCouplingFieldOverTime.cxx @@ -19,17 +19,9 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingFieldOverTime.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingDefinitionTime.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingMultiFields.hxx" -#include "MEDCouplingRefCountObject.hxx" #include -#include -#include -#include -#include using namespace MEDCoupling; @@ -40,11 +32,11 @@ MEDCouplingFieldOverTime *MEDCouplingFieldOverTime::New(const std::vector >::const_iterator it=_fs.begin(); if(_fs.empty()) throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : empty set !"); for(;it!=_fs.end();it++) - if((const MEDCouplingFieldDouble *)(*it)!=nullptr) + if((const MEDCouplingFieldDouble *)(*it)!=0) return (*it)->getTimeTolerance(); throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : only empty fields in this !"); } @@ -52,7 +44,7 @@ double MEDCouplingFieldOverTime::getTimeTolerance() const void MEDCouplingFieldOverTime::checkConsistencyLight() const { MEDCouplingMultiFields::checkConsistencyLight(); - auto it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((*it)->getTimeDiscretization()==NO_TIME) { @@ -65,7 +57,7 @@ void MEDCouplingFieldOverTime::checkConsistencyLight() const const MEDCouplingFieldDouble& ref=*(*(it++)); int tt1,tt2; double reft=ref.getEndTime(tt1,tt2); - double const eps=getTimeTolerance(); + double eps=getTimeTolerance(); int id=1; for(;it!=_fs.end();it++,id++) { @@ -74,7 +66,7 @@ void MEDCouplingFieldOverTime::checkConsistencyLight() const std::ostringstream oss; oss << "Field slice at rank #" << id << " is not compatible with the first !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - double const curt=(*it)->getStartTime(tt1,tt2); + double curt=(*it)->getStartTime(tt1,tt2); if(curtgetEndTime(tt1,tt2); @@ -99,7 +91,7 @@ std::string MEDCouplingFieldOverTime::simpleRepr() const { ret << "Current instance is INVALID !\n"; } try { - MEDCouplingDefinitionTime const dt=getDefinitionTimeZone(); + MEDCouplingDefinitionTime dt=getDefinitionTimeZone(); dt.appendRepr(ret); } catch(INTERP_KERNEL::Exception& /*e*/) @@ -111,7 +103,7 @@ bool MEDCouplingFieldOverTime::isEqual(const MEDCouplingMultiFields *other, doub { if(!MEDCouplingMultiFields::isEqual(other,meshPrec,valsPrec)) return false; - const auto *otherC=dynamic_cast(other); + const MEDCouplingFieldOverTime *otherC=dynamic_cast(other); if(!otherC) return false; // to implement @@ -122,7 +114,7 @@ bool MEDCouplingFieldOverTime::isEqualWithoutConsideringStr(const MEDCouplingMul { if(!MEDCouplingMultiFields::isEqualWithoutConsideringStr(other,meshPrec,valsPrec)) return false; - const auto *otherC=dynamic_cast(other); + const MEDCouplingFieldOverTime *otherC=dynamic_cast(other); if(!otherC) return false; // to implement @@ -157,7 +149,7 @@ MEDCouplingDefinitionTime MEDCouplingFieldOverTime::getDefinitionTimeZone() cons { std::vector< std::vector > tmp; getDifferentArrays(tmp); - std::vector const tmp2(_fs.begin(),_fs.end()); + std::vector tmp2(_fs.begin(),_fs.end()); std::vector tmp3; getDifferentMeshes(tmp3); return MEDCouplingDefinitionTime(tmp2,tmp3,tmp); @@ -169,4 +161,5 @@ MEDCouplingFieldOverTime::MEDCouplingFieldOverTime(const std::vector #include namespace MEDCoupling @@ -35,18 +33,18 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT static MEDCouplingFieldOverTime *New(const std::vector& fs); - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT double getTimeTolerance() const; - MEDCOUPLING_EXPORT std::string simpleRepr() const override; - MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const override; + MEDCOUPLING_EXPORT std::string simpleRepr() const; + MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const; //void getIdsToFetch(double time, int& fieldId, int& arrId, int& meshId) const; //void setFieldOnId(int fieldId, MEDCouplingFieldDouble *f); //void dispatchPointers(); - MEDCOUPLING_EXPORT std::vector getMeshes() const override; - MEDCOUPLING_EXPORT std::vector getDifferentMeshes(std::vector& refs) const override; - MEDCOUPLING_EXPORT std::vector getArrays() const override; - MEDCOUPLING_EXPORT std::vector getDifferentArrays(std::vector< std::vector >& refs) const override; + MEDCOUPLING_EXPORT std::vector getMeshes() const; + MEDCOUPLING_EXPORT std::vector getDifferentMeshes(std::vector& refs) const; + MEDCOUPLING_EXPORT std::vector getArrays() const; + MEDCOUPLING_EXPORT std::vector getDifferentArrays(std::vector< std::vector >& refs) const; MEDCOUPLING_EXPORT MEDCouplingDefinitionTime getDefinitionTimeZone() const; protected: MEDCOUPLING_EXPORT MEDCouplingFieldOverTime(); diff --git a/src/MEDCoupling/MEDCouplingFieldT.hxx b/src/MEDCoupling/MEDCouplingFieldT.hxx index bf72c6025..25b6bf7a0 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.hxx +++ b/src/MEDCoupling/MEDCouplingFieldT.hxx @@ -20,19 +20,11 @@ #pragma once -#include "MEDCoupling.hxx" -#include "MCType.hxx" #include "MEDCouplingField.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingNatureOfFieldEnum" #include "MEDCouplingTraits.hxx" #include "MEDCouplingTimeDiscretization.hxx" -#include -#include -#include -#include +#include namespace MEDCoupling { @@ -47,11 +39,11 @@ namespace MEDCoupling MEDCouplingFieldT(const MEDCouplingField& other, MEDCouplingTimeDiscretizationTemplate *timeDiscr, bool deepCopy=true); MEDCouplingFieldT(TypeOfField type, MEDCouplingTimeDiscretizationTemplate *timeDiscr); MEDCouplingFieldT(MEDCouplingFieldDiscretization *type, NatureOfField n, MEDCouplingTimeDiscretizationTemplate *timeDiscr); - ~MEDCouplingFieldT() override; + ~MEDCouplingFieldT(); public: MEDCOUPLING_EXPORT TypeOfTimeDiscretization getTimeDiscretization() const; MEDCOUPLING_EXPORT virtual typename Traits::FieldType *clone(bool recDeepCpy) const = 0; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT typename Traits::FieldType *cloneWithMesh(bool recDeepCpy) const; MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const DataArrayIdType *part) const; MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const mcIdType *partBg, const mcIdType *partEnd) const; @@ -85,11 +77,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingFieldT *other, double meshPrec, T valsPrec) const; MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingFieldT *other, double meshPrec, T valsPrec, std::string& reason) const; MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingFieldT *other, double meshPrec, T valsPrec) const; - MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingField *other) override; - MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingField *other) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const override; + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingField *other); + MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingField *other) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; // specific MEDCOUPLING_EXPORT bool areCompatibleForMul(const MEDCouplingField *other) const; MEDCOUPLING_EXPORT bool areCompatibleForDiv(const MEDCouplingField *other) const; diff --git a/src/MEDCoupling/MEDCouplingFieldT.txx b/src/MEDCoupling/MEDCouplingFieldT.txx index 28b6eb0e1..d2c1903c4 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.txx +++ b/src/MEDCoupling/MEDCouplingFieldT.txx @@ -21,27 +21,11 @@ #ifndef __MEDCOUPLINGFIELDT_TXX__ #define __MEDCOUPLINGFIELDT_TXX__ -#include "MCAuto.hxx" -#include "InterpKernelException.hxx" -#include "MEDCouplingFieldT.hxx" +#include "MEDCouplingTimeDiscretization.hxx" #include "MEDCouplingMesh.hxx" -#include "MCType.hxx" -#include "MEDCouplingNatureOfField.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingField.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTraits.hxx" - -#include -#include -#include -#include -#include namespace MEDCoupling { - class DataArray; - template MEDCouplingFieldT::MEDCouplingFieldT(const MEDCouplingFieldT& other, bool deepCopy):MEDCouplingField(other,deepCopy),_time_discr(other._time_discr->performCopyOrIncrRef(deepCopy)) { diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx index 6b6956fd2..78bc9651e 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx @@ -19,24 +19,14 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingFieldTemplate.hxx" -#include "MCIdType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingField.hxx" -#include "MCType.hxx" #include "MEDCouplingMesh.hxx" #include "MEDCouplingFieldInt32.hxx" #include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingNatureOfField.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include #include -#include -#include using namespace MEDCoupling; @@ -142,7 +132,7 @@ MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldTemplat void MEDCouplingFieldTemplate::checkConsistencyLight() const { - if(_mesh==nullptr) + if(_mesh==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldTemplate::checkConsistencyLight : Empty mesh !"); } @@ -200,8 +190,8 @@ void MEDCouplingFieldTemplate::resizeForUnserialization(const std::vector const tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end()); + dataInt=0; + std::vector tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end()); _type->resizeForUnserialization(tinyInfoITmp,dataInt); } @@ -223,7 +213,7 @@ void MEDCouplingFieldTemplate::serialize(DataArrayIdType *&dataInt) const void MEDCouplingFieldTemplate::reprQuickOverview(std::ostream& stream) const { stream << "MEDCouplingFieldTemplate C++ instance at " << this << ". Name : \"" << _name << "\"." << std::endl; - const char *nat=nullptr; + const char *nat=0; try { nat=MEDCouplingNatureOfField::GetRepr(_nature); @@ -243,13 +233,13 @@ void MEDCouplingFieldTemplate::reprQuickOverview(std::ostream& stream) const { std::ostringstream oss; _mesh->reprQuickOverview(oss); - std::string const tmp(oss.str()); + std::string tmp(oss.str()); stream << "\nMesh info : " << tmp.substr(0,tmp.find('\n')); } } MCAuto MEDCouplingFieldTemplate::clone(bool recDeepCpy) const { - MCAuto const ret(new MEDCouplingFieldTemplate(*this,recDeepCpy)); + MCAuto ret(new MEDCouplingFieldTemplate(*this,recDeepCpy)); return ret; } diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx index ab4f320f4..f9e32107c 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx @@ -20,14 +20,7 @@ #pragma once -#include "MEDCoupling.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" #include "MEDCouplingField.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include -#include -#include namespace MEDCoupling { @@ -63,7 +56,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingFieldTemplate *other, double meshPrec) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT MCAuto clone(bool recDeepCpy) const; // MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; @@ -73,7 +66,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&dataInt) const; // - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; private: MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f, bool isChecked=true); MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f, bool isChecked=true); diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index 76a587d72..ec2daf562 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -19,26 +19,16 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingGaussLocalization.hxx" -#include "InterpKernelException.hxx" #include "InterpKernelGaussCoords.hxx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MEDCoupling1GTUMesh.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDCouplingUMesh.hxx" #include "CellModel.hxx" -#include "NormalizedGeometricTypes" #include -#include -#include -#include -#include +#include #include +#include #include -#include -#include using namespace MEDCoupling; @@ -66,8 +56,8 @@ void MEDCouplingGaussLocalization::setType(INTERP_KERNEL::NormalizedCellType typ void MEDCouplingGaussLocalization::checkConsistencyLight() const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); - int const nbNodes=cm.getNumberOfNodes(); - int const dim=cm.getDimension(); + int nbNodes=cm.getNumberOfNodes(); + int dim=cm.getDimension(); if(!cm.isDynamic()) { if(ToIdType(_ref_coord.size())!=nbNodes*dim) @@ -99,7 +89,7 @@ int MEDCouplingGaussLocalization::getNumberOfPtsInRefCell() const const INTERP_KERNEL::CellModel& cm = INTERP_KERNEL::CellModel::GetCellModel(_type); return ((int)_ref_coord.size()) / ((int)cm.getDimension()); } - int const dim( getDimension() ); + int dim( getDimension() ); return (int)_ref_coord.size()/dim; } @@ -138,8 +128,8 @@ bool MEDCouplingGaussLocalization::isEqual(const MEDCouplingGaussLocalization& o double MEDCouplingGaussLocalization::getRefCoord(int ptIdInCell, int comp) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); - int const nbNodes=cm.getNumberOfNodes(); - int const dim=cm.getDimension(); + int nbNodes=cm.getNumberOfNodes(); + int dim=cm.getDimension(); if(ptIdInCell<0 || ptIdInCell>=nbNodes) throw INTERP_KERNEL::Exception("ptIdInCell specified is invalid : must be in [0;nbNodesPerCell) !"); if(comp<0 || comp>=dim) @@ -149,7 +139,7 @@ double MEDCouplingGaussLocalization::getRefCoord(int ptIdInCell, int comp) const double MEDCouplingGaussLocalization::getGaussCoord(int gaussPtIdInCell, int comp) const { - int const dim=checkCoherencyOfRequest(gaussPtIdInCell,comp); + int dim=checkCoherencyOfRequest(gaussPtIdInCell,comp); return _gauss_coord[gaussPtIdInCell*dim+comp]; } @@ -216,12 +206,12 @@ MCAuto MEDCouplingGaussLocalization::localizePtsInRefCooForEach ptsInRefCoo->checkAllocated(); mesh->checkConsistencyLight(); // - mcIdType const nbCells=mesh->getNumberOfCells(); + mcIdType nbCells=mesh->getNumberOfCells(); const double *coords(mesh->getCoords()->begin()); const mcIdType *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin()); // - mcIdType const nbPts(ptsInRefCoo->getNumberOfTuples()); - INTERP_KERNEL::NormalizedCellType const typ(getType()); + mcIdType nbPts(ptsInRefCoo->getNumberOfTuples()); + INTERP_KERNEL::NormalizedCellType typ(getType()); int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()),outDim(mesh->getSpaceDimension()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbPts*nbCells,outDim); @@ -268,7 +258,7 @@ MCAuto MEDCouplingGaussLocalization::getShapeFunctionValues() c double *retPtr(ret->getPointer()); for(int iGaussPt = 0 ; iGaussPt < nbGaussPt ; ++iGaussPt) { - std::vector const curGaussPt(_gauss_coord.begin()+iGaussPt*dim,_gauss_coord.begin()+(iGaussPt+1)*dim); + std::vector curGaussPt(_gauss_coord.begin()+iGaussPt*dim,_gauss_coord.begin()+(iGaussPt+1)*dim); INTERP_KERNEL::GaussInfo gi(_type,curGaussPt,1,_ref_coord,nbPtsRefCell); gi.initLocalInfo(); const double *funcVal( gi.getFunctionValues(0) ); @@ -286,7 +276,7 @@ MCAuto MEDCouplingGaussLocalization::getDerivativeOfShapeFuncti double *retPtr(ret->getPointer()); for(int iGaussPt = 0 ; iGaussPt < nbGaussPt ; ++iGaussPt) { - std::vector const curGaussPt(_gauss_coord.begin()+iGaussPt*dim,_gauss_coord.begin()+(iGaussPt+1)*dim); + std::vector curGaussPt(_gauss_coord.begin()+iGaussPt*dim,_gauss_coord.begin()+(iGaussPt+1)*dim); INTERP_KERNEL::GaussInfo gi(_type,curGaussPt,1,_ref_coord,nbPtsRefCell); gi.initLocalInfo(); const double *devOfFuncVal( gi.getDerivativeOfShapeFunctionAt(0) ); @@ -303,8 +293,8 @@ MCAuto MEDCouplingGaussLocalization::getDerivativeOfShapeFuncti void MEDCouplingGaussLocalization::setRefCoord(int ptIdInCell, int comp, double newVal) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); - int const nbNodes=cm.getNumberOfNodes(); - int const dim=cm.getDimension(); + int nbNodes=cm.getNumberOfNodes(); + int dim=cm.getDimension(); if(ptIdInCell<0 || ptIdInCell>=nbNodes) throw INTERP_KERNEL::Exception("ptIdInCell specified is invalid : must be in [0;nbNodesPerCell) !"); if(comp<0 || comp>=dim) @@ -314,7 +304,7 @@ void MEDCouplingGaussLocalization::setRefCoord(int ptIdInCell, int comp, double void MEDCouplingGaussLocalization::setGaussCoord(int gaussPtIdInCell, int comp, double newVal) { - int const dim=checkCoherencyOfRequest(gaussPtIdInCell,comp); + int dim=checkCoherencyOfRequest(gaussPtIdInCell,comp); _gauss_coord[gaussPtIdInCell*dim+comp]=newVal; } @@ -351,8 +341,8 @@ MEDCouplingGaussLocalization MEDCouplingGaussLocalization::BuildNewInstanceFromT int MEDCouplingGaussLocalization::checkCoherencyOfRequest(mcIdType gaussPtIdInCell, int comp) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); - int const dim=cm.getDimension(); - mcIdType const nbGsPts=getNumberOfGaussPt(); + int dim=cm.getDimension(); + mcIdType nbGsPts=getNumberOfGaussPt(); if(gaussPtIdInCell<0 || gaussPtIdInCell>=nbGsPts) throw INTERP_KERNEL::Exception("gaussPtIdInCell specified is invalid : must be in [0:nbGsPts) !"); if(comp<0 || comp>=dim) @@ -362,7 +352,7 @@ int MEDCouplingGaussLocalization::checkCoherencyOfRequest(mcIdType gaussPtIdInCe bool MEDCouplingGaussLocalization::AreAlmostEqual(const std::vector& v1, const std::vector& v2, double eps) { - std::size_t const sz=v1.size(); + std::size_t sz=v1.size(); if(sz!=v2.size()) return false; std::vector tmp(sz); @@ -376,7 +366,7 @@ MCAuto MEDCouplingGaussLocalization::GetDefaultReferenceCoordin std::vector retCpp(INTERP_KERNEL::GaussInfo::GetDefaultReferenceCoordinatesOf(type)); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); auto nbDim(cm.getDimension()); - std::size_t const sz(retCpp.size()); + std::size_t sz(retCpp.size()); MCAuto ret(DataArrayDouble::New()); if( sz%std::size_t(nbDim) != 0 ) THROW_IK_EXCEPTION("GetDefaultReferenceCoordinatesOf : unexpected size of defaut array : " << sz << " % " << nbDim << " != 0 !"); diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx index 67935ade9..29d617231 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx @@ -21,14 +21,11 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGGAUSSLOCALIZATION_HXX__ #define __PARAMEDMEM_MEDCOUPLINGGAUSSLOCALIZATION_HXX__ -#include "MCType.hxx" -#include "MCAuto.hxx" #include "MEDCoupling.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "MEDCouplingMemArray.hxx" -#include "NormalizedGeometricTypes" +#include "InterpKernelException.hxx" -#include -#include #include namespace MEDCoupling diff --git a/src/MEDCoupling/MEDCouplingIMesh.cxx b/src/MEDCoupling/MEDCouplingIMesh.cxx old mode 100644 new mode 100755 index 7e4462c02..faa588c2a --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -19,26 +19,14 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingIMesh.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingMemArray.txx" +#include "MEDCouplingMemArray.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingStructuredMesh.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include -#include #include #include -#include -#include #include #include -#include -#include using namespace MEDCoupling; @@ -57,7 +45,8 @@ MEDCouplingIMesh::MEDCouplingIMesh(const MEDCouplingIMesh& other, bool deepCpy): } MEDCouplingIMesh::~MEDCouplingIMesh() -= default; +{ +} MEDCouplingIMesh *MEDCouplingIMesh::New() { @@ -104,7 +93,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(mcIdType ghostLev) const if(ghostLev<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::buildWithGhost : the ghostLev must be >= 0 !"); checkConsistencyLight(); - int const spaceDim(getSpaceDimension()); + int spaceDim(getSpaceDimension()); double origin[3],dxyz[3]; mcIdType structure[3]; for(int i=0;i MEDCouplingIMesh::getNodeStruct() const void MEDCouplingIMesh::setOrigin(const double *originStart, const double *originStop) { checkSpaceDimension(); - mcIdType const sz(ToIdType(std::distance(originStart,originStop))); + mcIdType sz(ToIdType(std::distance(originStart,originStop))); if(sz!=_space_dim) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setOrigin : input vector of origin vector has not the right size ! Or change space dimension before calling it !"); std::copy(originStart,originStop,_origin); @@ -153,7 +142,7 @@ std::vector MEDCouplingIMesh::getOrigin() const void MEDCouplingIMesh::setDXYZ(const double *dxyzStart, const double *dxyzStop) { checkSpaceDimension(); - mcIdType const sz(ToIdType(std::distance(dxyzStart,dxyzStop))); + mcIdType sz(ToIdType(std::distance(dxyzStart,dxyzStop))); if(sz!=_space_dim) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setDXYZ : input vector of dxyz vector has not the right size ! Or change space dimension before calling it !"); std::copy(dxyzStart,dxyzStop,_dxyz); @@ -187,7 +176,7 @@ std::string MEDCouplingIMesh::getAxisUnit() const double MEDCouplingIMesh::getMeasureOfAnyCell() const { checkConsistencyLight(); - int const dim(getSpaceDimension()); + int dim(getSpaceDimension()); double ret(1.); for(int i=0;icopyTinyInfoFrom(this); } catch(INTERP_KERNEL::Exception& ) { } - int const spaceDim(getSpaceDimension()); + int spaceDim(getSpaceDimension()); std::vector infos(buildInfoOnComponents()); for(int i=0;i& factors) std::ostringstream oss; oss << "MEDCouplingIMesh::refineWithFactor : factor for axis #" << i << " (" << factors[i] << ")is invalid ! Must be > 0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType const factAbs(std::abs(factors[i])); - double const fact2(1./(double)factors[i]); + mcIdType factAbs(std::abs(factors[i])); + double fact2(1./(double)factors[i]); structure[i]=(_structure[i]-1)*factAbs+1; dxyz[i]=fact2*_dxyz[i]; } @@ -298,9 +287,9 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseS throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : All input vectors (dimension) must have the same size !"); if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !"); - std::size_t const meshDim(coarseSt.size()); + std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); - std::size_t const nbCompo=fineDA->getNumberOfComponents(); + std::size_t nbCompo=fineDA->getNumberOfComponents(); if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) @@ -310,7 +299,7 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseS std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType const nbTuplesFine(fineDA->getNumberOfTuples()); + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()); if(nbOfTuplesInFineExp==0) { if(nbTuplesFine==0) @@ -320,7 +309,7 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseS } if(nbTuplesFine%nbOfTuplesInFineExp!=0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : Invalid nb of tuples in fine DataArray regarding its structure !"); - mcIdType const fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies())); + mcIdType fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies())); if(nbTuplesFine!=fact*nbOfTuplesInFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Invalid number of tuples (" << nbTuplesFine << ") of fine dataarray is invalid ! Must be " << fact*nbOfTuplesInFineExp << "!"; @@ -429,9 +418,9 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& co if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the parameters 1 or 3 are NULL or not allocated !"); std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); - std::size_t const meshDim(coarseSt.size()); - mcIdType const nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - std::size_t const nbCompo(fineDA->getNumberOfComponents()); + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); + std::size_t nbCompo(fineDA->getNumberOfComponents()); if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) @@ -477,7 +466,7 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& co } case 2: { - mcIdType const nxwg(coarseSt[0]+2*ghostSize); + mcIdType nxwg(coarseSt[0]+2*ghostSize); mcIdType kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)),fact1(facts[1]),fact0(facts[0]); inPtr+=(dims[0]*fact0+2*ghostSize)*ghostSize*nbCompo; for(int j=0;j& co inPtr+=ghostSize*(dims[0]*fact0+2*ghostSize)*nbCompo; for(int j=0;jisAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !"); - std::size_t const meshDim(coarseSt.size()); + std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); - std::size_t const nbCompo=fineDA->getNumberOfComponents(); + std::size_t nbCompo=fineDA->getNumberOfComponents(); if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) @@ -571,10 +560,10 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType const nbTuplesFine(fineDA->getNumberOfTuples()); + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()); if(nbTuplesFine%nbOfTuplesInFineExp!=0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : Invalid nb of tuples in fine DataArray regarding its structure !"); - mcIdType const fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies())); + mcIdType fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies())); if(nbTuplesFine!=fact*nbOfTuplesInFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Invalid number of tuples (" << nbTuplesFine << ") of fine dataarray is invalid ! Must be " << fact*nbOfTuplesInFineExp << "!"; @@ -666,9 +655,9 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the parameters 1 or 3 are NULL or not allocated !"); std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); - std::size_t const meshDim(coarseSt.size()); - mcIdType const nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - std::size_t const nbCompo=fineDA->getNumberOfComponents(); + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); + std::size_t nbCompo=fineDA->getNumberOfComponents(); if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) @@ -759,9 +748,9 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the parameters 1 or 3 are NULL or not allocated !"); std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); - std::size_t const meshDim(coarseSt.size()); - mcIdType const nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - std::size_t const nbCompo=fineDA->getNumberOfComponents(); + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); + std::size_t nbCompo=fineDA->getNumberOfComponents(); if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) @@ -853,7 +842,7 @@ std::vector MEDCouplingIMesh::getDirectChildrenWithNull */ void MEDCouplingIMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingIMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::copyTinyStringsFrom : meshes have not same type !"); MEDCouplingStructuredMesh::copyTinyStringsFrom(other); @@ -864,7 +853,7 @@ bool MEDCouplingIMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::isEqualIfNotWhy : input other pointer is null !"); - const auto *otherC(dynamic_cast(other)); + const MEDCouplingIMesh *otherC(dynamic_cast(other)); if(!otherC) { reason="mesh given in input is not castable in MEDCouplingIMesh !"; @@ -884,7 +873,7 @@ bool MEDCouplingIMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec bool MEDCouplingIMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingIMesh *otherC=dynamic_cast(other); if(!otherC) return false; std::string tmp; @@ -893,7 +882,7 @@ bool MEDCouplingIMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other bool MEDCouplingIMesh::isEqualWithoutConsideringStrInternal(const MEDCouplingMesh *other, double prec, std::string& reason) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingIMesh *otherC=dynamic_cast(other); if(!otherC) return false; if(_space_dim!=otherC->_space_dim) @@ -936,8 +925,8 @@ bool MEDCouplingIMesh::isEqualWithoutConsideringStrInternal(const MEDCouplingMes return true; } -void MEDCouplingIMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec, - DataArrayIdType *& /*cellCor*/, DataArrayIdType *& /*nodeCor*/) const +void MEDCouplingIMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalWith : Meshes are not the same !"); @@ -947,8 +936,8 @@ void MEDCouplingIMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int / * Nothing is done here (except to check that the other is a MEDCoupling::MEDCouplingIMesh instance too). * The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingIMesh, \a this and \a other are the same ! */ -void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int /*cellCompPol*/, double prec, - DataArrayIdType *& /*cellCor*/) const +void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayIdType *&cellCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !"); @@ -965,7 +954,7 @@ void MEDCouplingIMesh::checkConsistencyLight() const } } -void MEDCouplingIMesh::checkConsistency(double /*eps*/) const +void MEDCouplingIMesh::checkConsistency(double eps) const { checkConsistencyLight(); } @@ -986,7 +975,7 @@ std::vector MEDCouplingIMesh::getNodeGridStructure() const MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { checkConsistencyLight(); - int const dim(getSpaceDimension()); + int dim(getSpaceDimension()); if(dim!=ToIdType(cellPart.size())) { std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !"; @@ -998,7 +987,7 @@ MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::v for(int i=0;i=_structure[i]) { std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : At dimension #" << i << " the start node id is " << startNode << " it should be in [0," << _structure[i] << ") !"; @@ -1029,7 +1018,7 @@ int MEDCouplingIMesh::getSpaceDimension() const void MEDCouplingIMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { mcIdType tmp[3]; - int const spaceDim(getSpaceDimension()); + int spaceDim(getSpaceDimension()); getSplitNodeValues(tmp); mcIdType tmp2[3]; GetPosFromId(nodeId,spaceDim,tmp,tmp2); @@ -1043,8 +1032,8 @@ std::string MEDCouplingIMesh::simpleRepr() const ret << "Image grid with name : \"" << getName() << "\"\n"; ret << "Description of mesh : \"" << getDescription() << "\"\n"; int tmpp1,tmpp2; - double const tt(getTime(tmpp1,tmpp2)); - int const spaceDim(_space_dim); + double tt(getTime(tmpp1,tmpp2)); + int spaceDim(_space_dim); ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n"; ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; ret << "Space dimension : " << spaceDim << "\n"; @@ -1066,7 +1055,7 @@ std::string MEDCouplingIMesh::advancedRepr() const void MEDCouplingIMesh::getBoundingBox(double *bbox) const { checkConsistencyLight(); - int const dim(getSpaceDimension()); + int dim(getSpaceDimension()); for(int idim=0; idimsetName(name); DataArrayDouble* array(DataArrayDouble::New()); @@ -1114,20 +1103,20 @@ MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureField(bool /*isAbs*/) const /*! * not implemented yet ! */ -MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureFieldOnNode(bool /*isAbs*/) const +MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureFieldOnNode(bool isAbs) const { throw INTERP_KERNEL::Exception("MEDCouplingIMesh::getMeasureFieldOnNode : not implemented yet !"); //return 0; } -mcIdType MEDCouplingIMesh::getCellContainingPoint(const double *pos, double /*eps*/) const +mcIdType MEDCouplingIMesh::getCellContainingPoint(const double *pos, double eps) const { mcIdType dim(getSpaceDimension()),ret(0),coeff(1); for(mcIdType i=0;i=0 && tmp& elts) const { - mcIdType const ret(getCellContainingPoint(pos,eps)); + mcIdType ret(getCellContainingPoint(pos,eps)); elts.push_back(ret); } -void MEDCouplingIMesh::rotate(const double * /*center*/, const double * /*vector*/, double /*angle*/) +void MEDCouplingIMesh::rotate(const double *center, const double *vector, double angle) { throw INTERP_KERNEL::Exception("No rotation available on IMesh : Traduce it to unstructured mesh to apply it !"); } @@ -1159,7 +1148,7 @@ void MEDCouplingIMesh::rotate(const double * /*center*/, const double * /*vector void MEDCouplingIMesh::translate(const double *vector) { checkSpaceDimension(); - int const dim(getSpaceDimension()); + int dim(getSpaceDimension()); std::transform(_origin,_origin+dim,vector,_origin,std::plus()); declareAsNew(); } @@ -1173,7 +1162,7 @@ void MEDCouplingIMesh::translate(const double *vector) void MEDCouplingIMesh::scale(const double *point, double factor) { checkSpaceDimension(); - int const dim(getSpaceDimension()); + int dim(getSpaceDimension()); std::transform(_origin,_origin+dim,point,_origin,std::minus()); std::transform(_origin,_origin+dim,_origin,std::bind(std::multiplies(),std::placeholders::_1,factor)); std::transform(_dxyz,_dxyz+dim,_dxyz,std::bind(std::multiplies(),std::placeholders::_1,factor)); @@ -1181,10 +1170,10 @@ void MEDCouplingIMesh::scale(const double *point, double factor) declareAsNew(); } -MEDCouplingMesh *MEDCouplingIMesh::mergeMyselfWith(const MEDCouplingMesh * /*other*/) const +MEDCouplingMesh *MEDCouplingIMesh::mergeMyselfWith(const MEDCouplingMesh *other) const { //not implemented yet ! - return nullptr; + return 0; } /*! @@ -1198,8 +1187,8 @@ DataArrayDouble *MEDCouplingIMesh::getCoordinatesAndOwner() const { checkConsistencyLight(); MCAuto ret(DataArrayDouble::New()); - int const spaceDim(getSpaceDimension()); - mcIdType const nbNodes(getNumberOfNodes()); + int spaceDim(getSpaceDimension()); + mcIdType nbNodes(getNumberOfNodes()); ret->alloc(nbNodes,spaceDim); double *pt(ret->getPointer()); ret->setInfoOnComponents(buildInfoOnComponents()); @@ -1226,7 +1215,7 @@ DataArrayDouble *MEDCouplingIMesh::computeCellCenterOfMass() const { checkConsistencyLight(); MCAuto ret(DataArrayDouble::New()); - int const spaceDim(getSpaceDimension()); + int spaceDim(getSpaceDimension()); mcIdType nbCells(ToIdType(getNumberOfCells())),tmp[3],tmp2[3]; ret->alloc(nbCells,spaceDim); double *pt(ret->getPointer()),shiftOrigin[3]; @@ -1248,7 +1237,7 @@ DataArrayDouble *MEDCouplingIMesh::computeIsoBarycenterOfNodesPerCell() const return MEDCouplingIMesh::computeCellCenterOfMass(); } -void MEDCouplingIMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*check*/) +void MEDCouplingIMesh::renumberCells(const mcIdType *old2NewBg, bool check) { throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for IMesh !"); } @@ -1256,7 +1245,7 @@ void MEDCouplingIMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*che void MEDCouplingIMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; - double const time(getTime(it,order)); + double time(getTime(it,order)); tinyInfo.clear(); tinyInfoD.clear(); littleStrings.clear(); @@ -1273,7 +1262,7 @@ void MEDCouplingIMesh::getTinySerializationInformation(std::vector& tiny tinyInfoD.insert(tinyInfoD.end(),_origin,_origin+3); } -void MEDCouplingIMesh::resizeForUnserialization(const std::vector& /*tinyInfo*/, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& /*littleStrings*/) const +void MEDCouplingIMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { a1->alloc(0,1); a2->alloc(0,1); @@ -1287,7 +1276,7 @@ void MEDCouplingIMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) con a2->alloc(0,1); } -void MEDCouplingIMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType * /*a1*/, DataArrayDouble * /*a2*/, +void MEDCouplingIMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { setName(littleStrings[0]); @@ -1302,7 +1291,7 @@ void MEDCouplingIMesh::unserialization(const std::vector& tinyInfoD, con declareAsNew(); } -void MEDCouplingIMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte * /*byteData*/) const +void MEDCouplingIMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const { checkConsistencyLight(); std::ostringstream extent,origin,spacing; @@ -1336,8 +1325,8 @@ void MEDCouplingIMesh::reprQuickOverview(std::ostream& stream) const bool isPb(false); for(int i=0;i<_space_dim;i++) { - char const tmp=(char)((int)('X')+i); - mcIdType const tmpNodes(_structure[i]); + char tmp=(char)((int)('X')+i); + mcIdType tmpNodes(_structure[i]); stream1 << "- Axis " << tmp << " : " << tmpNodes << " nodes (orig=" << _origin[i] << ", inter=" << _dxyz[i] << ")."; if(i!=_space_dim-1) stream1 << std::endl; @@ -1371,12 +1360,12 @@ std::string MEDCouplingIMesh::getVTKDataSetType() const std::vector MEDCouplingIMesh::buildInfoOnComponents() const { checkSpaceDimension(); - int const dim(getSpaceDimension()); + int dim(getSpaceDimension()); std::vector ret(dim); for(int i=0;i= ghostlev + mcIdType kk0(kk+1+dims[0]);//1 not ghost. We make the hypothesis that factors is >= ghostlev outPtr2+=fact0*nbCompo*dims[0]; for(mcIdType ig=0;ig -#include -#include -#include -#include namespace MEDCoupling { @@ -63,59 +55,59 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize); MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize); // - MEDCOUPLING_EXPORT MEDCouplingIMesh *deepCopy() const override; - MEDCOUPLING_EXPORT MEDCouplingIMesh *clone(bool recDeepCpy) const override; - MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override; + MEDCOUPLING_EXPORT MEDCouplingIMesh *deepCopy() const; + MEDCOUPLING_EXPORT MEDCouplingIMesh *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const; MEDCOUPLING_EXPORT MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const; - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return IMAGE_GRID; } - MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return IMAGE_GRID; } + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor) const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override; - MEDCOUPLING_EXPORT int getSpaceDimension() const override; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const override; - MEDCOUPLING_EXPORT std::string simpleRepr() const override; - MEDCOUPLING_EXPORT std::string advancedRepr() const override; + DataArrayIdType *&cellCor) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; + MEDCOUPLING_EXPORT int getSpaceDimension() const; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const; + MEDCOUPLING_EXPORT std::string simpleRepr() const; + MEDCOUPLING_EXPORT std::string advancedRepr() const; // tools - MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override; - MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const override; - MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override; - MEDCOUPLING_EXPORT void translate(const double *vector) override; - MEDCOUPLING_EXPORT void scale(const double *point, double factor) override; - MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override; - MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override; - MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override; + MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; + MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle); + MEDCOUPLING_EXPORT void translate(const double *vector); + MEDCOUPLING_EXPORT void scale(const double *point, double factor); + MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; + MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); //some useful methods - MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const override; - MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const override; - MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const override; + MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const; + MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const; + MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; //serialisation-unserialization - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, - const std::vector& littleStrings) override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; - MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override; + const std::vector& littleStrings); + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; + MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; private: MEDCouplingIMesh(); MEDCouplingIMesh(const MEDCouplingIMesh& other, bool deepCopy); - ~MEDCouplingIMesh() override; - void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override; - std::string getVTKDataSetType() const override; + ~MEDCouplingIMesh(); + void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; + std::string getVTKDataSetType() const; bool isEqualWithoutConsideringStrInternal(const MEDCouplingMesh *other, double prec, std::string& reason) const; std::vector buildInfoOnComponents() const; void checkSpaceDimension() const; diff --git a/src/MEDCoupling/MEDCouplingMap.cxx b/src/MEDCoupling/MEDCouplingMap.cxx index 7ef340dbe..df00a68be 100644 --- a/src/MEDCoupling/MEDCouplingMap.cxx +++ b/src/MEDCoupling/MEDCouplingMap.cxx @@ -19,7 +19,6 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingMap.txx" -#include "MCIdType.hxx" using namespace MEDCoupling; diff --git a/src/MEDCoupling/MEDCouplingMap.hxx b/src/MEDCoupling/MEDCouplingMap.hxx index 29d597f83..2bfc5a07d 100644 --- a/src/MEDCoupling/MEDCouplingMap.hxx +++ b/src/MEDCoupling/MEDCouplingMap.hxx @@ -21,15 +21,14 @@ #ifndef __MEDCOUPLING_MEDCOUPLINGMAP_HXX__ #define __MEDCOUPLING_MEDCOUPLINGMAP_HXX__ +#include "MEDCoupling.hxx" #include "MCAuto.hxx" #include "MCType.hxx" #include "MEDCouplingTimeLabel.hxx" #include "MEDCouplingRefCountObject.hxx" +#include "InterpKernelException.hxx" -#include #include -#include -#include namespace MEDCoupling { @@ -41,12 +40,12 @@ namespace MEDCoupling std::string getClassName() const override { return std::string("MapKeyVal"); } std::map& data() { return _m; } const std::map& data() const { return _m; } - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; - void updateTime() const override { } + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; + void updateTime() const { } private: MapKeyVal() { } - ~MapKeyVal() override = default; + ~MapKeyVal() { } private: std::map _m; }; diff --git a/src/MEDCoupling/MEDCouplingMap.txx b/src/MEDCoupling/MEDCouplingMap.txx index bf78a9c31..54bdcab2c 100644 --- a/src/MEDCoupling/MEDCouplingMap.txx +++ b/src/MEDCoupling/MEDCouplingMap.txx @@ -21,12 +21,7 @@ #ifndef __MEDCOUPLING_MEDCOUPLINGMAP_TXX__ #define __MEDCOUPLING_MEDCOUPLINGMAP_TXX__ -#include "MCAuto.hxx" #include "MEDCouplingMap.hxx" -#include -#include -#include -#include "MEDCouplingRefCountObject.hxx" namespace MEDCoupling { diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx index 249718563..e709a49a4 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx @@ -19,10 +19,6 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingMappedExtrudedMesh.hxx" -#include "MCType.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCIdType.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingMemArray.hxx" @@ -31,20 +27,15 @@ #include "CellModel.hxx" #include "InterpolationUtils.hxx" -#include "NormalizedGeometricTypes" -#include #include -#include #include #include #include -#include #include #include +#include #include -#include -#include using namespace MEDCoupling; @@ -99,7 +90,7 @@ std::vector MEDCouplingMappedExtrudedMesh::getDirectChi */ void MEDCouplingMappedExtrudedMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingMappedExtrudedMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::copyTinyStringsFrom : meshes have not same type !"); MEDCouplingMesh::copyTinyStringsFrom(other); @@ -108,7 +99,7 @@ void MEDCouplingMappedExtrudedMesh::copyTinyStringsFrom(const MEDCouplingMesh *o } MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId) -try:_mesh2D(const_cast(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(nullptr),_cell_2D_id(cell2DId) +try:_mesh2D(const_cast(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId) { if(_mesh2D.isNotNull()) _mesh2D->incrRef(); @@ -120,7 +111,7 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D):_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(nullptr),_cell_2D_id(0) +MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D):_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(0) { if(!mesh3D) throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh contrct : null input pointer !"); @@ -135,7 +126,7 @@ MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingCM setName(mesh3D->getName()); setDescription(mesh3D->getDescription()); } -MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh():_mesh2D(nullptr),_mesh1D(nullptr),_mesh3D_ids(nullptr),_cell_2D_id(-1) +MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh():_mesh2D(0),_mesh1D(0),_mesh3D_ids(0),_cell_2D_id(-1) { } @@ -194,7 +185,7 @@ bool MEDCouplingMappedExtrudedMesh::isEqualIfNotWhy(const MEDCouplingMesh *other { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::isEqualIfNotWhy : input other pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCouplingMappedExtrudedMesh *otherC=dynamic_cast(other); std::ostringstream oss; if(!otherC) { @@ -229,7 +220,7 @@ bool MEDCouplingMappedExtrudedMesh::isEqualIfNotWhy(const MEDCouplingMesh *other bool MEDCouplingMappedExtrudedMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingMappedExtrudedMesh *otherC=dynamic_cast(other); if(!otherC) return false; if(!_mesh2D->isEqualWithoutConsideringStr(otherC->_mesh2D,prec)) @@ -243,14 +234,14 @@ bool MEDCouplingMappedExtrudedMesh::isEqualWithoutConsideringStr(const MEDCoupli return true; } -void MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith(const MEDCouplingMesh * /*other*/, int /*cellCompPol*/, double /*prec*/, - DataArrayIdType *& /*cellCor*/, DataArrayIdType *& /*nodeCor*/) const +void MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith : not implemented yet !"); } -void MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh * /*other*/, int /*cellCompPol*/, double /*prec*/, - DataArrayIdType *& /*cellCor*/) const +void MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayIdType *&cellCor) const { throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith : not implemented yet !"); } @@ -258,29 +249,29 @@ void MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCou INTERP_KERNEL::NormalizedCellType MEDCouplingMappedExtrudedMesh::getTypeOfCell(mcIdType cellId) const { const mcIdType *ids(_mesh3D_ids->begin()); - std::size_t const nbOf3DCells(_mesh3D_ids->getNumberOfTuples()); + std::size_t nbOf3DCells(_mesh3D_ids->getNumberOfTuples()); const mcIdType *where(std::find(ids,ids+nbOf3DCells,cellId)); if(where==ids+nbOf3DCells) throw INTERP_KERNEL::Exception("Invalid cellId specified >= getNumberOfCells() !"); - std::size_t const nbOfCells2D(_mesh2D->getNumberOfCells()); - std::size_t const locId((std::distance(ids,where))%nbOfCells2D); - INTERP_KERNEL::NormalizedCellType const tmp(_mesh2D->getTypeOfCell(ToIdType(locId))); + std::size_t nbOfCells2D(_mesh2D->getNumberOfCells()); + std::size_t locId((std::distance(ids,where))%nbOfCells2D); + INTERP_KERNEL::NormalizedCellType tmp(_mesh2D->getTypeOfCell(ToIdType(locId))); return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType(); } std::set MEDCouplingMappedExtrudedMesh::getAllGeoTypes() const { - std::set const ret2D(_mesh2D->getAllGeoTypes()); + std::set ret2D(_mesh2D->getAllGeoTypes()); std::set ret; - for(auto it : ret2D) - ret.insert(INTERP_KERNEL::CellModel::GetCellModel(it).getExtrudedType()); + for(std::set::const_iterator it=ret2D.begin();it!=ret2D.end();it++) + ret.insert(INTERP_KERNEL::CellModel::GetCellModel(*it).getExtrudedType()); return ret; } DataArrayIdType *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type)); - INTERP_KERNEL::NormalizedCellType const revExtTyp(cm.getReverseExtrudedType()); + INTERP_KERNEL::NormalizedCellType revExtTyp(cm.getReverseExtrudedType()); MCAuto ret(DataArrayIdType::New()); if(revExtTyp==INTERP_KERNEL::NORM_ERROR) { @@ -288,9 +279,9 @@ DataArrayIdType *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL: return ret.retn(); } MCAuto tmp(_mesh2D->giveCellsWithType(revExtTyp)); - mcIdType const nbOfLevs=_mesh1D->getNumberOfCells(); - mcIdType const nbOfCells2D=_mesh2D->getNumberOfCells(); - mcIdType const nbOfTuples(tmp->getNumberOfTuples()); + mcIdType nbOfLevs=_mesh1D->getNumberOfCells(); + mcIdType nbOfCells2D=_mesh2D->getNumberOfCells(); + mcIdType nbOfTuples(tmp->getNumberOfTuples()); ret->alloc(nbOfLevs*nbOfTuples,1); mcIdType *pt(ret->getPointer()); for(int i=0;i ret2D(_mesh2D->computeNbOfNodesPerCell()); - mcIdType const nbOfLevs=_mesh1D->getNumberOfCells(); - mcIdType const nbOfCells2D=_mesh2D->getNumberOfCells(); + mcIdType nbOfLevs=_mesh1D->getNumberOfCells(); + mcIdType nbOfCells2D=_mesh2D->getNumberOfCells(); MCAuto ret3D(DataArrayIdType::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); mcIdType *pt(ret3D->getPointer()); for(int i=0;i ret2D(_mesh2D->computeNbOfNodesPerCell()); - mcIdType const nbOfLevs=_mesh1D->getNumberOfCells(); - mcIdType const nbOfCells2D=_mesh2D->getNumberOfCells(); + mcIdType nbOfLevs=_mesh1D->getNumberOfCells(); + mcIdType nbOfCells2D=_mesh2D->getNumberOfCells(); MCAuto ret3D(DataArrayIdType::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); mcIdType *pt(ret3D->getPointer()); for(int i=0;igetNumberOfCells()); + mcIdType nbOfCells2D(_mesh2D->getNumberOfCells()); for(mcIdType i=0;igetTypeOfCell(i)); + INTERP_KERNEL::NormalizedCellType t(_mesh2D->getTypeOfCell(i)); if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type) ret++; } @@ -346,10 +337,10 @@ mcIdType MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL:: void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - mcIdType const nbOfCells2D(_mesh2D->getNumberOfCells()); - mcIdType const nbOfNodes2D(_mesh2D->getNumberOfNodes()); - mcIdType const locId(cellId%nbOfCells2D); - mcIdType const lev(cellId/nbOfCells2D); + mcIdType nbOfCells2D(_mesh2D->getNumberOfCells()); + mcIdType nbOfNodes2D(_mesh2D->getNumberOfNodes()); + mcIdType locId(cellId%nbOfCells2D); + mcIdType lev(cellId/nbOfCells2D); std::vector tmp,tmp2; _mesh2D->getNodeIdsOfCell(locId,tmp); tmp2=tmp; @@ -361,13 +352,13 @@ void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(mcIdType cellId, std::vecto void MEDCouplingMappedExtrudedMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { - mcIdType const nbOfNodes2D(_mesh2D->getNumberOfNodes()); - mcIdType const locId(nodeId%nbOfNodes2D); - mcIdType const lev(nodeId/nbOfNodes2D); + mcIdType nbOfNodes2D(_mesh2D->getNumberOfNodes()); + mcIdType locId(nodeId%nbOfNodes2D); + mcIdType lev(nodeId/nbOfNodes2D); std::vector tmp,tmp2; _mesh2D->getCoordinatesOfNode(locId,tmp); tmp2=tmp; - int const spaceDim(_mesh1D->getSpaceDimension()); + int spaceDim(_mesh1D->getSpaceDimension()); const double *z(_mesh1D->getCoords()->begin()); std::transform(tmp.begin(),tmp.end(),z+lev*spaceDim,tmp.begin(),std::plus()); std::transform(tmp2.begin(),tmp2.end(),z+(lev+1)*spaceDim,tmp2.begin(),std::plus()); @@ -381,7 +372,7 @@ std::string MEDCouplingMappedExtrudedMesh::simpleRepr() const ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n"; ret << "Description of mesh : \"" << getDescription() << "\"\n"; int tmpp1,tmpp2; - double const tt=getTime(tmpp1,tmpp2); + double tt=getTime(tmpp1,tmpp2); ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n"; ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n"; @@ -398,7 +389,7 @@ std::string MEDCouplingMappedExtrudedMesh::advancedRepr() const ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n"; ret << "Description of mesh : \"" << getDescription() << "\"\n"; int tmpp1,tmpp2; - double const tt=getTime(tmpp1,tmpp2); + double tt=getTime(tmpp1,tmpp2); ret << "Time attached to the mesh (unit) : " << tt << " (" << getTimeUnit() << ")\n"; ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n"; @@ -414,7 +405,7 @@ void MEDCouplingMappedExtrudedMesh::checkConsistencyLight() const { } -void MEDCouplingMappedExtrudedMesh::checkConsistency(double /*eps*/) const +void MEDCouplingMappedExtrudedMesh::checkConsistency(double eps) const { checkConsistencyLight(); } @@ -424,7 +415,7 @@ void MEDCouplingMappedExtrudedMesh::getBoundingBox(double *bbox) const double bbox2D[6]; _mesh2D->getBoundingBox(bbox2D); const double *nodes1D(_mesh1D->getCoords()->begin()); - mcIdType const nbOfNodes1D(_mesh1D->getNumberOfNodes()); + mcIdType nbOfNodes1D(_mesh1D->getNumberOfNodes()); double bbox1DMin[3],bbox1DMax[3],tmp[3]; std::fill(bbox1DMin,bbox1DMin+3,std::numeric_limits::max()); std::fill(bbox1DMax,bbox1DMax+3,-(std::numeric_limits::max())); @@ -434,7 +425,7 @@ void MEDCouplingMappedExtrudedMesh::getBoundingBox(double *bbox) const std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast(std::max)); } std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus()); - mcIdType const id=ToIdType(std::distance(tmp,std::max_element(tmp,tmp+3))); + mcIdType id=ToIdType(std::distance(tmp,std::max_element(tmp,tmp+3))); bbox[0]=bbox1DMin[0]; bbox[1]=bbox1DMax[0]; bbox[2]=bbox1DMin[1]; bbox[3]=bbox1DMax[1]; bbox[4]=bbox1DMin[2]; bbox[5]=bbox1DMax[2]; @@ -449,7 +440,7 @@ void MEDCouplingMappedExtrudedMesh::updateTime() const updateTimeWith(*_mesh1D); } -void MEDCouplingMappedExtrudedMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*check*/) +void MEDCouplingMappedExtrudedMesh::renumberCells(const mcIdType *old2NewBg, bool check) { throw INTERP_KERNEL::Exception("Functionality of renumbering cells unavailable for ExtrudedMesh"); } @@ -502,10 +493,10 @@ MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureField(bool) con return ret.retn(); } -MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureFieldOnNode(bool /*isAbs*/) const +MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureFieldOnNode(bool isAbs) const { //not implemented yet - return nullptr; + return 0; } MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::buildOrthogonalField() const @@ -513,25 +504,26 @@ MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::buildOrthogonalField() co throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::buildOrthogonalField : This method has no sense for MEDCouplingMappedExtrudedMesh that is 3D !"); } -mcIdType MEDCouplingMappedExtrudedMesh::getCellContainingPoint(const double * /*pos*/, double /*eps*/) const +mcIdType MEDCouplingMappedExtrudedMesh::getCellContainingPoint(const double *pos, double eps) const { throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::getCellContainingPoint : not implemented yet !"); } -void MEDCouplingMappedExtrudedMesh::getCellsContainingPoint(const double * /*pos*/, double /*eps*/, std::vector& /*elts*/) const +void MEDCouplingMappedExtrudedMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::getCellsContainingPoint : not implemented yet !"); } MEDCouplingMappedExtrudedMesh::~MEDCouplingMappedExtrudedMesh() -= default; +{ +} void MEDCouplingMappedExtrudedMesh::computeExtrusion(const MEDCouplingUMesh *mesh3D) { const char errMsg1[]="2D mesh is empty unable to compute extrusion !"; const char errMsg2[]="Coords between 2D and 3D meshes are not the same ! Try MEDCouplingPointSet::tryToShareSameCoords method"; const char errMsg3[]="No chance to find extrusion pattern in mesh3D,mesh2D couple because nbCells3D%nbCells2D!=0 !"; - if(_mesh2D.isNull() || mesh3D==nullptr) + if(_mesh2D.isNull() || mesh3D==0) throw INTERP_KERNEL::Exception(errMsg1); if(_mesh2D->getCoords()!=mesh3D->getCoords()) throw INTERP_KERNEL::Exception(errMsg2); @@ -549,7 +541,7 @@ void MEDCouplingMappedExtrudedMesh::build1DExtrusion(mcIdType idIn3DDesc, mcIdTy const mcIdType *revDesc3D, const mcIdType *revDescIndx3D, bool computeMesh1D) { - mcIdType const nbOf2DCells=_mesh2D->getNumberOfCells(); + mcIdType nbOf2DCells=_mesh2D->getNumberOfCells(); mcIdType start(revDescIndx3D[idIn3DDesc]); mcIdType end(revDescIndx3D[idIn3DDesc+1]); if(end-start!=1) @@ -604,9 +596,9 @@ mcIdType MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(mcIdType current2DCel const mcIdType *desc3D, const mcIdType *descIndx3D, const mcIdType *conn2D, const mcIdType *conn2DIndx) { - mcIdType const start(descIndx3D[current3DCell]); - mcIdType const end(descIndx3D[current3DCell+1]); - bool const found=false; + mcIdType start(descIndx3D[current3DCell]); + mcIdType end(descIndx3D[current3DCell+1]); + bool found=false; for(const mcIdType *candidate2D=desc3D+start;candidate2D!=desc3D+end && !found;candidate2D++) { if(*candidate2D!=current2DCell) @@ -630,19 +622,19 @@ void MEDCouplingMappedExtrudedMesh::computeBaryCenterOfFace(const std::vectorgetCoords()->getPointer()+lev1DId*3); std::fill(zoneToUpdate,zoneToUpdate+3,0.); const double *coords(_mesh2D->getCoords()->begin()); - for(long const iter : nodalConnec) - std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*iter,zoneToUpdate,std::plus()); + for(std::vector::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++) + std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus()); std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind(std::multiplies(),std::placeholders::_1,(1./(double)nodalConnec.size()))); } mcIdType MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector& nodalConnec, const mcIdType *revNodalPtr, const mcIdType *revNodalIndxPtr) { - auto iter=nodalConnec.begin(); + std::vector::const_iterator iter=nodalConnec.begin(); std::set s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); iter++; for(;iter!=nodalConnec.end();iter++) { - std::set const s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); + std::set s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); std::set s3; std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set >(s3,s3.end())); s1=s3; @@ -684,7 +676,7 @@ void MEDCouplingMappedExtrudedMesh::Project1DMeshes(const MEDCouplingUMesh *m1, m1->getCoordinatesOfNode(c[0],ref); m1->getCoordinatesOfNode(c[1],ref2); std::transform(ref2.begin(),ref2.end(),ref.begin(),v,std::minus()); - double const n=INTERP_KERNEL::norm<3>(v); + double n=INTERP_KERNEL::norm<3>(v); std::transform(v,v+3,v,std::bind(std::multiplies(),std::placeholders::_1,1/n)); m1->project1D(&ref[0],v,eps,m1r->getCoords()->getPointer()); m2->project1D(&ref[0],v,eps,m2r->getCoords()->getPointer()); @@ -713,37 +705,37 @@ std::vector MEDCouplingMappedExtrudedMesh::getDistributionOfTypes() co throw INTERP_KERNEL::Exception("Not implemented yet !"); } -DataArrayIdType *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector& /*code*/, const std::vector& /*idsPerType*/) const +DataArrayIdType *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } -void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayIdType * /*profile*/, std::vector& /*code*/, std::vector& /*idsInPflPerType*/, std::vector& /*idsPerType*/, bool /*smartPflKiller*/) const +void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } -MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPart(const mcIdType * /*start*/, const mcIdType * /*end*/) const +MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPart(const mcIdType *start, const mcIdType *end) const { // not implemented yet ! - return nullptr; + return 0; } -MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPartAndReduceNodes(const mcIdType * /*start*/, const mcIdType * /*end*/, DataArrayIdType*& /*arr*/) const +MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const { // not implemented yet ! - return nullptr; + return 0; } -DataArrayIdType *MEDCouplingMappedExtrudedMesh::simplexize(int /*policy*/) +DataArrayIdType *MEDCouplingMappedExtrudedMesh::simplexize(int policy) { throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::simplexize : unavailable for such a type of mesh : Extruded !"); } -MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::mergeMyselfWith(const MEDCouplingMesh * /*other*/) const +MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::mergeMyselfWith(const MEDCouplingMesh *other) const { // not implemented yet ! - return nullptr; + return 0; } DataArrayDouble *MEDCouplingMappedExtrudedMesh::getCoordinatesAndOwner() const @@ -752,8 +744,8 @@ DataArrayDouble *MEDCouplingMappedExtrudedMesh::getCoordinatesAndOwner() const const DataArrayDouble *arr1D(_mesh1D->getCoords()); MCAuto ret(DataArrayDouble::New()); ret->alloc(getNumberOfNodes(),3); - mcIdType const nbOf1DLev(_mesh1D->getNumberOfNodes()); - mcIdType const nbOf2DNodes(_mesh2D->getNumberOfNodes()); + mcIdType nbOf1DLev(_mesh1D->getNumberOfNodes()); + mcIdType nbOf2DNodes(_mesh2D->getNumberOfNodes()); const double *ptSrc(arr2D->begin()); double *pt(ret->getPointer()); std::copy(ptSrc,ptSrc+3*nbOf2DNodes,pt); @@ -788,7 +780,7 @@ void MEDCouplingMappedExtrudedMesh::getReverseNodalConnectivity(DataArrayIdType void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) { _mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1); - mcIdType const nbOf1DLev=mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells(); + mcIdType nbOf1DLev=mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells(); _mesh1D->setMeshDimension(1); _mesh1D->allocateCells(nbOf1DLev); mcIdType tmpConn[2]; @@ -813,11 +805,11 @@ void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh * const mcIdType *revNodalIndx2DPtr(revNodalIndx2D->begin()); const mcIdType *descP(desc->begin()),*descIndxP(descIndx->begin()),*revDescP(revDesc->begin()),*revDescIndxP(revDescIndx->begin()); // - mcIdType const nbOf2DCells=_mesh2D->getNumberOfCells(); + mcIdType nbOf2DCells=_mesh2D->getNumberOfCells(); for(mcIdType i=0;i const nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]); + std::vector nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]); try { idInSubMesh=FindCorrespCellByNodalConn(nodalConnec,revNodal2DPtr,revNodalIndx2DPtr); @@ -832,7 +824,7 @@ void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh * } } -void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector& /*tinyInfoD*/, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { std::vector tinyInfo1; std::vector ls1; @@ -856,10 +848,10 @@ void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector< void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { - std::size_t const sz=tinyInfo.size(); - mcIdType const sz1=tinyInfo[sz-2]; - std::vector const ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); - std::vector const ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); + std::size_t sz=tinyInfo.size(); + mcIdType sz1=tinyInfo[sz-2]; + std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); + std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); MEDCouplingUMesh *um=MEDCouplingUMesh::New(); DataArrayIdType *a1tmp=DataArrayIdType::New(); DataArrayDouble *a2tmp=DataArrayDouble::New(); @@ -882,8 +874,8 @@ void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vectorserialize(a1_1,a2_1); _mesh1D->serialize(a1_2,a2_2); a1->alloc(a1_1->getNbOfElems()+a1_2->getNbOfElems()+_mesh3D_ids->getNbOfElems(),1); @@ -901,15 +893,15 @@ void MEDCouplingMappedExtrudedMesh::serialize(DataArrayIdType *&a1, DataArrayDou a2_2->decrRef(); } -void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& /*tinyInfoD*/, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { setName(littleStrings[littleStrings.size()-2]); setDescription(littleStrings.back()); - std::size_t const sz=tinyInfo.size(); - mcIdType const sz1=tinyInfo[sz-2]; + std::size_t sz=tinyInfo.size(); + mcIdType sz1=tinyInfo[sz-2]; _cell_2D_id=tinyInfo[sz-3]; - std::vector const ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); - std::vector const ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); + std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); + std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); DataArrayIdType *a1tmp=DataArrayIdType::New(); DataArrayDouble *a2tmp=DataArrayDouble::New(); const mcIdType *a1Ptr=a1->begin(); @@ -922,7 +914,7 @@ void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& a2Ptr+=a2tmp->getNbOfElems(); a1Ptr+=a1tmp->getNbOfElems(); ls2.insert(ls2.end(),littleStrings.begin(),littleStrings.begin()+ls1.size()); - std::vector const d1(1); + std::vector d1(1); _mesh2D->unserialization(d1,ti1,a1tmp,a2tmp,ls2); a1tmp->decrRef(); a2tmp->decrRef(); // @@ -938,7 +930,7 @@ void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& a1tmp->decrRef(); a2tmp->decrRef(); // _mesh3D_ids=DataArrayIdType::New(); - mcIdType const szIds=ToIdType(std::distance(a1Ptr,a1->begin()))+a1->getNbOfElems(); + mcIdType szIds=ToIdType(std::distance(a1Ptr,a1->begin()))+a1->getNbOfElems(); _mesh3D_ids->alloc(szIds,1); std::copy(a1Ptr,a1Ptr+szIds,_mesh3D_ids->getPointer()); } diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx index cbf9fac1c..1725e8540 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx @@ -21,17 +21,9 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGEXTRUDEDMESH_HXX__ #define __PARAMEDMEM_MEDCOUPLINGEXTRUDEDMESH_HXX__ -#include "MCType.hxx" -#include "MCAuto.hxx" #include "MEDCoupling.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "NormalizedGeometricTypes" -#include -#include -#include -#include #include namespace MEDCoupling @@ -49,75 +41,75 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D); MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingMappedExtrudedMesh"); } - MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override; - MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const override; - MEDCOUPLING_EXPORT int getSpaceDimension() const override; - MEDCOUPLING_EXPORT int getMeshDimension() const override; - MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *deepCopy() const override; - MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *clone(bool recDeepCpy) const override; - MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override; + MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); + MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const; + MEDCOUPLING_EXPORT int getSpaceDimension() const; + MEDCOUPLING_EXPORT int getMeshDimension() const; + MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *deepCopy() const; + MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const; + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor) const override; - MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const override; - MEDCOUPLING_EXPORT std::set getAllGeoTypes() const override; - MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const override; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const override; - MEDCOUPLING_EXPORT std::string simpleRepr() const override; - MEDCOUPLING_EXPORT std::string advancedRepr() const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override; - MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override; - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override; + DataArrayIdType *&cellCor) const; + MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; + MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const; + MEDCOUPLING_EXPORT std::string simpleRepr() const; + MEDCOUPLING_EXPORT std::string advancedRepr() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; + MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh2D() const { return _mesh2D.iAmATrollConstCast(); } MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh1D() const { return _mesh1D.iAmATrollConstCast(); } MEDCOUPLING_EXPORT DataArrayIdType *getMesh3DIds() const { return _mesh3D_ids.iAmATrollConstCast(); } MEDCOUPLING_EXPORT MEDCouplingUMesh *build3DUnstructuredMesh() const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override; - MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const override; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; MEDCOUPLING_EXPORT static mcIdType FindCorrespCellByNodalConn(const std::vector& nodalConnec, const mcIdType *revNodalPtr, const mcIdType *revNodalIndxPtr); MEDCOUPLING_EXPORT static void Project1DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r, double *v); - MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override; - MEDCOUPLING_EXPORT void translate(const double *vector) override; - MEDCOUPLING_EXPORT void scale(const double *point, double factor) override; - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const override; - MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const override; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const override; - MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override; - MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override; - MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override; - MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override; + MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle); + MEDCOUPLING_EXPORT void translate(const double *vector); + MEDCOUPLING_EXPORT void scale(const double *point, double factor); + MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; + MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const; + MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy); + MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; + MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; + MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const; //Serialization unserialisation - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, - const std::vector& littleStrings) override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; - MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override; + const std::vector& littleStrings); + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; + MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; MEDCOUPLING_EXPORT mcIdType get2DCellIdForExtrusion() const { return _cell_2D_id; } private: MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId); @@ -134,9 +126,9 @@ namespace MEDCoupling const mcIdType *desc3D, const mcIdType *descIndx3D, const mcIdType *conn2D, const mcIdType *conn2DIndx); void computeBaryCenterOfFace(const std::vector& nodalConnec, mcIdType lev1DId); - ~MEDCouplingMappedExtrudedMesh() override; - void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override; - std::string getVTKDataSetType() const override; + ~MEDCouplingMappedExtrudedMesh(); + void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; + std::string getVTKDataSetType() const; private: MCAuto _mesh2D; MCAuto _mesh1D; diff --git a/src/MEDCoupling/MEDCouplingMatrix.cxx b/src/MEDCoupling/MEDCouplingMatrix.cxx old mode 100644 new mode 100755 index 625ca871e..bdec49e2a --- a/src/MEDCoupling/MEDCouplingMatrix.cxx +++ b/src/MEDCoupling/MEDCouplingMatrix.cxx @@ -21,19 +21,8 @@ #include "MEDCouplingMatrix.hxx" #include "InterpKernelMatrixTools.hxx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCIdType.hxx" - -#include -#include -#include + #include -#include -#include -#include using namespace MEDCoupling; @@ -254,13 +243,14 @@ DenseMatrix *DenseMatrix::Multiply(const DenseMatrix *a1, const DataArrayDouble } DenseMatrix::~DenseMatrix() -= default; +{ +} DenseMatrix::DenseMatrix(mcIdType nbRows, mcIdType nbCols):_nb_rows(nbRows),_nb_cols(nbCols),_data(DataArrayDouble::New()) { if(_nb_rows<0 || _nb_cols<0) throw INTERP_KERNEL::Exception("constructor of DenseMatrix : number of rows and number of cols must be > 0 both !"); - mcIdType const nbOfTuples(_nb_rows*_nb_cols); + mcIdType nbOfTuples(_nb_rows*_nb_cols); _data->alloc(nbOfTuples,1); } diff --git a/src/MEDCoupling/MEDCouplingMatrix.hxx b/src/MEDCoupling/MEDCouplingMatrix.hxx index a9125a7d2..66eeaeb6f 100644 --- a/src/MEDCoupling/MEDCouplingMatrix.hxx +++ b/src/MEDCoupling/MEDCouplingMatrix.hxx @@ -21,16 +21,13 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGMATRIX_HXX__ #define __PARAMEDMEM_MEDCOUPLINGMATRIX_HXX__ -#include "MCType.hxx" #include "MEDCoupling.hxx" #include "MEDCouplingTimeLabel.hxx" #include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingMemArray.hxx" #include "MCAuto.hxx" -#include -#include -#include +#include "InterpKernelException.hxx" namespace MEDCoupling { @@ -46,9 +43,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("DenseMatrix"); } MEDCOUPLING_EXPORT DenseMatrix *deepCopy() const; MEDCOUPLING_EXPORT DenseMatrix *shallowCpy() const; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT void updateTime() const override; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT void updateTime() const; // MEDCOUPLING_EXPORT mcIdType getNumberOfRows() const { return _nb_rows; } MEDCOUPLING_EXPORT mcIdType getNumberOfCols() const { return _nb_cols; } @@ -71,7 +68,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT const DataArrayDouble *getData() const { return _data; } MEDCOUPLING_EXPORT DataArrayDouble *getData() { return _data; } private: - ~DenseMatrix() override; + ~DenseMatrix(); DenseMatrix(mcIdType nbRows, mcIdType nbCols); DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols); mcIdType getNumberOfRowsExt(mcIdType nbRows) const; diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx old mode 100644 new mode 100755 index c9d533df1..84deb1ef3 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -21,38 +21,24 @@ #include "MEDCouplingMemArray.txx" #include "BBTree.txx" -#include "BBTreePts.txx" #include "GenMathFormulae.hxx" #include "InterpKernelAutoPtr.hxx" -#include "InterpKernelException.hxx" #include "InterpKernelExprParser.hxx" +#include "InterpKernelAutoPtr.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" +#include "InterpKernelAutoPtr.hxx" #include "InterpKernelGeo2DNode.hxx" #include "InterpKernelGeo2DEdgeLin.hxx" -#include "MEDCoupling.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCAuto.hxx" -#include "InterpKernelGeo2DPrecision.hxx" -#include "InterpolationUtils.hxx" - -#include -#include -#include -#include + #include #include #include #include #include #include -#include -#include -#include -using MYFUNCPTR = double (*)(double); +typedef double (*MYFUNCPTR)(double); using namespace MEDCoupling; @@ -85,7 +71,7 @@ template void DataArrayDouble::findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, mcIdType limitNodeId, double prec, DataArrayIdType *c, DataArrayIdType *cI) const { const double *coordsPtr=getConstPointer(); - BBTreePts const myTree(bbox,nullptr,0,nbNodes,prec); + BBTreePts myTree(bbox,0,0,nbNodes,prec); std::vector isDone(nbNodes); for(mcIdType i=0;i1) { std::vector commonNodes; - for(long const intersectingElem : intersectingElems) - if(intersectingElem!=i) - if(intersectingElem>=limitNodeId) + for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) + if(*it!=i) + if(*it>=limitNodeId) { - commonNodes.push_back(intersectingElem); - isDone[intersectingElem]=true; + commonNodes.push_back(*it); + isDone[*it]=true; } if(!commonNodes.empty()) { @@ -115,7 +101,7 @@ void DataArrayDouble::findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, } template -void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, mcIdType nbOfTuples, double /*eps*/, +void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, mcIdType nbOfTuples, double eps, DataArrayIdType *c, DataArrayIdType *cI) { for(mcIdType i=0;i intersectingElems; myTree.getElementsAroundPoint(pos+i*SPACEDIM,intersectingElems); std::vector commonNodes; - for(long const intersectingElem : intersectingElems) - commonNodes.push_back(intersectingElem); + for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) + commonNodes.push_back(*it); cI->pushBackSilent(cI->back()+ToIdType(commonNodes.size())); c->insertAtTheEnd(commonNodes.begin(),commonNodes.end()); } } template -void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double * /*thisPt*/, mcIdType /*thisNbOfTuples*/, mcIdType *res) +void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double *thisPt, mcIdType thisNbOfTuples, mcIdType *res) { double distOpt = std::max(dist, std::numeric_limits::epsilon()); const double *p(pos); @@ -141,7 +127,7 @@ void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts& while(true) { mcIdType elem=-1; - double const ret=myTree.getElementsAroundPoint2(p,distOpt,elem); + double ret=myTree.getElementsAroundPoint2(p,distOpt,elem); if(ret!=std::numeric_limits::max()) { distOpt=std::max(ret,1e-4); @@ -172,11 +158,11 @@ mcIdType DataArray::EffectiveCircPerm(mcIdType nbOfShift, mcIdType nbOfTuples) std::size_t DataArray::getHeapMemorySizeWithoutChildren() const { - std::size_t const sz1=_name.capacity(); - std::size_t const sz2=_info_on_compo.capacity(); + std::size_t sz1=_name.capacity(); + std::size_t sz2=_info_on_compo.capacity(); std::size_t sz3=0; - for(const auto & it : _info_on_compo) - sz3+=it.capacity(); + for(std::vector::const_iterator it=_info_on_compo.begin();it!=_info_on_compo.end();it++) + sz3+=(*it).capacity(); return sz1+sz2+sz3; } @@ -215,8 +201,8 @@ void DataArray::copyStringInfoFrom(const DataArray& other) void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds) { - std::size_t const nbOfCompoOth=other.getNumberOfComponents(); - std::size_t const newNbOfCompo=compoIds.size(); + std::size_t nbOfCompoOth=other.getNumberOfComponents(); + std::size_t newNbOfCompo=compoIds.size(); for(std::size_t i=0;i=nbOfCompoOth) { @@ -231,8 +217,8 @@ void DataArray::copyPartOfStringInfoFrom2(const std::vector& compoI { if(compoIds.size()!=other.getNumberOfComponents()) throw INTERP_KERNEL::Exception("Given compoIds has not the same size as number of components of given array !"); - std::size_t const partOfCompoToSet=compoIds.size(); - std::size_t const nbOfCompo=getNumberOfComponents(); + std::size_t partOfCompoToSet=compoIds.size(); + std::size_t nbOfCompo=getNumberOfComponents(); for(std::size_t i=0;i=nbOfCompo) { @@ -255,11 +241,11 @@ bool DataArray::areInfoEqualsIfNotWhy(const DataArray& other, std::string& reaso if(_info_on_compo!=other._info_on_compo) { oss << "Components DataArray mismatch : \nThis components="; - for(const auto & it : _info_on_compo) - oss << "\"" << it << "\","; + for(std::vector::const_iterator it=_info_on_compo.begin();it!=_info_on_compo.end();it++) + oss << "\"" << *it << "\","; oss << "\nOther components="; - for(const auto & it : other._info_on_compo) - oss << "\"" << it << "\","; + for(std::vector::const_iterator it=other._info_on_compo.begin();it!=other._info_on_compo.end();it++) + oss << "\"" << *it << "\","; reason=oss.str(); return false; } @@ -286,8 +272,8 @@ void DataArray::reprWithoutNameStream(std::ostream& stream) const { stream << "Number of components : "<< getNumberOfComponents() << "\n"; stream << "Info of these components : "; - for(const auto & iter : _info_on_compo) - stream << "\"" << iter << "\" "; + for(std::vector::const_iterator iter=_info_on_compo.begin();iter!=_info_on_compo.end();iter++) + stream << "\"" << *iter << "\" "; stream << "\n"; } @@ -326,12 +312,12 @@ void DataArray::setPartOfValuesBase3(const DataArray *aBase, const mcIdType *bgT { if(!aBase) throw INTERP_KERNEL::Exception("DataArray::setPartOfValuesBase3 : input aBase object is NULL !"); - auto *this1(dynamic_cast(this)); - auto *this2(dynamic_cast(this)); - auto *this3(dynamic_cast(this)); - const auto *a1(dynamic_cast(aBase)); - const auto *a2(dynamic_cast(aBase)); - const auto *a3(dynamic_cast(aBase)); + DataArrayDouble *this1(dynamic_cast(this)); + DataArrayIdType *this2(dynamic_cast(this)); + DataArrayChar *this3(dynamic_cast(this)); + const DataArrayDouble *a1(dynamic_cast(aBase)); + const DataArrayIdType *a2(dynamic_cast(aBase)); + const DataArrayChar *a3(dynamic_cast(aBase)); if(this1 && a1) { this1->setPartOfValues3(a1,bgTuples,endTuples,bgComp,endComp,stepComp,strictCompoCompare); @@ -352,7 +338,7 @@ void DataArray::setPartOfValuesBase3(const DataArray *aBase, const mcIdType *bgT std::vector DataArray::getVarsOnComponent() const { - std::size_t const nbOfCompo=_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); std::vector ret(nbOfCompo); for(std::size_t i=0;i DataArray::getVarsOnComponent() const std::vector DataArray::getUnitsOnComponent() const { - std::size_t const nbOfCompo=_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); std::vector ret(nbOfCompo); for(std::size_t i=0;i DataArray::SplitStringInChuncks(const std::string st, std::size_t sz) { - std::size_t const len = st.length(); - std::size_t const nbOfCompo(len/sz); + std::size_t len = st.length(); + std::size_t nbOfCompo(len/sz); if( nbOfCompo*sz != len) { THROW_IK_EXCEPTION("DataArray::SplitStringInChuncks : Length of input string (" << len << ") is not equal to " << nbOfCompo << "*" << sz << " !"); @@ -453,7 +439,7 @@ std::vector DataArray::SplitStringInChuncks(const std::string st, s for(std::size_t i = 0 ; i < nbOfCompo ; ++i) { std::string part = st.substr(i*sz,sz); - std::size_t const p3=part.find_last_not_of(" \t"); + std::size_t p3=part.find_last_not_of(" \t"); part = part.substr(0,p3+1); ret[i] = part; } @@ -472,15 +458,15 @@ std::vector DataArray::SplitStringInChuncks(const std::string st, s */ std::string DataArray::GetVarNameFromInfo(const std::string& info) { - std::size_t const p1=info.find_last_of('['); - std::size_t const p2=info.find_last_of(']'); + std::size_t p1=info.find_last_of('['); + std::size_t p2=info.find_last_of(']'); if(p1==std::string::npos || p2==std::string::npos) return info; if(p1>p2) return info; if(p1==0) return std::string(); - std::size_t const p3=info.find_last_not_of(' ',p1-1); + std::size_t p3=info.find_last_not_of(' ',p1-1); return info.substr(0,p3+1); } @@ -496,8 +482,8 @@ std::string DataArray::GetVarNameFromInfo(const std::string& info) */ std::string DataArray::GetUnitFromInfo(const std::string& info) { - std::size_t const p1=info.find_last_of('['); - std::size_t const p2=info.find_last_of(']'); + std::size_t p1=info.find_last_of('['); + std::size_t p2=info.find_last_of(']'); if(p1==std::string::npos || p2==std::string::npos) return std::string(); if(p1>p2) @@ -549,23 +535,23 @@ std::string DataArray::GetAxisTypeRepr(MEDCouplingAxisType at) DataArray *DataArray::Aggregate(const std::vector& arrs) { std::vector arr2; - for(auto arr : arrs) - if(arr) - arr2.push_back(arr); + for(std::vector::const_iterator it=arrs.begin();it!=arrs.end();it++) + if(*it) + arr2.push_back(*it); if(arr2.empty()) throw INTERP_KERNEL::Exception("DataArray::Aggregate : only null instance in input vector !"); std::vector arrd; std::vector arri; std::vector arrc; - for(auto it : arr2) + for(std::vector::const_iterator it=arr2.begin();it!=arr2.end();it++) { - const auto *a=dynamic_cast(it); + const DataArrayDouble *a=dynamic_cast(*it); if(a) { arrd.push_back(a); continue; } - const auto *b=dynamic_cast(it); + const DataArrayIdType *b=dynamic_cast(*it); if(b) { arri.push_back(b); continue; } - const auto *c=dynamic_cast(it); + const DataArrayChar *c=dynamic_cast(*it); if(c) { arrc.push_back(c); continue; } throw INTERP_KERNEL::Exception("DataArray::Aggregate : presence of not null instance in inuput that is not in [DataArrayDouble, DataArrayInt, DataArrayChar] !"); @@ -832,12 +818,12 @@ bool DataArrayDouble::isMonotonic(bool increasing, double eps) const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::isMonotonic : only supported with 'this' array with ONE component !"); - mcIdType const nbOfElements(getNumberOfTuples()); + mcIdType nbOfElements(getNumberOfTuples()); const double *ptr=getConstPointer(); if(nbOfElements==0) return true; double ref=ptr[0]; - double const absEps=fabs(eps); + double absEps=fabs(eps); if(increasing) { for(mcIdType i=1;i::const_iterator it=_info_on_compo.begin();it!=_info_on_compo.end();it++) + if(!(*it).empty()) areAllEmpty=false; if(!areAllEmpty) for(std::size_t i=0;i<_info_on_compo.size();i++) @@ -885,7 +871,7 @@ void DataArrayDouble::writeVTK(std::ostream& ofs, mcIdType indent, const std::st for(const double *src=begin();src!=end();src++,pt++) *pt=float(*src); const char *data(reinterpret_cast((float *)tmp)); - std::size_t const sz(getNbOfElems()*sizeof(float)); + std::size_t sz(getNbOfElems()*sizeof(float)); byteArr->insertAtTheEnd(data,data+sz); byteArr->insertAtTheEnd(SPACE,SPACE+4); } @@ -899,8 +885,8 @@ void DataArrayDouble::writeVTK(std::ostream& ofs, mcIdType indent, const std::st void DataArrayDouble::reprCppStream(const std::string& varName, std::ostream& stream) const { - mcIdType const nbTuples=getNumberOfTuples(); - std::size_t const nbComp=getNumberOfComponents(); + mcIdType nbTuples=getNumberOfTuples(); + std::size_t nbComp=getNumberOfComponents(); const double *data(getConstPointer()); stream.precision(17); stream << "DataArrayDouble *" << varName << "=DataArrayDouble::New();" << std::endl; @@ -925,10 +911,10 @@ void DataArrayDouble::reprQuickOverview(std::ostream& stream) const stream << "DataArrayDouble C++ instance at " << this << ". "; if(isAllocated()) { - std::size_t const nbOfCompo(_info_on_compo.size()); + std::size_t nbOfCompo(_info_on_compo.size()); if(nbOfCompo>=1) { - mcIdType const nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -942,8 +928,8 @@ void DataArrayDouble::reprQuickOverview(std::ostream& stream) const void DataArrayDouble::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const double *data=begin(); - mcIdType const nbOfTuples(getNumberOfTuples()); - std::size_t const nbOfCompo(_info_on_compo.size()); + mcIdType nbOfTuples(getNumberOfTuples()); + std::size_t nbOfCompo(_info_on_compo.size()); std::ostringstream oss2; oss2 << "["; oss2.precision(17); std::string oss2Str(oss2.str()); @@ -963,7 +949,7 @@ void DataArrayDouble::reprQuickOverviewData(std::ostream& stream, std::size_t ma else oss2 << *data++; if(i!=nbOfTuples-1) oss2 << ", "; - std::string const oss3Str(oss2.str()); + std::string oss3Str(oss2.str()); if(oss3Str.length()getNumberOfComponents()) throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : the number of components does not match !"); MCAuto a=DataArrayDouble::Aggregate(this,other); - DataArrayIdType *c=nullptr,*ci=nullptr; + DataArrayIdType *c=0,*ci=0; a->findCommonTuples(prec,getNumberOfTuples(),c,ci); MCAuto cSafe(c),ciSafe(ci); mcIdType newNbOfTuples=-1; @@ -1080,11 +1066,11 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, void DataArrayDouble::findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const { checkAllocated(); - std::size_t const nbOfCompo=getNumberOfComponents(); + std::size_t nbOfCompo=getNumberOfComponents(); if ((nbOfCompo<1) || (nbOfCompo>4)) //test before work throw INTERP_KERNEL::Exception("DataArrayDouble::findCommonTuples : Unexpected spacedim of coords. Must be 1, 2, 3 or 4."); - mcIdType const nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); // MCAuto c(DataArrayIdType::New()),cI(DataArrayIdType::New()); c->alloc(0,1); cI->pushBackSilent(0); switch(nbOfCompo) @@ -1121,8 +1107,8 @@ void DataArrayDouble::findCommonTuples(double prec, mcIdType limitTupleId, DataA double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const { MCAuto part1=findClosestTupleId(other); - std::size_t const nbOfCompo=getNumberOfComponents(); - mcIdType const otherNbTuples=other->getNumberOfTuples(); + std::size_t nbOfCompo=getNumberOfComponents(); + mcIdType otherNbTuples=other->getNumberOfTuples(); const double *thisPt(begin()),*otherPt(other->begin()); const mcIdType *part1Pt(part1->begin()); double ret=std::numeric_limits::max(); @@ -1150,15 +1136,15 @@ DataArrayIdType *DataArrayDouble::findClosestTupleId(const DataArrayDouble *othe if(!other) throw INTERP_KERNEL::Exception("DataArrayDouble::findClosestTupleId : other instance is NULL !"); checkAllocated(); other->checkAllocated(); - std::size_t const nbOfCompo(getNumberOfComponents()); + std::size_t nbOfCompo(getNumberOfComponents()); if(nbOfCompo!=other->getNumberOfComponents()) { std::ostringstream oss; oss << "DataArrayDouble::findClosestTupleId : number of components in this is " << nbOfCompo; oss << ", whereas number of components in other is " << other->getNumberOfComponents() << "! Should be equal !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType const nbOfTuples(other->getNumberOfTuples()); - mcIdType const thisNbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(other->getNumberOfTuples()); + mcIdType thisNbOfTuples(getNumberOfTuples()); MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1); double bounds[6]; getMinMaxPerComponent(bounds); @@ -1168,24 +1154,24 @@ DataArrayIdType *DataArrayDouble::findClosestTupleId(const DataArrayDouble *othe { double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])),zDelta(fabs(bounds[5]-bounds[4])); double delta=std::max(xDelta,yDelta); delta=std::max(delta,zDelta); - double const characSize=pow((delta*delta*delta)/((double)thisNbOfTuples),1./3.); - BBTreePts<3,mcIdType> const myTree(begin(),nullptr,0,getNumberOfTuples(),characSize*1e-12); + double characSize=pow((delta*delta*delta)/((double)thisNbOfTuples),1./3.); + BBTreePts<3,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); FindClosestTupleIdAlg<3>(myTree,3.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer()); break; } case 2: { double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])); - double const delta=std::max(xDelta,yDelta); - double const characSize=sqrt(delta/(double)thisNbOfTuples); - BBTreePts<2,mcIdType> const myTree(begin(),nullptr,0,getNumberOfTuples(),characSize*1e-12); + double delta=std::max(xDelta,yDelta); + double characSize=sqrt(delta/(double)thisNbOfTuples); + BBTreePts<2,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); FindClosestTupleIdAlg<2>(myTree,2.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer()); break; } case 1: { - double const characSize=fabs(bounds[1]-bounds[0])/FromIdType(thisNbOfTuples); - BBTreePts<1,mcIdType> const myTree(begin(),nullptr,0,getNumberOfTuples(),characSize*1e-12); + double characSize=fabs(bounds[1]-bounds[0])/FromIdType(thisNbOfTuples); + BBTreePts<1,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); FindClosestTupleIdAlg<1>(myTree,1.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer()); break; } @@ -1213,8 +1199,8 @@ DataArrayIdType *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDou throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : input array is NULL !"); if(!isAllocated() || !otherBBoxFrmt->isAllocated()) throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : this and input array must be allocated !"); - std::size_t const nbOfComp(getNumberOfComponents()); - mcIdType const nbOfTuples(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()); + mcIdType nbOfTuples(getNumberOfTuples()); if(nbOfComp!=otherBBoxFrmt->getNumberOfComponents()) { std::ostringstream oss; oss << "DataArrayDouble::computeNbOfInteractionsWith : this number of components (" << nbOfComp << ") must be equal to the number of components of input array (" << otherBBoxFrmt->getNumberOfComponents() << ") !"; @@ -1232,21 +1218,21 @@ DataArrayIdType *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDou { case 3: { - BBTree<3,mcIdType> bbt(otherBBoxFrmt->begin(),nullptr,0,otherBBoxFrmt->getNumberOfTuples(),eps); + BBTree<3,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); for(mcIdType i=0;i bbt(otherBBoxFrmt->begin(),nullptr,0,otherBBoxFrmt->getNumberOfTuples(),eps); + BBTree<2,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); for(mcIdType i=0;i bbt(otherBBoxFrmt->begin(),nullptr,0,otherBBoxFrmt->getNumberOfTuples(),eps); + BBTree<1,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); for(mcIdType i=0;i c(c0),cI(cI0); mcIdType newNbOfTuples=-1; @@ -1310,9 +1296,9 @@ void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std: throw INTERP_KERNEL::Exception("DataArrayDouble::setSelectedComponents : input DataArrayDouble is NULL !"); checkAllocated(); copyPartOfStringInfoFrom2(compoIds,*a); - std::size_t const partOfCompoSz=compoIds.size(); - std::size_t const nbOfCompo=getNumberOfComponents(); - mcIdType const nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples()); + std::size_t partOfCompoSz=compoIds.size(); + std::size_t nbOfCompo=getNumberOfComponents(); + mcIdType nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples()); const double *ac=a->getConstPointer(); double *nc=getPointer(); for(mcIdType i=0;i::max(); bounds[idim*2+1]=-std::numeric_limits::max(); } const double *ptr=getConstPointer(); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); for(mcIdType i=0;i bbox=DataArrayDouble::New(); bbox->alloc(nbTuples,2*nbOfCompo); double *bboxPtr=bbox->getPointer(); @@ -1425,30 +1411,30 @@ void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, do throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : input pointer other is null !"); checkAllocated(); other->checkAllocated(); - std::size_t const nbOfCompo=getNumberOfComponents(); - std::size_t const otherNbOfCompo=other->getNumberOfComponents(); + std::size_t nbOfCompo=getNumberOfComponents(); + std::size_t otherNbOfCompo=other->getNumberOfComponents(); if(nbOfCompo!=otherNbOfCompo) throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : number of components should be equal between this and other !"); - mcIdType const nbOfTuplesOther=other->getNumberOfTuples(); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuplesOther=other->getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); MCAuto cArr(DataArrayIdType::New()),cIArr(DataArrayIdType::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0); switch(nbOfCompo) { case 3: { - BBTreePts<3,mcIdType> const myTree(begin(),nullptr,0,nbOfTuples,eps); + BBTreePts<3,mcIdType> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<3>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } case 2: { - BBTreePts<2,mcIdType> const myTree(begin(),nullptr,0,nbOfTuples,eps); + BBTreePts<2,mcIdType> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<2>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } case 1: { - BBTreePts<1,mcIdType> const myTree(begin(),nullptr,0,nbOfTuples,eps); + BBTreePts<1,mcIdType> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<1>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } @@ -1467,13 +1453,13 @@ void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, do void DataArrayDouble::recenterForMaxPrecision(double eps) { checkAllocated(); - std::size_t const dim=getNumberOfComponents(); + std::size_t dim=getNumberOfComponents(); std::vector bounds(2*dim); getMinMaxPerComponent(&bounds[0]); for(std::size_t i=0;ieps) applyLin(1./delta,-offset/delta,i); else @@ -1493,8 +1479,8 @@ void DataArrayDouble::recenterForMaxPrecision(double eps) double DataArrayDouble::getMaxValue2(DataArrayIdType*& tupleIds) const { mcIdType tmp; - tupleIds=nullptr; - double const ret=getMaxValue(tmp); + tupleIds=0; + double ret=getMaxValue(tmp); tupleIds=findIdsInRange(ret,ret); return ret; } @@ -1511,8 +1497,8 @@ double DataArrayDouble::getMaxValue2(DataArrayIdType*& tupleIds) const double DataArrayDouble::getMinValue2(DataArrayIdType*& tupleIds) const { mcIdType tmp; - tupleIds=nullptr; - double const ret=getMinValue(tmp); + tupleIds=0; + double ret=getMinValue(tmp); tupleIds=findIdsInRange(ret,ret); return ret; } @@ -1533,7 +1519,7 @@ mcIdType DataArrayDouble::count(double value, double eps) const if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::count : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !"); const double *vals=begin(); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); for(mcIdType i=0;i 0 !"); const double *vals=getConstPointer(); - double const ret=std::accumulate(vals,vals+nbOfTuples,0.); + double ret=std::accumulate(vals,vals+nbOfTuples,0.); return ret/FromIdType(nbOfTuples); } @@ -1568,7 +1554,7 @@ double DataArrayDouble::norm2() const { checkAllocated(); double ret=0.; - std::size_t const nbOfElems=getNbOfElems(); + std::size_t nbOfElems=getNbOfElems(); const double *pt=getConstPointer(); for(std::size_t i=0;iret) ret=val; } @@ -1608,14 +1594,14 @@ double DataArrayDouble::normMax() const void DataArrayDouble::normMaxPerComponent(double * res) const { checkAllocated(); - mcIdType const nbOfTuples(getNumberOfTuples()); - std::size_t const nbOfCompos(getNumberOfComponents()); + mcIdType nbOfTuples(getNumberOfTuples()); + std::size_t nbOfCompos(getNumberOfComponents()); std::fill(res, res+nbOfCompos, -1.0); const double *pt(getConstPointer()); for(mcIdType i=0;ires[j]) res[j]=val; } @@ -1634,11 +1620,11 @@ double DataArrayDouble::normMin() const { checkAllocated(); double ret(std::numeric_limits::max()); - std::size_t const nbOfElems(getNbOfElems()); + std::size_t nbOfElems(getNbOfElems()); const double *pt(getConstPointer()); for(std::size_t i=0;i()); @@ -1680,8 +1666,8 @@ void DataArrayDouble::accumulate(double *res) const double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, mcIdType& tupleId) const { checkAllocated(); - mcIdType const nbTuple(getNumberOfTuples()); - std::size_t const nbComps(getNumberOfComponents()); + mcIdType nbTuple(getNumberOfTuples()); + std::size_t nbComps(getNumberOfComponents()); if(nbComps!=(std::size_t)std::distance(tupleBg,tupleEnd)) { std::ostringstream oss; oss << "DataArrayDouble::distanceToTuple : size of input tuple is " << std::distance(tupleBg,tupleEnd) << " should be equal to the number of components in this : " << nbComps << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } if(nbTuple==0) @@ -1714,8 +1700,8 @@ double DataArrayDouble::accumulate(std::size_t compId) const { checkAllocated(); const double *ptr=getConstPointer(); - mcIdType const nbTuple(getNumberOfTuples()); - std::size_t const nbComps(getNumberOfComponents()); + mcIdType nbTuple(getNumberOfTuples()); + std::size_t nbComps(getNumberOfComponents()); if(compId>=nbComps) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulate : Invalid compId specified : No such nb of components !"); double ret=0.; @@ -1746,8 +1732,8 @@ DataArrayDouble *DataArrayDouble::accumulatePerChunck(const mcIdType *bgOfIndex, if(!bgOfIndex || !endOfIndex) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : input pointer NULL !"); checkAllocated(); - std::size_t const nbCompo(getNumberOfComponents()); - mcIdType const nbOfTuples(getNumberOfTuples()); + std::size_t nbCompo(getNumberOfComponents()); + mcIdType nbOfTuples(getNumberOfTuples()); std::size_t sz=std::distance(bgOfIndex,endOfIndex); if(sz<1) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : invalid size of input index array !"); @@ -1795,7 +1781,7 @@ MCAuto DataArrayDouble::cumSum() const { checkAllocated(); checkNbOfComps(1,"DataArrayDouble::cumSum : this is expected to be single component"); - mcIdType const nbOfTuple(getNumberOfTuples()); + mcIdType nbOfTuple(getNumberOfTuples()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuple+1,1); double *ptr(ret->getPointer()); ptr[0]=0.; @@ -1819,10 +1805,10 @@ MCAuto DataArrayDouble::cumSum() const DataArrayDouble *DataArrayDouble::fromPolarToCart() const { checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp!=2) throw INTERP_KERNEL::Exception("DataArrayDouble::fromPolarToCart : must be an array with exactly 2 components !"); - mcIdType const nbOfTuple(getNumberOfTuples()); + mcIdType nbOfTuple(getNumberOfTuples()); DataArrayDouble *ret(DataArrayDouble::New()); ret->alloc(nbOfTuple,2); double *w(ret->getPointer()); @@ -1850,10 +1836,10 @@ DataArrayDouble *DataArrayDouble::fromPolarToCart() const DataArrayDouble *DataArrayDouble::fromCylToCart() const { checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp!=3) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCylToCart : must be an array with exactly 3 components !"); - mcIdType const nbOfTuple(getNumberOfTuples()); + mcIdType nbOfTuple(getNumberOfTuples()); DataArrayDouble *ret(DataArrayDouble::New()); ret->alloc(getNumberOfTuples(),3); double *w(ret->getPointer()); @@ -1883,10 +1869,10 @@ DataArrayDouble *DataArrayDouble::fromCylToCart() const DataArrayDouble *DataArrayDouble::fromSpherToCart() const { checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp!=3) throw INTERP_KERNEL::Exception("DataArrayDouble::fromSpherToCart : must be an array with exactly 3 components !"); - mcIdType const nbOfTuple(getNumberOfTuples()); + mcIdType nbOfTuple(getNumberOfTuples()); DataArrayDouble *ret(DataArrayDouble::New()); ret->alloc(getNumberOfTuples(),3); double *w(ret->getPointer()); @@ -1911,7 +1897,7 @@ DataArrayDouble *DataArrayDouble::fromSpherToCart() const DataArrayDouble *DataArrayDouble::cartesianize(MEDCouplingAxisType atOfThis) const { checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); MCAuto ret; switch(atOfThis) { @@ -1960,8 +1946,8 @@ DataArrayDouble *DataArrayDouble::fromCartToPolar() const { MCAuto ret(DataArrayDouble::New()); checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); - mcIdType const nbTuples(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); if(nbOfComp!=2) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToPolar : must be an array with exactly 2 components !"); ret->alloc(nbTuples,2); @@ -1984,8 +1970,8 @@ DataArrayDouble *DataArrayDouble::fromCartToCyl() const { MCAuto ret(DataArrayDouble::New()); checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); - mcIdType const nbTuples(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); if(nbOfComp!=3) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCyl : must be an array with exactly 3 components !"); ret->alloc(nbTuples,3); @@ -2008,8 +1994,8 @@ DataArrayDouble *DataArrayDouble::fromCartToSpher() const { MCAuto ret(DataArrayDouble::New()); checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); - mcIdType const nbTuples(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); if(nbOfComp!=3) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToSpher : must be an array with exactly 3 components !"); ret->alloc(nbTuples,3); @@ -2035,8 +2021,8 @@ DataArrayDouble *DataArrayDouble::fromCartToCylGiven(const DataArrayDouble *coor throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : input coords are NULL !"); MCAuto ret(DataArrayDouble::New()); checkAllocated(); coords->checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); - mcIdType const nbTuples(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); if(nbOfComp!=3) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : must be an array with exactly 3 components !"); if(coords->getNumberOfComponents()!=3) @@ -2044,7 +2030,7 @@ DataArrayDouble *DataArrayDouble::fromCartToCylGiven(const DataArrayDouble *coor if(coords->getNumberOfTuples()!=nbTuples) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : coords array must have the same number of tuples !"); ret->alloc(nbTuples,nbOfComp); - double const magOfVect(sqrt(vect[0]*vect[0]+vect[1]*vect[1]+vect[2]*vect[2])); + double magOfVect(sqrt(vect[0]*vect[0]+vect[1]*vect[1]+vect[2]*vect[2])); if(magOfVect<1e-12) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : magnitude of vect is too low !"); double Ur[3],Uteta[3],Uz[3],*retPtr(ret->getPointer()); @@ -2054,7 +2040,7 @@ DataArrayDouble *DataArrayDouble::fromCartToCylGiven(const DataArrayDouble *coor { std::transform(coo,coo+3,center,Ur,std::minus()); Uteta[0]=Uz[1]*Ur[2]-Uz[2]*Ur[1]; Uteta[1]=Uz[2]*Ur[0]-Uz[0]*Ur[2]; Uteta[2]=Uz[0]*Ur[1]-Uz[1]*Ur[0]; - double const magOfTeta(sqrt(Uteta[0]*Uteta[0]+Uteta[1]*Uteta[1]+Uteta[2]*Uteta[2])); + double magOfTeta(sqrt(Uteta[0]*Uteta[0]+Uteta[1]*Uteta[1]+Uteta[2]*Uteta[2])); std::transform(Uteta,Uteta+3,Uteta,std::bind(std::multiplies(),std::placeholders::_1,1./magOfTeta)); Ur[0]=Uteta[1]*Uz[2]-Uteta[2]*Uz[1]; Ur[1]=Uteta[2]*Uz[0]-Uteta[0]*Uz[2]; Ur[2]=Uteta[0]*Uz[1]-Uteta[1]*Uz[0]; retPtr[0]=Ur[0]*vectField[0]+Ur[1]*vectField[1]+Ur[2]*vectField[2]; @@ -2077,11 +2063,11 @@ DataArrayDouble *DataArrayDouble::fromCartToCylGiven(const DataArrayDouble *coor DataArrayDouble *DataArrayDouble::doublyContractedProduct() const { checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp!=6) throw INTERP_KERNEL::Exception("DataArrayDouble::doublyContractedProduct : must be an array with exactly 6 components !"); DataArrayDouble *ret=DataArrayDouble::New(); - mcIdType const nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=getNumberOfTuples(); ret->alloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); @@ -2104,7 +2090,7 @@ DataArrayDouble *DataArrayDouble::determinant() const { checkAllocated(); DataArrayDouble *ret=DataArrayDouble::New(); - mcIdType const nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=getNumberOfTuples(); ret->alloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); @@ -2147,11 +2133,11 @@ DataArrayDouble *DataArrayDouble::determinant() const DataArrayDouble *DataArrayDouble::eigenValues() const { checkAllocated(); - std::size_t const nbOfComp=getNumberOfComponents(); + std::size_t nbOfComp=getNumberOfComponents(); if(nbOfComp!=6) throw INTERP_KERNEL::Exception("DataArrayDouble::eigenValues : must be an array with exactly 6 components !"); DataArrayDouble *ret=DataArrayDouble::New(); - mcIdType const nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=getNumberOfTuples(); ret->alloc(nbOfTuple,3); const double *src=getConstPointer(); double *dest=ret->getPointer(); @@ -2179,11 +2165,11 @@ DataArrayDouble *DataArrayDouble::eigenValues() const DataArrayDouble *DataArrayDouble::eigenVectors() const { checkAllocated(); - std::size_t const nbOfComp=getNumberOfComponents(); + std::size_t nbOfComp=getNumberOfComponents(); if(nbOfComp!=6) throw INTERP_KERNEL::Exception("DataArrayDouble::eigenVectors : must be an array with exactly 6 components !"); DataArrayDouble *ret=DataArrayDouble::New(); - mcIdType const nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=getNumberOfTuples(); ret->alloc(nbOfTuple,9); const double *src=getConstPointer(); double *dest=ret->getPointer(); @@ -2211,18 +2197,18 @@ DataArrayDouble *DataArrayDouble::eigenVectors() const DataArrayDouble *DataArrayDouble::inverse() const { checkAllocated(); - std::size_t const nbOfComp=getNumberOfComponents(); + std::size_t nbOfComp=getNumberOfComponents(); if(nbOfComp!=6 && nbOfComp!=9 && nbOfComp!=4) throw INTERP_KERNEL::Exception("DataArrayDouble::inversion : must be an array with 4,6 or 9 components !"); DataArrayDouble *ret=DataArrayDouble::New(); - mcIdType const nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=getNumberOfTuples(); ret->alloc(nbOfTuple,nbOfComp); const double *src=getConstPointer(); double *dest=ret->getPointer(); if(nbOfComp==6) for(mcIdType i=0;ialloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); @@ -2302,17 +2288,17 @@ DataArrayDouble *DataArrayDouble::trace() const DataArrayDouble *DataArrayDouble::deviator() const { checkAllocated(); - std::size_t const nbOfComp=getNumberOfComponents(); + std::size_t nbOfComp=getNumberOfComponents(); if(nbOfComp!=6) throw INTERP_KERNEL::Exception("DataArrayDouble::deviator : must be an array with exactly 6 components !"); DataArrayDouble *ret=DataArrayDouble::New(); - mcIdType const nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=getNumberOfTuples(); ret->alloc(nbOfTuple,6); const double *src=getConstPointer(); double *dest=ret->getPointer(); for(mcIdType i=0;ialloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); @@ -2354,9 +2340,9 @@ DataArrayDouble *DataArrayDouble::magnitude() const DataArrayDouble *DataArrayDouble::operatePerTuple(std::function func) const { checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); MCAuto ret=DataArrayDouble::New(); - mcIdType const nbOfTuple(getNumberOfTuples()); + mcIdType nbOfTuple(getNumberOfTuples()); ret->alloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); @@ -2409,10 +2395,10 @@ DataArrayDouble *DataArrayDouble::minPerTuple() const DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayIdType* &compoIdOfMaxPerTuple) const { checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); MCAuto ret0=DataArrayDouble::New(); MCAuto ret1=DataArrayIdType::New(); - mcIdType const nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=getNumberOfTuples(); ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret0->getPointer(); mcIdType *dest1=ret1->getPointer(); @@ -2443,8 +2429,8 @@ DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayIdType* &compo DataArrayDouble *DataArrayDouble::buildEuclidianDistanceDenseMatrix() const { checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); - mcIdType const nbOfTuples(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()); + mcIdType nbOfTuples(getNumberOfTuples()); const double *inData=getConstPointer(); MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuples*nbOfTuples,1); @@ -2456,7 +2442,7 @@ DataArrayDouble *DataArrayDouble::buildEuclidianDistanceDenseMatrix() const { double dist=0.; for(std::size_t k=0;kcheckAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); - std::size_t const otherNbOfComp(other->getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); + std::size_t otherNbOfComp(other->getNumberOfComponents()); if(nbOfComp!=otherNbOfComp) { std::ostringstream oss; oss << "DataArrayDouble::buildEuclidianDistanceDenseMatrixWith : this nb of compo=" << nbOfComp << " and other nb of compo=" << otherNbOfComp << ". It should match !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType const nbOfTuples(getNumberOfTuples()); - mcIdType const otherNbOfTuples(other->getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); + mcIdType otherNbOfTuples(other->getNumberOfTuples()); const double *inData=getConstPointer(); const double *inDataOther=other->getConstPointer(); MCAuto ret=DataArrayDouble::New(); @@ -2507,7 +2493,7 @@ DataArrayDouble *DataArrayDouble::buildEuclidianDistanceDenseMatrixWith(const Da { double dist=0.; for(std::size_t k=0;k n0(new INTERP_KERNEL::Node(pt[0],pt[1])),n1(new INTERP_KERNEL::Node(pt[2],pt[3])),n2(new INTERP_KERNEL::Node(pt[4],pt[5])); { INTERP_KERNEL::AutoCppPtr e1(new INTERP_KERNEL::EdgeLin(n0,n2)),e2(new INTERP_KERNEL::EdgeLin(n2,n1)); - INTERP_KERNEL::SegSegIntersector const inters(*e1,*e2); - bool const colinearity(inters.areColinears()); + INTERP_KERNEL::SegSegIntersector inters(*e1,*e2); + bool colinearity(inters.areColinears()); if(colinearity) throw INTERP_KERNEL::Exception("DataArrayDouble::asArcOfCircle : 3 points in this have been detected as colinear !"); } @@ -2557,8 +2543,8 @@ void DataArrayDouble::sortPerTuple(bool asc) { checkAllocated(); double *pt=getPointer(); - mcIdType const nbOfTuple(getNumberOfTuples()); - std::size_t const nbOfComp(getNumberOfComponents()); + mcIdType nbOfTuple(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()); if(asc) for(mcIdType i=0;istd::numeric_limits::min()) @@ -2613,9 +2599,9 @@ void DataArrayDouble::applyPow(double val) { checkAllocated(); double *ptr=getPointer(); - std::size_t const nbOfElems=getNbOfElems(); - int const val2=(int)val; - bool const isInt=((double)val2)==val; + std::size_t nbOfElems=getNbOfElems(); + int val2=(int)val; + bool isInt=((double)val2)==val; if(!isInt) { for(std::size_t i=0;i= 0 !"); double *ptr=getPointer(); - std::size_t const nbOfElems=getNbOfElems(); + std::size_t nbOfElems=getNbOfElems(); for(std::size_t i=0;ialloc(nbOfTuples,nbOfComp); const double *ptr=getConstPointer(); double *ptrToFill=newArr->getPointer(); @@ -2722,7 +2708,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(std::size_t nbOfComp, const std::str expr.parse(); std::set vars; expr.getTrueSetOfVars(vars); - std::vector const varsV(vars.begin(),vars.end()); + std::vector varsV(vars.begin(),vars.end()); return applyFuncNamedCompo(nbOfComp,varsV,func,isSafe); } @@ -2746,11 +2732,11 @@ DataArrayDouble *DataArrayDouble::applyFunc(std::size_t nbOfComp, const std::str */ DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe) const { - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp<=0) throw INTERP_KERNEL::Exception("DataArrayDouble::applyFunc : output number of component must be > 0 !"); checkAllocated(); - mcIdType const nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); MCAuto newArr(DataArrayDouble::New()); newArr->alloc(nbOfTuples,nbOfComp); INTERP_KERNEL::ExprParser expr(func); @@ -2771,7 +2757,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe newArr->rearrange(nbOfComp); return newArr.retn(); } - std::vector const vars2(vars.begin(),vars.end()); + std::vector vars2(vars.begin(),vars.end()); double buff,*ptrToFill(newArr->getPointer()); const double *ptr(begin()); std::vector stck; @@ -2831,11 +2817,11 @@ DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe */ void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe) { - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp<=0) throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncOnThis : output number of component must be > 0 !"); checkAllocated(); - mcIdType const nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); INTERP_KERNEL::ExprParser expr(func); expr.parse(); std::set vars; @@ -2849,14 +2835,14 @@ void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe) if(vars.empty()) { expr.prepareFastEvaluator(); - std::vector const compInfo(getInfoOnComponents()); + std::vector compInfo(getInfoOnComponents()); rearrange(1); fillWithValue(expr.evaluateDouble()); rearrange(nbOfComp); setInfoOnComponents(compInfo); return ; } - std::vector const vars2(vars.begin(),vars.end()); + std::vector vars2(vars.begin(),vars.end()); double buff,*ptrToFill(getPointer()); const double *ptr(begin()); std::vector stck; @@ -2945,11 +2931,11 @@ DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(std::size_t nbOfComp, cons if(nbOfComp<=0) throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncNamedCompo : output number of component must be > 0 !"); std::vector varsOrder2(varsOrder); - std::size_t const oldNbOfComp(getNumberOfComponents()); + std::size_t oldNbOfComp(getNumberOfComponents()); for(std::size_t i=varsOrder.size();i vars; @@ -3016,9 +3002,9 @@ void DataArrayDouble::applyFuncFast32(const std::string& func) *((void **)&funcPtr)=funcStr;//he he... // double *ptr=getPointer(); - std::size_t const nbOfComp=getNumberOfComponents(); - mcIdType const nbOfTuples=getNumberOfTuples(); - std::size_t const nbOfElems=nbOfTuples*nbOfComp; + std::size_t nbOfComp=getNumberOfComponents(); + mcIdType nbOfTuples=getNumberOfTuples(); + std::size_t nbOfElems=nbOfTuples*nbOfComp; for(std::size_t i=0;i DataArrayDouble::symmetry3DPlane(const double point[3], checkAllocated(); if(getNumberOfComponents()!=3) throw INTERP_KERNEL::Exception("DataArrayDouble::symmetry3DPlane : this is excepted to have 3 components !"); - mcIdType const nbTuples(getNumberOfTuples()); + mcIdType nbTuples(getNumberOfTuples()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbTuples,3); Symmetry3DPlane(point,normalVector,nbTuples,begin(),ret->getPointer()); @@ -3086,7 +3072,7 @@ DataArrayIdType *DataArrayDouble::findIdsInRange(double vmin, double vmax) const throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsInRange : this must have exactly one component !"); const double *cptr(begin()); MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); - mcIdType const nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); for(mcIdType i=0;i=vmin && *cptr<=vmax) ret->pushBackSilent(i); @@ -3112,7 +3098,7 @@ DataArrayIdType *DataArrayDouble::findIdsNotInRange(double vmin, double vmax) co throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsNotInRange : this must have exactly one component !"); const double *cptr(begin()); MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); - mcIdType const nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); for(mcIdType i=0;ivmax) ret->pushBackSilent(i); @@ -3158,13 +3144,13 @@ DataArrayDouble *DataArrayDouble::Aggregate(const DataArrayDouble *a1, const Dat DataArrayDouble *DataArrayDouble::Aggregate(const std::vector& arr) { std::vector a; - for(auto it4 : arr) - if(it4) - a.push_back(it4); + for(std::vector::const_iterator it4=arr.begin();it4!=arr.end();it4++) + if(*it4) + a.push_back(*it4); if(a.empty()) throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : input list must contain at least one NON EMPTY DataArrayDouble !"); std::vector::const_iterator it=a.begin(); - std::size_t const nbOfComp((*it)->getNumberOfComponents()); + std::size_t nbOfComp((*it)->getNumberOfComponents()); mcIdType nbt=(*it++)->getNumberOfTuples(); for(mcIdType i=1;it!=a.end();it++,i++) { @@ -3203,10 +3189,10 @@ DataArrayDouble *DataArrayDouble::Dot(const DataArrayDouble *a1, const DataArray throw INTERP_KERNEL::Exception("DataArrayDouble::Dot : input DataArrayDouble instance is NULL !"); a1->checkAllocated(); a2->checkAllocated(); - std::size_t const nbOfComp(a1->getNumberOfComponents()); + std::size_t nbOfComp(a1->getNumberOfComponents()); if(nbOfComp!=a2->getNumberOfComponents()) throw INTERP_KERNEL::Exception("Nb of components mismatch for array Dot !"); - mcIdType const nbOfTuple(a1->getNumberOfTuples()); + mcIdType nbOfTuple(a1->getNumberOfTuples()); if(nbOfTuple!=a2->getNumberOfTuples()) throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Dot !"); DataArrayDouble *ret=DataArrayDouble::New(); @@ -3246,12 +3232,12 @@ DataArrayDouble *DataArrayDouble::CrossProduct(const DataArrayDouble *a1, const { if(!a1 || !a2) throw INTERP_KERNEL::Exception("DataArrayDouble::CrossProduct : input DataArrayDouble instance is NULL !"); - std::size_t const nbOfComp(a1->getNumberOfComponents()); + std::size_t nbOfComp(a1->getNumberOfComponents()); if(nbOfComp!=a2->getNumberOfComponents()) throw INTERP_KERNEL::Exception("Nb of components mismatch for array crossProduct !"); if(nbOfComp!=3) throw INTERP_KERNEL::Exception("Nb of components must be equal to 3 for array crossProduct !"); - mcIdType const nbOfTuple(a1->getNumberOfTuples()); + mcIdType nbOfTuple(a1->getNumberOfTuples()); if(nbOfTuple!=a2->getNumberOfTuples()) throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array crossProduct !"); DataArrayDouble *ret=DataArrayDouble::New(); @@ -3285,17 +3271,17 @@ DataArrayDouble *DataArrayDouble::Max(const DataArrayDouble *a1, const DataArray { if(!a1 || !a2) throw INTERP_KERNEL::Exception("DataArrayDouble::Max : input DataArrayDouble instance is NULL !"); - std::size_t const nbOfComp(a1->getNumberOfComponents()); + std::size_t nbOfComp(a1->getNumberOfComponents()); if(nbOfComp!=a2->getNumberOfComponents()) throw INTERP_KERNEL::Exception("Nb of components mismatch for array Max !"); - mcIdType const nbOfTuple(a1->getNumberOfTuples()); + mcIdType nbOfTuple(a1->getNumberOfTuples()); if(nbOfTuple!=a2->getNumberOfTuples()) throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Max !"); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuple,nbOfComp); double *retPtr(ret->getPointer()); const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin()); - std::size_t const nbElem(nbOfTuple*nbOfComp); + std::size_t nbElem(nbOfTuple*nbOfComp); for(std::size_t i=0;icopyStringInfoFrom(*a1); @@ -3319,17 +3305,17 @@ DataArrayDouble *DataArrayDouble::Min(const DataArrayDouble *a1, const DataArray { if(!a1 || !a2) throw INTERP_KERNEL::Exception("DataArrayDouble::Min : input DataArrayDouble instance is NULL !"); - std::size_t const nbOfComp(a1->getNumberOfComponents()); + std::size_t nbOfComp(a1->getNumberOfComponents()); if(nbOfComp!=a2->getNumberOfComponents()) throw INTERP_KERNEL::Exception("Nb of components mismatch for array min !"); - mcIdType const nbOfTuple(a1->getNumberOfTuples()); + mcIdType nbOfTuple(a1->getNumberOfTuples()); if(nbOfTuple!=a2->getNumberOfTuples()) throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array min !"); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuple,nbOfComp); double *retPtr(ret->getPointer()); const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin()); - std::size_t const nbElem(nbOfTuple*nbOfComp); + std::size_t nbElem(nbOfTuple*nbOfComp); for(std::size_t i=0;icopyStringInfoFrom(*a1); @@ -3354,10 +3340,10 @@ DataArrayDouble *DataArrayDouble::Pow(const DataArrayDouble *a1, const DataArray { if(!a1 || !a2) throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : at least one of input instances is null !"); - mcIdType const nbOfTuple=a1->getNumberOfTuples(); - mcIdType const nbOfTuple2=a2->getNumberOfTuples(); - std::size_t const nbOfComp=a1->getNumberOfComponents(); - std::size_t const nbOfComp2=a2->getNumberOfComponents(); + mcIdType nbOfTuple=a1->getNumberOfTuples(); + mcIdType nbOfTuple2=a2->getNumberOfTuples(); + std::size_t nbOfComp=a1->getNumberOfComponents(); + std::size_t nbOfComp2=a2->getNumberOfComponents(); if(nbOfTuple!=nbOfTuple2) throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of tuples mismatches !"); if(nbOfComp!=1 || nbOfComp2!=1) @@ -3393,10 +3379,10 @@ void DataArrayDouble::powEqual(const DataArrayDouble *other) { if(!other) throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : input instance is null !"); - mcIdType const nbOfTuple=getNumberOfTuples(); - mcIdType const nbOfTuple2=other->getNumberOfTuples(); - std::size_t const nbOfComp=getNumberOfComponents(); - std::size_t const nbOfComp2=other->getNumberOfComponents(); + mcIdType nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple2=other->getNumberOfTuples(); + std::size_t nbOfComp=getNumberOfComponents(); + std::size_t nbOfComp2=other->getNumberOfComponents(); if(nbOfTuple!=nbOfTuple2) throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of tuples mismatches !"); if(nbOfComp!=1 || nbOfComp2!=1) @@ -3429,7 +3415,7 @@ std::vector DataArrayDouble::toVectorOfBool(double eps) const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::toVectorOfBool : must be applied on single component array !"); - mcIdType const nbt(getNumberOfTuples()); + mcIdType nbt(getNumberOfTuples()); std::vector ret(nbt); const double *pt(begin()); for(mcIdType i=0;i& tinyInfoI) { - mcIdType const nbOfTuple=tinyInfoI[0]; - mcIdType const nbOfComp=tinyInfoI[1]; + mcIdType nbOfTuple=tinyInfoI[0]; + mcIdType nbOfComp=tinyInfoI[1]; if(nbOfTuple!=-1 || nbOfComp!=-1) { alloc(nbOfTuple,nbOfComp); @@ -3506,12 +3492,12 @@ bool DataArrayDouble::resizeForUnserialization(const std::vector& tiny /*! * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. */ -void DataArrayDouble::finishUnserialization(const std::vector& /*tinyInfoI*/, const std::vector& tinyInfoS) +void DataArrayDouble::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS) { setName(tinyInfoS[0]); if(isAllocated()) { - std::size_t const nbOfCompo(getNumberOfComponents()); + std::size_t nbOfCompo(getNumberOfComponents()); for(std::size_t i=0;i::min()) throw INTERP_KERNEL::Exception("DataArrayDouble::Rotate3DAlg : magnitude of input vector is too close of 0. !"); std::transform(vect,vect+3,vectorNorm,std::bind(std::multiplies(),std::placeholders::_1,1/norm)); @@ -3624,8 +3610,8 @@ void DataArrayDouble::ComputeIntegralOfSeg2IntoTri3(const double seg2[4], const */ void DataArrayDouble::Rotate2DAlg(const double *center, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut) { - double const cosa=cos(angle); - double const sina=sin(angle); + double cosa=cos(angle); + double sina=sin(angle); double matrix[4]; matrix[0]=cosa; matrix[1]=-sina; matrix[2]=sina; matrix[3]=cosa; double tmp[2]; diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx old mode 100644 new mode 100755 index 170dae82e..bde9a3816 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -30,11 +30,9 @@ #include "MEDCouplingMap.hxx" #include "BBTreePts.txx" -#include -#include #include -#include #include +#include #include namespace MEDCoupling @@ -53,14 +51,14 @@ namespace MEDCoupling class MEDCouplingPointer { public: - MEDCouplingPointer():_internal(nullptr),_external(nullptr) { } + MEDCouplingPointer():_internal(0),_external(0) { } void null() { _internal=0; _external=0; } bool isNull() const { return _internal==0 && _external==0; } void setInternal(T *pointer); void setExternal(const T *pointer); const T *getConstPointer() const { if(_internal) return _internal; else return _external; } const T *getConstPointerLoc(std::size_t offset) const { if(_internal) return _internal+offset; else return _external+offset; } - T *getPointer() { if(_internal) return _internal; if(_external) throw INTERP_KERNEL::Exception("Trying to write on an external pointer."); else return nullptr; } + T *getPointer() { if(_internal) return _internal; if(_external) throw INTERP_KERNEL::Exception("Trying to write on an external pointer."); else return 0; } private: T *_internal; const T *_external; @@ -70,9 +68,9 @@ namespace MEDCoupling class MemArray { public: - using Deallocator = void (*)(void *, void *); + typedef void (*Deallocator)(void *,void *); public: - MemArray() = default; + MemArray():_nb_of_elem(0),_nb_of_elem_alloc(0),_ownership(false),_dealloc(0),_param_for_deallocator(0) { } MemArray(const MemArray& other); bool isNull() const { return _pointer.isNull(); } const T *getConstPointerLoc(std::size_t offset) const { return _pointer.getConstPointerLoc(offset); } @@ -119,12 +117,12 @@ namespace MEDCoupling static void DestroyPointer(T *pt, Deallocator dealloc, void *param); static Deallocator BuildFromType(DeallocType type); private: - std::size_t _nb_of_elem{0}; - std::size_t _nb_of_elem_alloc{0}; - bool _ownership{false}; + std::size_t _nb_of_elem; + std::size_t _nb_of_elem_alloc; + bool _ownership; MEDCouplingPointer _pointer; - Deallocator _dealloc{nullptr}; - void *_param_for_deallocator{nullptr}; + Deallocator _dealloc; + void *_param_for_deallocator; }; template class DataArrayTools @@ -144,8 +142,8 @@ namespace MEDCoupling class MEDCOUPLING_EXPORT DataArray : public RefCountObject, public TimeLabel { public: - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; void setName(const std::string& name); void copyStringInfoFrom(const DataArray& other); void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); @@ -215,7 +213,7 @@ namespace MEDCoupling virtual void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const = 0; protected: DataArray() { } - ~DataArray() override = default; + ~DataArray() { } protected: static void CheckValueInRange(mcIdType ref, mcIdType value, const std::string& msg); static void CheckValueInRangeEx(mcIdType value, mcIdType start, mcIdType end, const std::string& msg); @@ -233,7 +231,7 @@ namespace MEDCoupling class DataArrayTemplate : public DataArray { public: - using Type = T; + typedef T Type; public: static MCAuto< typename Traits::ArrayTypeCh > NewFromStdVector(const typename std::vector& v); static MCAuto< typename Traits::ArrayTypeCh > NewFromArray(const T *arrBegin, const T *arrEnd); @@ -246,19 +244,19 @@ namespace MEDCoupling std::for_each(this->begin(),this->end(),[&comma,&oss](const T& elt) { oss << comma << elt; comma[0]=','; } ); oss << std::endl; } - std::size_t getHeapMemorySizeWithoutChildren() const override; - void updateTime() const override { } + std::size_t getHeapMemorySizeWithoutChildren() const; + void updateTime() const { } // - mcIdType getNumberOfTuples() const override { return ToIdType(_info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents()); } - mcIdType getNbOfElems() const override { return ToIdType(_mem.getNbOfElem()); } + mcIdType getNumberOfTuples() const { return ToIdType(_info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents()); } + mcIdType getNbOfElems() const { return ToIdType(_mem.getNbOfElem()); } bool empty() const; - void *getVoidStarPointer() override { return getPointer(); } + void *getVoidStarPointer() { return getPointer(); } const T *getConstPointer() const { return _mem.getConstPointer(); } const T *begin() const { return getConstPointer(); } const T *end() const { return getConstPointer()+getNbOfElems(); } T *rwBegin() { return getPointer(); } T *rwEnd() { return getPointer()+getNbOfElems(); } - void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1) override; + void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1); void useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfTuple, std::size_t nbOfCompo); void useExternalArrayWithRWAccess(const T *array, std::size_t nbOfTuple, std::size_t nbOfCompo); T getIJSafe(std::size_t tupleId, std::size_t compoId) const; @@ -269,10 +267,10 @@ namespace MEDCoupling T *getPointerSilent() { return _mem.getPointer(); } void pack() const; bool isAllocated() const override; - void checkAllocated() const override; - void desallocate() override; + void checkAllocated() const; + void desallocate(); void reserve(std::size_t nbOfElems); - void rearrange(std::size_t newNbOfCompo) override; + void rearrange(std::size_t newNbOfCompo); void transpose(); void pushBackSilent(T val); template @@ -280,14 +278,14 @@ namespace MEDCoupling T popBackSilent(); T front() const; T back() const; - std::size_t getNbOfElemAllocated() const override { return _mem.getNbOfElemAllocated(); } + std::size_t getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); } void allocIfNecessary(std::size_t nbOfTuple, std::size_t nbOfCompo); void deepCopyFrom(const DataArrayTemplate& other); void reverse(); void fillWithValue(T val); - void reAlloc(std::size_t newNbOfTuple) override; - void renumberInPlace(const mcIdType *old2New) override; - void renumberInPlaceR(const mcIdType *new2Old) override; + void reAlloc(std::size_t newNbOfTuple); + void renumberInPlace(const mcIdType *old2New); + void renumberInPlaceR(const mcIdType *new2Old); void sort(bool asc=true); typename Traits::ArrayType *renumber(const mcIdType *old2New) const; typename Traits::ArrayType *renumberR(const mcIdType *new2Old) const; @@ -295,9 +293,9 @@ namespace MEDCoupling typename Traits::ArrayType *changeNbOfComponents(std::size_t newNbOfComp, T dftValue) const; typename Traits::ArrayType *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const; MCAuto::ArrayTypeCh> selectPartDef(const PartDefinition* pd) const; - void circularPermutation(mcIdType nbOfShift=1) override; - void circularPermutationPerTuple(mcIdType nbOfShift=1) override; - void reversePerTuple() override; + void circularPermutation(mcIdType nbOfShift=1); + void circularPermutationPerTuple(mcIdType nbOfShift=1); + void reversePerTuple(); void setPartOfValues1(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true); void setPartOfValuesSimple1(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp); void setPartOfValues2(const typename Traits::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true); @@ -307,8 +305,8 @@ namespace MEDCoupling void setPartOfValues4(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true); void setPartOfValuesSimple4(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp); void setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayIdType *tuplesSelec); - void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec) override; - void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step) override; + void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec); + void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step); T getMaxValue(mcIdType& tupleId) const; T getMaxValueInArray() const; T getMaxAbsValue(std::size_t& tupleId) const; @@ -372,11 +370,11 @@ namespace MEDCoupling typename Traits::ArrayType *performCopyOrIncrRef(bool dCpy) const; typename Traits::ArrayType *sumPerTuple() const; void iota(T init=(T)0); - void reprStream(std::ostream& stream) const override; - void reprZipStream(std::ostream& stream) const override; + void reprStream(std::ostream& stream) const; + void reprZipStream(std::ostream& stream) const; void reprNotTooLongStream(std::ostream& stream) const; - void reprWithoutNameStream(std::ostream& stream) const override; - void reprZipWithoutNameStream(std::ostream& stream) const override; + void reprWithoutNameStream(std::ostream& stream) const; + void reprZipWithoutNameStream(std::ostream& stream) const; void reprNotTooLongWithoutNameStream(std::ostream& stream) const; std::string repr() const; std::string reprZip() const; @@ -408,18 +406,18 @@ namespace MEDCoupling public: static DataArrayFloat *New(); public:// abstract method overload - DataArrayFloat *deepCopy() const override; + DataArrayFloat *deepCopy() const; DataArrayFloat *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); } std::string getClassName() const override { return std::string("DataArrayFloat"); } - DataArrayFloat *buildNewEmptyInstance() const override { return DataArrayFloat::New(); } - DataArrayFloat *selectByTupleRanges(const std::vector >& ranges) const override { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } - DataArrayFloat *keepSelectedComponents(const std::vector& compoIds) const override { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } - DataArrayFloat *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } - DataArrayFloat *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - DataArrayFloat *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } - void reprCppStream(const std::string& varName, std::ostream& stream) const override; - void reprQuickOverview(std::ostream& stream) const override; - void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override; + DataArrayFloat *buildNewEmptyInstance() const { return DataArrayFloat::New(); } + DataArrayFloat *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } + DataArrayFloat *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } + DataArrayFloat *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } + DataArrayFloat *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + DataArrayFloat *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } + void reprCppStream(const std::string& varName, std::ostream& stream) const; + void reprQuickOverview(std::ostream& stream) const; + void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; public:// non abstract but essential bool isEqual(const DataArrayFloat& other, float prec) const; bool isEqualIfNotWhy(const DataArrayFloat& other, float prec, std::string& reason) const; @@ -427,7 +425,7 @@ namespace MEDCoupling public: DataArrayFloatIterator *iterator(); private: - ~DataArrayFloat() override = default; + ~DataArrayFloat() { } DataArrayFloat() { } }; } @@ -440,25 +438,25 @@ namespace MEDCoupling public: static DataArrayDouble *New(); double doubleValue() const; - DataArrayDouble *deepCopy() const override; + DataArrayDouble *deepCopy() const; DataArrayDouble *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); } std::string getClassName() const override { return std::string("DataArrayDouble"); } - DataArrayDouble *buildNewEmptyInstance() const override { return DataArrayDouble::New(); } + DataArrayDouble *buildNewEmptyInstance() const { return DataArrayDouble::New(); } void checkMonotonic(bool increasing, double eps) const; bool isMonotonic(bool increasing, double eps) const; void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& nameInFile, DataArrayByte *byteArr) const; - void reprCppStream(const std::string& varName, std::ostream& stream) const override; - void reprQuickOverview(std::ostream& stream) const override; - void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override; + void reprCppStream(const std::string& varName, std::ostream& stream) const; + void reprQuickOverview(std::ostream& stream) const; + void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; bool isEqual(const DataArrayDouble& other, double prec) const; bool isEqualIfNotWhy(const DataArrayDouble& other, double prec, std::string& reason) const; bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const; - DataArrayDouble *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } + DataArrayDouble *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } DataArrayDouble *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - DataArrayDouble *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - DataArrayDouble *keepSelectedComponents(const std::vector& compoIds) const override { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } - DataArrayDouble *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } - DataArrayDouble *selectByTupleRanges(const std::vector >& ranges) const override { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } + DataArrayDouble *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + DataArrayDouble *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } + DataArrayDouble *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } + DataArrayDouble *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayIdType *&tupleIds) const; void findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const; double minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const; @@ -552,7 +550,7 @@ namespace MEDCoupling private: DataArrayDouble *operatePerTuple(std::function func) const; private: - ~DataArrayDouble() override = default; + ~DataArrayDouble() { } DataArrayDouble() { } }; } @@ -581,9 +579,9 @@ namespace MEDCoupling void checkStrictlyMonotonic(bool increasing) const; bool isStrictlyMonotonic(bool increasing) const; mcIdType getHashCode() const; - void reprCppStream(const std::string& varName, std::ostream& stream) const override; - void reprQuickOverview(std::ostream& stream) const override; - void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override; + void reprCppStream(const std::string& varName, std::ostream& stream) const; + void reprQuickOverview(std::ostream& stream) const; + void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const; void transformWithIndArr(const T *indArrBg, const T *indArrEnd); void transformWithIndArr(const MapKeyVal& m); @@ -708,7 +706,7 @@ namespace MEDCoupling template void switchOnTupleAlg(T val, std::vector& vec, ALG algo) const; protected: - ~DataArrayDiscrete() override = default; + ~DataArrayDiscrete() { } }; template @@ -717,7 +715,7 @@ namespace MEDCoupling public: bool isFittingWith(const std::vector& v) const; protected: - ~DataArrayDiscreteSigned() override = default; + ~DataArrayDiscreteSigned() { } }; class DataArrayInt32Iterator; @@ -726,22 +724,22 @@ namespace MEDCoupling { friend class DataArrayDiscrete; public: - DataArrayInt32 *deepCopy() const override; + DataArrayInt32 *deepCopy() const; DataArrayInt32 *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); } - DataArrayInt32 *buildNewEmptyInstance() const override { return DataArrayInt32::New(); } + DataArrayInt32 *buildNewEmptyInstance() const { return DataArrayInt32::New(); } MCAuto convertToInt64Arr() const; public: - DataArrayInt32 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } + DataArrayInt32 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } DataArrayInt32 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - DataArrayInt32 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const override { return this->myKeepSelectedComponents(compoIds); } - DataArrayInt32 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return this->mySelectByTupleIdSafeSlice(bg,end2,step); } - DataArrayInt32 *selectByTupleRanges(const std::vector >& ranges) const override { return this->mySelectByTupleRanges(ranges); } + DataArrayInt32 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const { return this->myKeepSelectedComponents(compoIds); } + DataArrayInt32 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return this->mySelectByTupleIdSafeSlice(bg,end2,step); } + DataArrayInt32 *selectByTupleRanges(const std::vector >& ranges) const { return this->mySelectByTupleRanges(ranges); } std::string getClassName() const override { return std::string("DataArrayInt32"); } public: DataArrayInt32Iterator *iterator(); private: - ~DataArrayInt32() override = default; + ~DataArrayInt32() { } DataArrayInt32() { } }; @@ -749,22 +747,22 @@ namespace MEDCoupling { friend class DataArrayDiscrete; public: - DataArrayInt64 *deepCopy() const override; + DataArrayInt64 *deepCopy() const; DataArrayInt64 *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); } - DataArrayInt64 *buildNewEmptyInstance() const override { return DataArrayInt64::New(); }//ok + DataArrayInt64 *buildNewEmptyInstance() const { return DataArrayInt64::New(); }//ok MCAuto convertToInt32Arr() const; public: - DataArrayInt64 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } + DataArrayInt64 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } DataArrayInt64 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - DataArrayInt64 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - DataArrayInt64 *keepSelectedComponents(const std::vector& compoIds) const override { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - DataArrayInt64 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } - DataArrayInt64 *selectByTupleRanges(const std::vector >& ranges) const override { return DataArrayTemplate::mySelectByTupleRanges(ranges); } + DataArrayInt64 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + DataArrayInt64 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } + DataArrayInt64 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } + DataArrayInt64 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } std::string getClassName() const override { return std::string("DataArrayInt64"); } public: DataArrayInt64Iterator *iterator(); private: - ~DataArrayInt64() override = default; + ~DataArrayInt64() { } DataArrayInt64() { } }; } @@ -799,14 +797,14 @@ namespace MEDCoupling std::string repr() const; std::string reprZip() const; DataArrayInt *convertToIntArr() const; - DataArrayChar *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } + DataArrayChar *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } DataArrayChar *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - DataArrayChar *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const override { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - DataArrayChar *keepSelectedComponents(const std::vector& compoIds) const override { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - DataArrayChar *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const override { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } + DataArrayChar *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + DataArrayChar *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } + DataArrayChar *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } bool isUniform(char val) const; void meldWith(const DataArrayChar *other); - DataArray *selectByTupleRanges(const std::vector >& ranges) const override { return DataArrayTemplate::mySelectByTupleRanges(ranges); } + DataArray *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } DataArrayIdType *findIdsEqual(char val) const; DataArrayIdType *findIdsNotEqual(char val) const; mcIdType findIdSequence(const std::vector& vals) const; @@ -838,25 +836,25 @@ namespace MEDCoupling { public: static DataArrayByte *New(); - DataArrayChar *buildEmptySpecializedDAChar() const override; + DataArrayChar *buildEmptySpecializedDAChar() const; DataArrayByteIterator *iterator(); - DataArrayByte *deepCopy() const override; + DataArrayByte *deepCopy() const; DataArrayByte *copySorted(bool asc=true) const override { return this->copySortedImpl(asc); } DataArrayByte *performCopyOrIncrRef(bool deepCopy) const; - DataArrayByte *buildNewEmptyInstance() const override { return DataArrayByte::New(); } + DataArrayByte *buildNewEmptyInstance() const { return DataArrayByte::New(); } char byteValue() const; - void reprStream(std::ostream& stream) const override; - void reprZipStream(std::ostream& stream) const override; - void reprWithoutNameStream(std::ostream& stream) const override; - void reprZipWithoutNameStream(std::ostream& stream) const override; - void reprCppStream(const std::string& varName, std::ostream& stream) const override; - void reprQuickOverview(std::ostream& stream) const override; - void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override; - bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const override; + void reprStream(std::ostream& stream) const; + void reprZipStream(std::ostream& stream) const; + void reprWithoutNameStream(std::ostream& stream) const; + void reprZipWithoutNameStream(std::ostream& stream) const; + void reprCppStream(const std::string& varName, std::ostream& stream) const; + void reprQuickOverview(std::ostream& stream) const; + void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; + bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const; std::vector toVectorOfBool() const; std::string getClassName() const override { return std::string("DataArrayByte"); } private: - ~DataArrayByte() override = default; + ~DataArrayByte() { } DataArrayByte() { } }; @@ -868,24 +866,24 @@ namespace MEDCoupling static DataArrayAsciiChar *New(); static DataArrayAsciiChar *New(const std::string& st); static DataArrayAsciiChar *New(const std::vector& vst, char defaultChar); - DataArrayChar *buildEmptySpecializedDAChar() const override; + DataArrayChar *buildEmptySpecializedDAChar() const; DataArrayAsciiCharIterator *iterator(); - DataArrayAsciiChar *deepCopy() const override; + DataArrayAsciiChar *deepCopy() const; DataArrayAsciiChar *copySorted(bool asc=true) const override { (void)asc;throw INTERP_KERNEL::Exception("DataArrayAsciiChar::copySorted : not implemented for DataArrayByte"); } DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const; - DataArrayAsciiChar *buildNewEmptyInstance() const override { return DataArrayAsciiChar::New(); } + DataArrayAsciiChar *buildNewEmptyInstance() const { return DataArrayAsciiChar::New(); } char asciiCharValue() const; - void reprStream(std::ostream& stream) const override; - void reprZipStream(std::ostream& stream) const override; - void reprWithoutNameStream(std::ostream& stream) const override; - void reprZipWithoutNameStream(std::ostream& stream) const override; - void reprCppStream(const std::string& varName, std::ostream& stream) const override; - void reprQuickOverview(std::ostream& stream) const override; - void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const override; - bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const override; + void reprStream(std::ostream& stream) const; + void reprZipStream(std::ostream& stream) const; + void reprWithoutNameStream(std::ostream& stream) const; + void reprZipWithoutNameStream(std::ostream& stream) const; + void reprCppStream(const std::string& varName, std::ostream& stream) const; + void reprQuickOverview(std::ostream& stream) const; + void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; + bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const; std::string getClassName() const override { return std::string("DataArrayAsciiChar"); } private: - ~DataArrayAsciiChar() override = default; + ~DataArrayAsciiChar() { } DataArrayAsciiChar() { } DataArrayAsciiChar(const std::string& st); DataArrayAsciiChar(const std::vector& vst, char defaultChar); @@ -929,7 +927,7 @@ namespace MEDCoupling { public: DataArrayDoubleIterator(DataArrayDouble *da); - ~DataArrayDoubleIterator() = default; + ~DataArrayDoubleIterator() { } }; class MEDCOUPLING_EXPORT DataArrayDoubleTuple : public DataArrayTuple @@ -947,7 +945,7 @@ namespace MEDCoupling { public: DataArrayFloatIterator(DataArrayFloat *da); - ~DataArrayFloatIterator() = default; + ~DataArrayFloatIterator() { } }; class MEDCOUPLING_EXPORT DataArrayFloatTuple : public DataArrayTuple @@ -963,14 +961,14 @@ namespace MEDCoupling { public: DataArrayInt32Iterator(DataArrayInt32 *da); - ~DataArrayInt32Iterator() = default; + ~DataArrayInt32Iterator() { } }; class MEDCOUPLING_EXPORT DataArrayInt64Iterator : public DataArrayIterator { public: DataArrayInt64Iterator(DataArrayInt64 *da); - ~DataArrayInt64Iterator() = default; + ~DataArrayInt64Iterator() { } }; class MEDCOUPLING_EXPORT DataArrayInt32Tuple : public DataArrayTuple @@ -991,7 +989,7 @@ namespace MEDCoupling DataArrayInt64 *buildDAInt(std::size_t nbOfTuples, std::size_t nbOfCompo) const; }; - using DataArrayIntTuple = DataArrayInt32Tuple; + typedef DataArrayInt32Tuple DataArrayIntTuple; class DataArrayAsciiCharTuple; diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx old mode 100644 new mode 100755 index 6b7acf9f9..b00a16418 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -21,31 +21,21 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGMEMARRAY_TXX__ #define __PARAMEDMEM_MEDCOUPLINGMEMARRAY_TXX__ -#include "MCType.hxx" -#include "MEDCouplingMap.txx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTraits.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "InterpKernelException.hxx" +#include "InterpolationUtils.hxx" #include "MEDCouplingPartDefinition.hxx" #include "InterpKernelAutoPtr.hxx" #include "MCAuto.hxx" +#include "MEDCouplingMap.txx" -#include -#include -#include -#include -#include -#include #include -#include #include #include #include #include -#include -#include -#include +#include namespace MEDCoupling { @@ -53,7 +43,7 @@ namespace MEDCoupling void MEDCouplingPointer::setInternal(T *pointer) { _internal=pointer; - _external=nullptr; + _external=0; } template @@ -64,7 +54,7 @@ namespace MEDCoupling } template - MemArray::MemArray(const MemArray& other) + MemArray::MemArray(const MemArray& other):_nb_of_elem(0),_nb_of_elem_alloc(0),_ownership(false),_dealloc(0),_param_for_deallocator(0) { if(!other._pointer.isNull()) { @@ -188,7 +178,7 @@ namespace MEDCoupling stream << "No data"; stream << "\n"; stream << "Data content :\n"; - bool const ret=!_pointer.isNull(); + bool ret=!_pointer.isNull(); if(!ret) stream << "No data !\n"; return ret; @@ -205,7 +195,7 @@ namespace MEDCoupling const T *data=getConstPointer(); if(_nb_of_elem!=0 && sl!=0) { - std::size_t const nbOfTuples=_nb_of_elem/std::abs(sl); + std::size_t nbOfTuples=_nb_of_elem/std::abs(sl); for(std::size_t i=0;i const it1(pt+_nb_of_elem); - typename std::reverse_iterator const it2(pt); + typename std::reverse_iterator it1(pt+_nb_of_elem); + typename std::reverse_iterator it2(pt); std::sort(it1,it2); } } @@ -411,7 +401,7 @@ namespace MEDCoupling _nb_of_elem_alloc=newNbOfElements; _ownership=true; _dealloc=CDeallocator; - _param_for_deallocator=nullptr; + _param_for_deallocator=0; } /*! @@ -435,17 +425,17 @@ namespace MEDCoupling _nb_of_elem_alloc=newNbOfElements; _ownership=true; _dealloc=CDeallocator; - _param_for_deallocator=nullptr; + _param_for_deallocator=0; } template - void MemArray::CPPDeallocator(void *pt, void * /*param*/) + void MemArray::CPPDeallocator(void *pt, void *param) { delete [] reinterpret_cast(pt); } template - void MemArray::CDeallocator(void *pt, void * /*param*/) + void MemArray::CDeallocator(void *pt, void *param) { free(pt); } @@ -453,7 +443,7 @@ namespace MEDCoupling template void MemArray::COffsetDeallocator(void *pt, void *param) { - auto *offset(reinterpret_cast(param)); + int64_t *offset(reinterpret_cast(param)); char *ptcast(reinterpret_cast(pt)); free(ptcast+*offset); } @@ -488,8 +478,8 @@ namespace MEDCoupling DestroyPointer(const_cast(_pointer.getConstPointer()),_dealloc,_param_for_deallocator);//Do not use getPointer because in case of _external _pointer.null(); _ownership=false; - _dealloc=nullptr; - _param_for_deallocator=nullptr; + _dealloc=NULL; + _param_for_deallocator=NULL; _nb_of_elem=0; _nb_of_elem_alloc=0; } @@ -532,7 +522,7 @@ namespace MEDCoupling if(_tuple_id<_nb_tuple) { _tuple_id++; - auto *ret=new typename Traits::ArrayTuple(_pt,_nb_comp); + typename Traits::ArrayTuple *ret=new typename Traits::ArrayTuple(_pt,_nb_comp); _pt+=_nb_comp; return ret; } @@ -823,7 +813,7 @@ namespace MEDCoupling template bool DataArrayTemplate::isAllocated() const { - return getConstPointer()!=nullptr; + return getConstPointer()!=0; } /*! @@ -966,7 +956,7 @@ namespace MEDCoupling mcIdType nbOfTuples(other.getNumberOfTuples()); std::size_t nbOfComp(other.getNumberOfComponents()); allocIfNecessary(nbOfTuples,nbOfComp); - std::size_t const nbOfElems(nbOfTuples*nbOfComp); + std::size_t nbOfElems(nbOfTuples*nbOfComp); T *pt(getPointer()); const T *ptI(other.begin()); for(std::size_t i=0;i::renumberInPlace(const mcIdType *old2New) { checkAllocated(); - mcIdType const nbTuples(getNumberOfTuples()); - std::size_t const nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbOfCompo(getNumberOfComponents()); T *tmp(new T[nbTuples*nbOfCompo]); const T *iptr(begin()); for(mcIdType i=0;i=0 && v::renumberInPlaceR(const mcIdType *new2Old) { checkAllocated(); - mcIdType const nbTuples(getNumberOfTuples()); - std::size_t const nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbOfCompo(getNumberOfComponents()); T *tmp(new T[nbTuples*nbOfCompo]); const T *iptr(begin()); for(mcIdType i=0;i=0 && vgetPointer(); for(mcIdType i=0;i=0) std::copy(iptr+i*nbOfCompo,iptr+(i+1)*nbOfCompo,optr+w*nbOfCompo); } @@ -1235,7 +1225,7 @@ namespace MEDCoupling checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - std::size_t const nbComp(getNumberOfComponents()); + std::size_t nbComp(getNumberOfComponents()); ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); T *pt(ret->getPointer()); @@ -1259,7 +1249,7 @@ namespace MEDCoupling if(!pd) throw INTERP_KERNEL::Exception("DataArrayTemplate::selectPartDef : null input pointer !"); MCAuto::ArrayTypeCh> ret(Traits::ArrayTypeCh::New()); - const auto *spd(dynamic_cast(pd)); + const SlicePartDefinition *spd(dynamic_cast(pd)); if(spd) { mcIdType a,b,c; @@ -1277,7 +1267,7 @@ namespace MEDCoupling return DynamicCastSafe::ArrayTypeCh>(ret2); } } - const auto *dpd(dynamic_cast(pd)); + const DataArrayPartDefinition *dpd(dynamic_cast(pd)); if(dpd) { MCAuto arr(dpd->toDAI()); @@ -1313,8 +1303,8 @@ namespace MEDCoupling checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - std::size_t const nbComp(getNumberOfComponents()); - mcIdType const oldNbOfTuples(getNumberOfTuples()); + std::size_t nbComp(getNumberOfComponents()); + mcIdType oldNbOfTuples(getNumberOfTuples()); ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); T *pt(ret->getPointer()); @@ -1352,7 +1342,7 @@ namespace MEDCoupling std::ostringstream oss; oss << Traits::ArrayTypeName << "::rearrange : input newNbOfCompo must be > 0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::size_t const nbOfElems=getNbOfElems(); + std::size_t nbOfElems=getNbOfElems(); if(nbOfElems%newNbOfCompo!=0) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::rearrange : nbOfElems%newNbOfCompo!=0 !"; @@ -1409,7 +1399,7 @@ namespace MEDCoupling T *nc(ret->getPointer()); mcIdType nbOfTuples=getNumberOfTuples(); std::size_t oldNbOfComp=getNumberOfComponents(); - std::size_t const dim(std::min(oldNbOfComp,newNbOfComp)); + std::size_t dim(std::min(oldNbOfComp,newNbOfComp)); for(mcIdType i=0;i ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - std::size_t const newNbOfCompo=compoIds.size(); - std::size_t const oldNbOfCompo=getNumberOfComponents(); - for(unsigned long const compoId : compoIds) - if(compoId>=oldNbOfCompo) // (*it) >= 0 (it is a size_t) + std::size_t newNbOfCompo=compoIds.size(); + std::size_t oldNbOfCompo=getNumberOfComponents(); + for(std::vector::const_iterator it=compoIds.begin();it!=compoIds.end();it++) + if((*it)>=oldNbOfCompo) // (*it) >= 0 (it is a size_t) { - std::ostringstream oss; oss << Traits::ArrayTypeName << "::keepSelectedComponents : invalid requested component : " << compoId << " whereas it should be in [0," << oldNbOfCompo << ") !"; + std::ostringstream oss; oss << Traits::ArrayTypeName << "::keepSelectedComponents : invalid requested component : " << *it << " whereas it should be in [0," << oldNbOfCompo << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType const nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); ret->alloc(nbOfTuples,newNbOfCompo); ret->copyPartOfStringInfoFrom(*this,compoIds); const T *oldc(getConstPointer()); @@ -1538,9 +1528,9 @@ namespace MEDCoupling checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - std::size_t const nbComp(getNumberOfComponents()); + std::size_t nbComp(getNumberOfComponents()); std::ostringstream oss; oss << Traits::ArrayTypeName << "::selectByTupleIdSafeSlice : "; - mcIdType const newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str())); + mcIdType newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str())); ret->alloc(newNbOfTuples,nbComp); T *pt(ret->getPointer()); const T *srcPt(getConstPointer()+bg*nbComp); @@ -1660,8 +1650,8 @@ namespace MEDCoupling { const char msg[]="DataArrayTemplate::setPartOfValuesSimple1"; checkAllocated(); - mcIdType const newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); - mcIdType const newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); + mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); + mcIdType newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); std::size_t nbComp(getNumberOfComponents()); mcIdType nbOfTuples(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); @@ -1929,7 +1919,7 @@ namespace MEDCoupling { const char msg[]="DataArrayTemplate::setPartOfValuesSimple3"; checkAllocated(); - std::size_t const newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); + std::size_t newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); std::size_t nbComp(getNumberOfComponents()); mcIdType nbOfTuples(getNumberOfTuples()); DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value"); @@ -2025,7 +2015,7 @@ namespace MEDCoupling { const char msg[]="DataArrayTemplate::setPartOfValuesSimple4"; checkAllocated(); - mcIdType const newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); + mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); std::size_t nbComp(getNumberOfComponents()); for(const mcIdType *z=bgComp;z!=endComp;z++) DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id"); @@ -2125,20 +2115,20 @@ namespace MEDCoupling { if(!aBase || !tuplesSelec) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : input DataArray is NULL !"); - const auto *a(dynamic_cast::ArrayType *>(aBase)); + const typename Traits::ArrayType *a(dynamic_cast::ArrayType *>(aBase)); if(!a) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : input DataArray aBase is not a DataArrayDouble !"); checkAllocated(); a->checkAllocated(); tuplesSelec->checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp!=a->getNumberOfComponents()) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : This and a do not have the same number of components !"); if(tuplesSelec->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : Expecting to have a tuple selector DataArrayInt instance with exactly 1 component !"); - mcIdType const thisNt(getNumberOfTuples()); - mcIdType const aNt(a->getNumberOfTuples()); - mcIdType const nbOfTupleToWrite(tuplesSelec->getNumberOfTuples()); + mcIdType thisNt(getNumberOfTuples()); + mcIdType aNt(a->getNumberOfTuples()); + mcIdType nbOfTupleToWrite(tuplesSelec->getNumberOfTuples()); T *valsToSet(getPointer()+tupleIdStart*nbOfComp); if(tupleIdStart+nbOfTupleToWrite>thisNt) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : invalid number range of values to write !"); @@ -2191,18 +2181,18 @@ namespace MEDCoupling std::ostringstream oss; oss << Traits::ArrayTypeName << "::setContigPartOfSelectedValuesSlice : input DataArray is NULL !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const auto *a(dynamic_cast::ArrayType *>(aBase)); + const typename Traits::ArrayType *a(dynamic_cast::ArrayType *>(aBase)); if(!a) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : input DataArray aBase is not a DataArrayDouble !"); checkAllocated(); a->checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); const char msg[]="DataArrayDouble::setContigPartOfSelectedValuesSlice"; - mcIdType const nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg)); + mcIdType nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg)); if(nbOfComp!=a->getNumberOfComponents()) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : This and a do not have the same number of components !"); - mcIdType const thisNt(getNumberOfTuples()); - mcIdType const aNt(a->getNumberOfTuples()); + mcIdType thisNt(getNumberOfTuples()); + mcIdType aNt(a->getNumberOfTuples()); T *valsToSet(getPointer()+tupleIdStart*nbOfComp); if(tupleIdStart+nbOfTupleToWrite>thisNt) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : invalid number range of values to write !"); @@ -2231,8 +2221,8 @@ namespace MEDCoupling typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleRanges(const std::vector >& ranges) const { checkAllocated(); - std::size_t const nbOfComp(getNumberOfComponents()); - mcIdType const nbOfTuplesThis(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()); + mcIdType nbOfTuplesThis(getNumberOfTuples()); if(ranges.empty()) { MCAuto ret0(buildNewEmptyInstance()); @@ -2243,7 +2233,7 @@ namespace MEDCoupling } mcIdType ref(ranges.front().first),nbOfTuples(0); bool isIncreasing(true); - for(auto it=ranges.begin();it!=ranges.end();it++) + for(std::vector >::const_iterator it=ranges.begin();it!=ranges.end();it++) { if((*it).first<=(*it).second) { @@ -2276,8 +2266,8 @@ namespace MEDCoupling ret->copyStringInfoFrom(*this); const T *src(getConstPointer()); T *work(ret->getPointer()); - for(const auto & range : ranges) - work=std::copy(src+range.first*nbOfComp,src+range.second*nbOfComp,work); + for(std::vector >::const_iterator it=ranges.begin();it!=ranges.end();it++) + work=std::copy(src+(*it).first*nbOfComp,src+(*it).second*nbOfComp,work); return ret.retn(); } @@ -2444,9 +2434,9 @@ namespace MEDCoupling void DataArrayTemplate::circularPermutation(mcIdType nbOfShift) { checkAllocated(); - std::size_t const nbOfCompo(getNumberOfComponents()); - mcIdType const nbTuples(getNumberOfTuples()); - mcIdType const effNbSh(EffectiveCircPerm(nbOfShift,nbTuples)); + std::size_t nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + mcIdType effNbSh(EffectiveCircPerm(nbOfShift,nbTuples)); if(effNbSh==0) return ; T *work(getPointer()); @@ -2470,9 +2460,9 @@ namespace MEDCoupling void DataArrayTemplate::circularPermutationPerTuple(mcIdType nbOfShift) { checkAllocated(); - std::size_t const nbOfCompo(getNumberOfComponents()); - mcIdType const nbTuples(getNumberOfTuples()); - mcIdType const effNbSh(EffectiveCircPerm(nbOfShift,ToIdType(nbOfCompo))); + std::size_t nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + mcIdType effNbSh(EffectiveCircPerm(nbOfShift,ToIdType(nbOfCompo))); if(effNbSh==0) return ; T *work(getPointer()); @@ -2506,8 +2496,8 @@ namespace MEDCoupling void DataArrayTemplate::reversePerTuple() { checkAllocated(); - std::size_t const nbOfCompo(getNumberOfComponents()); - mcIdType const nbTuples(getNumberOfTuples()); + std::size_t nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); if(nbOfCompo<=1) return ; T *work(getPointer()); @@ -3816,7 +3806,7 @@ struct NotInRange mcIdType *retToFill(ret->getPointer()); for(mcIdType i=0;i::const_iterator it=mm.find(ToIdType(pt[i])); if(it==mm.end()) { std::ostringstream oss; oss << "DataArrayInt::buildPermutationArr : Arrays mismatch : element (" << pt[i] << ") in 'other' not findable in 'this' !"; @@ -3858,7 +3848,7 @@ struct NotInRange throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : some elements appears more than once !"); for(mcIdType i=0;i::const_iterator it(m.find(ToIdType(*pt))); if(it!=m.end()) *retPt=(*it).second; else @@ -4009,8 +3999,8 @@ struct NotInRange template void DataArrayDiscrete::reprCppStream(const std::string& varName, std::ostream& stream) const { - mcIdType const nbTuples(this->getNumberOfTuples()); - std::size_t const nbComp(this->getNumberOfComponents()); + mcIdType nbTuples(this->getNumberOfTuples()); + std::size_t nbComp(this->getNumberOfComponents()); const T *data(this->getConstPointer()); stream << Traits::ArrayTypeName << " *" << varName << "=" << Traits::ArrayTypeName << "::New();" << std::endl; if(nbTuples*nbComp>=1) @@ -4035,10 +4025,10 @@ struct NotInRange stream << Traits::ArrayTypeName << " C++ instance at " << this << ". "; if(this->isAllocated()) { - std::size_t const nbOfCompo(this->getNumberOfComponents()); + std::size_t nbOfCompo(this->getNumberOfComponents()); if(nbOfCompo>=1) { - mcIdType const nbOfTuples(this->getNumberOfTuples()); + mcIdType nbOfTuples(this->getNumberOfTuples()); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -4053,8 +4043,8 @@ struct NotInRange void DataArrayDiscrete::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const T *data(this->begin()); - mcIdType const nbOfTuples(this->getNumberOfTuples()); - std::size_t const nbOfCompo(this->getNumberOfComponents()); + mcIdType nbOfTuples(this->getNumberOfTuples()); + std::size_t nbOfCompo(this->getNumberOfComponents()); std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; @@ -4073,7 +4063,7 @@ struct NotInRange else oss2 << *data++; if(i!=nbOfTuples-1) oss2 << ", "; - std::string const oss3Str(oss2.str()); + std::string oss3Str(oss2.str()); if(oss3Str.length()(),std::placeholders::_1,work[i])); std::size_t pos=std::distance(bg,res); - std::size_t const pos2=nbOfCast-pos; + std::size_t pos2=nbOfCast-pos; if(pos2(pos2); @@ -4717,8 +4707,8 @@ struct NotInRange MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfTuples,1); mcIdType *retPtr=ret->getPointer(); - for(const auto & it1 : tmp) - retPtr=std::copy(it1.begin(),it1.end(),retPtr); + for(std::vector< std::vector >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++) + retPtr=std::copy((*it1).begin(),(*it1).end(),retPtr); arr=ret.retn(); arrI=retI.retn(); } @@ -4897,7 +4887,7 @@ struct NotInRange this->checkAllocated(); a->checkAllocated(); this->copyPartOfStringInfoFrom2(compoIds,*a); - std::size_t const partOfCompoSz=compoIds.size(); + std::size_t partOfCompoSz=compoIds.size(); std::size_t nbOfCompo = this->getNumberOfComponents(); mcIdType nbOfTuples=std::min(this->getNumberOfTuples(),a->getNumberOfTuples()); const T *ac=a->getConstPointer(); @@ -5654,7 +5644,7 @@ struct NotInRange tmp[*w]=true; else throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : an element is not in valid range : [0,nbOfElement) !"); - std::size_t const nbOfRetVal=std::count(tmp.begin(),tmp.end(),false); + std::size_t nbOfRetVal=std::count(tmp.begin(),tmp.end(),false); DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(nbOfRetVal,1); mcIdType j=0; @@ -6790,7 +6780,7 @@ struct NotInRange this->setName(tinyInfoS[0]); if(this->isAllocated()) { - mcIdType const nbOfCompo=tinyInfoI[1]; + mcIdType nbOfCompo=tinyInfoI[1]; for(mcIdType i=0;isetInfoOnComponent(i,tinyInfoS[i+1]); } @@ -7070,7 +7060,7 @@ struct NotInRange mcIdType *DataArrayDiscrete::CheckAndPreparePermutation(const T *start, const T *end) { std::size_t sz=std::distance(start,end); - auto *ret=(mcIdType *)malloc(sz*sizeof(mcIdType)); + mcIdType *ret=(mcIdType *)malloc(sz*sizeof(mcIdType)); T *work=new T[sz]; std::copy(start,end,work); std::sort(work,work+sz); @@ -7353,10 +7343,10 @@ struct NotInRange arrIn->checkAllocated(); arrIndxIn->checkAllocated(); if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : input arrays must have exactly one component !"); - std::size_t const sz=std::distance(idsOfSelectBg,idsOfSelectEnd); + std::size_t sz=std::distance(idsOfSelectBg,idsOfSelectEnd); const T *arrInPtr=arrIn->begin(); const mcIdType *arrIndxPtr=arrIndxIn->begin(); - mcIdType const nbOfGrps=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfGrps=arrIndxIn->getNumberOfTuples()-1; if(nbOfGrps<0) throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !"); mcIdType maxSizeOfArr(arrIn->getNumberOfTuples()); @@ -7429,10 +7419,10 @@ struct NotInRange arrIn->checkAllocated(); arrIndxIn->checkAllocated(); if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : input arrays must have exactly one component !"); - mcIdType const sz=DataArray::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice "); + mcIdType sz=DataArray::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice "); const T *arrInPtr=arrIn->begin(); const mcIdType *arrIndxPtr=arrIndxIn->begin(); - mcIdType const nbOfGrps=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfGrps=arrIndxIn->getNumberOfTuples()-1; if(nbOfGrps<0) throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !"); mcIdType maxSizeOfArr(arrIn->getNumberOfTuples()); @@ -7502,11 +7492,11 @@ struct NotInRange const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex, DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut) { - if(arrIn==0 || arrIndxIn==nullptr || srcArr==0 || srcArrIndex==nullptr) + if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : presence of null pointer in input parameter !"); MCAuto arro=DataArrayType::New(); MCAuto arrIo=DataArrayIdType::New(); - mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; std::vector v(nbOfTuples,true); mcIdType offset=0; const mcIdType *arrIndxInPtr=arrIndxIn->begin(); @@ -7540,7 +7530,7 @@ struct NotInRange } else { - std::size_t const pos=std::distance(idsOfSelectBg,std::find(idsOfSelectBg,idsOfSelectEnd,ii)); + std::size_t pos=std::distance(idsOfSelectBg,std::find(idsOfSelectBg,idsOfSelectEnd,ii)); arroPtr=std::copy(srcArrPtr+srcArrIndexPtr[pos],srcArrPtr+srcArrIndexPtr[pos+1],arroPtr); *arrIoPtr=arrIoPtr[-1]+(srcArrIndexPtr[pos+1]-srcArrIndexPtr[pos]); } @@ -7573,15 +7563,15 @@ struct NotInRange const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex, DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut) { - if(arrIn==0 || arrIndxIn==nullptr || srcArr==0 || srcArrIndex==nullptr) + if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSlice : presence of null pointer in input parameter !"); MCAuto arro=DataArrayType::New(); MCAuto arrIo=DataArrayIdType::New(); - mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; mcIdType offset=0; const mcIdType *arrIndxInPtr=arrIndxIn->begin(); const mcIdType *srcArrIndexPtr=srcArrIndex->begin(); - mcIdType const nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSlice : "); + mcIdType nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSlice : "); mcIdType it=start; for(mcIdType i=0;igetPointer(); for(mcIdType ii=0;iigetNumberOfTuples()-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; const mcIdType *arrIndxInPtr=arrIndxIn->begin(); const mcIdType *srcArrIndexPtr=srcArrIndex->begin(); T *arrInOutPtr=arrInOut->getPointer(); @@ -7682,14 +7672,14 @@ struct NotInRange DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn, const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex) { - if(arrInOut==0 || arrIndxIn==nullptr || srcArr==0 || srcArrIndex==nullptr) + if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : presence of null pointer in input parameter !"); - mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; const mcIdType *arrIndxInPtr=arrIndxIn->begin(); const mcIdType *srcArrIndexPtr=srcArrIndex->begin(); T *arrInOutPtr=arrInOut->getPointer(); const T *srcArrPtr=srcArr->begin(); - mcIdType const nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : "); + mcIdType nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : "); mcIdType it=start; for(mcIdType i=0;i=0 !"); std::set s(idsToRemoveBg,idsToRemoveEnd); - mcIdType const nbOfGrps=arrIndx->getNumberOfTuples()-1; + mcIdType nbOfGrps=arrIndx->getNumberOfTuples()-1; mcIdType *arrIPtr=arrIndx->getPointer(); *arrIPtr++=0; mcIdType previousArrI=0; @@ -7823,7 +7813,7 @@ struct NotInRange ret->alloc(nbOfOldTuples,1); mcIdType *pt=ret->getPointer(); std::fill(pt,pt+nbOfOldTuples,-1); - mcIdType const nbOfGrps=ToIdType(std::distance(arrIBg,arrIEnd))-1; + mcIdType nbOfGrps=ToIdType(std::distance(arrIBg,arrIEnd))-1; const mcIdType *cIPtr=arrIBg; for(mcIdType i=0;i=0 && arr[j]getConstPointer(); std::size_t nbOfElem=(*iter)->getNbOfElems(); - mcIdType const sfid=fid; + mcIdType sfid=fid; for(mcIdType j=0;j(_cnt); _cnt++; } private: T *_pt; - MEDCoupling::mcIdType _cnt{0}; + MEDCoupling::mcIdType _cnt; }; template class OpSwitchedOff { public: - OpSwitchedOff(T *pt):_pt(pt) { } + OpSwitchedOff(T *pt):_pt(pt),_cnt(0) { } void operator()(const bool& b) { if(!b) *_pt++=FromIdType(_cnt); _cnt++; } private: T *_pt; - MEDCoupling::mcIdType _cnt{0}; + MEDCoupling::mcIdType _cnt; }; } /// @endcond @@ -8013,7 +8003,7 @@ namespace MEDCoupling const T *w(this->begin()),*end2(this->end()); T refVal=-std::numeric_limits::max(); T i=0; - auto it(v.begin()); + std::vector::const_iterator it(v.begin()); for(;it!=v.end();it++,i++) { if(*it) diff --git a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx old mode 100644 new mode 100755 index 7415ff7a8..90b42eb1d --- a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx @@ -19,22 +19,14 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingMemArray.txx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include -#include -#include -#include #include #include +#include #include #include -#include -#include -#include +#include using namespace MEDCoupling; @@ -50,8 +42,8 @@ template class MEDCoupling::DataArrayTemplate; mcIdType DataArrayChar::getHashCode() const { checkAllocated(); - std::size_t const nbOfElems=getNbOfElems(); - std::size_t const ret=nbOfElems*65536; + std::size_t nbOfElems=getNbOfElems(); + std::size_t ret=nbOfElems*65536; std::size_t delta=3; if(nbOfElems>48) delta=nbOfElems/8; @@ -130,7 +122,7 @@ DataArrayInt *DataArrayChar::convertToIntArr() const checkAllocated(); DataArrayInt *ret=DataArrayInt::New(); ret->alloc(getNumberOfTuples(),getNumberOfComponents()); - std::size_t const nbOfVals=getNbOfElems(); + std::size_t nbOfVals=getNbOfElems(); const char *src=getConstPointer(); int *dest=ret->getPointer(); std::copy(src,src+nbOfVals,dest); @@ -150,7 +142,7 @@ bool DataArrayChar::isUniform(char val) const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayChar::isUniform : must be applied on DataArrayChar with only one component, you can call 'rearrange' method before !"); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); const char *w=getConstPointer(); const char *end2=w+nbOfTuples; for(;w!=end2;w++) @@ -179,11 +171,11 @@ void DataArrayChar::meldWith(const DataArrayChar *other) throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : DataArrayChar pointer in input is NULL !"); checkAllocated(); other->checkAllocated(); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); if(nbOfTuples!=other->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : mismatch of number of tuples !"); - std::size_t const nbOfComp1=getNumberOfComponents(); - std::size_t const nbOfComp2=other->getNumberOfComponents(); + std::size_t nbOfComp1=getNumberOfComponents(); + std::size_t nbOfComp2=other->getNumberOfComponents(); char *newArr=(char *)malloc(nbOfTuples*(nbOfComp1+nbOfComp2)*sizeof(char)); char *w=newArr; const char *inp1=getConstPointer(); @@ -216,7 +208,7 @@ DataArrayIdType *DataArrayChar::findIdsEqual(char val) const throw INTERP_KERNEL::Exception("DataArrayChar::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !"); const char *cptr=getConstPointer(); MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); for(mcIdType i=0;ipushBackSilent(i); @@ -239,7 +231,7 @@ DataArrayIdType *DataArrayChar::findIdsNotEqual(char val) const throw INTERP_KERNEL::Exception("DataArrayChar::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !"); const char *cptr=getConstPointer(); MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); for(mcIdType i=0;ipushBackSilent(i); @@ -258,7 +250,7 @@ mcIdType DataArrayChar::findIdSequence(const std::vector& vals) const if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayChar::findIdSequence : works only for DataArrayChar instance with one component !"); const char *cptr=getConstPointer(); - std::size_t const nbOfVals=getNbOfElems(); + std::size_t nbOfVals=getNbOfElems(); const char *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end()); if(loc!=cptr+nbOfVals) return ToIdType(std::distance(cptr,loc)); @@ -280,7 +272,7 @@ mcIdType DataArrayChar::findIdSequence(const std::vector& vals) const mcIdType DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const { checkAllocated(); - std::size_t const nbOfCompo=getNumberOfComponents(); + std::size_t nbOfCompo=getNumberOfComponents(); if(nbOfCompo==0) throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqualTuple : 0 components in 'this' !"); if(nbOfCompo!=tupl.size()) @@ -289,7 +281,7 @@ mcIdType DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) con throw INTERP_KERNEL::Exception(oss.str().c_str()); } const char *cptr=getConstPointer(); - std::size_t const nbOfVals=getNbOfElems(); + std::size_t nbOfVals=getNbOfElems(); for(const char *work=cptr;work!=cptr+nbOfVals;) { work=std::search(work,cptr+nbOfVals,tupl.begin(),tupl.end()); @@ -353,7 +345,7 @@ mcIdType DataArrayChar::findIdFirstEqual(char value) const if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayChar::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); const char *cptr=getConstPointer(); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); const char *ret=std::find(cptr,cptr+nbOfTuples,value); if(ret!=cptr+nbOfTuples) return ToIdType(std::distance(cptr,ret)); @@ -373,7 +365,7 @@ mcIdType DataArrayChar::findIdFirstEqual(const std::vector& vals) const throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqual : the array must have only one component, you can call 'rearrange' method before !"); std::set vals2(vals.begin(),vals.end()); const char *cptr=getConstPointer(); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); for(const char *w=cptr;w!=cptr+nbOfTuples;w++) if(vals2.find(*w)!=vals2.end()) return ToIdType(std::distance(cptr,w)); @@ -396,7 +388,7 @@ DataArrayIdType *DataArrayChar::findIdsInRange(char vmin, char vmax) const throw INTERP_KERNEL::Exception("DataArrayChar::findIdsInRange : this must have exactly one component !"); const char *cptr=getConstPointer(); MCAuto ret=DataArrayIdType::New(); ret->alloc(0,1); - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); for(mcIdType i=0;i=vmin && *cptrpushBackSilent(i); @@ -441,13 +433,13 @@ DataArrayChar *DataArrayChar::Aggregate(const DataArrayChar *a1, const DataArray DataArrayChar *DataArrayChar::Aggregate(const std::vector& arr) { std::vector a; - for(auto it4 : arr) - if(it4) - a.push_back(it4); + for(std::vector::const_iterator it4=arr.begin();it4!=arr.end();it4++) + if(*it4) + a.push_back(*it4); if(a.empty()) throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : input list must be NON EMPTY !"); std::vector::const_iterator it=a.begin(); - std::size_t const nbOfComp((*it)->getNumberOfComponents()); + std::size_t nbOfComp((*it)->getNumberOfComponents()); mcIdType nbt=(*it++)->getNumberOfTuples(); for(;it!=a.end();it++) { @@ -505,16 +497,16 @@ DataArrayChar *DataArrayChar::Meld(const DataArrayChar *a1, const DataArrayChar DataArrayChar *DataArrayChar::Meld(const std::vector& arr) { std::vector a; - for(auto it4 : arr) - if(it4) - a.push_back(it4); + for(std::vector::const_iterator it4=arr.begin();it4!=arr.end();it4++) + if(*it4) + a.push_back(*it4); if(a.empty()) throw INTERP_KERNEL::Exception("DataArrayChar::Meld : array must be NON empty !"); std::vector::const_iterator it; for(it=a.begin();it!=a.end();it++) (*it)->checkAllocated(); it=a.begin(); - mcIdType const nbOfTuples=(*it)->getNumberOfTuples(); + mcIdType nbOfTuples=(*it)->getNumberOfTuples(); std::vector nbc(a.size()); std::vector pts(a.size()); nbc[0]=(*it)->getNumberOfComponents(); @@ -526,7 +518,7 @@ DataArrayChar *DataArrayChar::Meld(const std::vector& arr nbc[i]=(*it)->getNumberOfComponents(); pts[i]=(*it)->getConstPointer(); } - std::size_t const totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),(std::size_t)0); + std::size_t totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),(std::size_t)0); DataArrayChar *ret=a[0]->buildEmptySpecializedDAChar(); ret->alloc(nbOfTuples,totalNbOfComp); char *retPtr=ret->getPointer(); @@ -629,8 +621,8 @@ void DataArrayByte::reprWithoutNameStream(std::ostream& stream) const if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream)) { const char *data=begin(); - mcIdType const nbOfTuples=getNumberOfTuples(); - std::size_t const nbCompo=getNumberOfComponents(); + mcIdType nbOfTuples=getNumberOfTuples(); + std::size_t nbCompo=getNumberOfComponents(); for(mcIdType i=0;i=1) @@ -673,10 +665,10 @@ void DataArrayByte::reprQuickOverview(std::ostream& stream) const stream << "DataArrayByte C++ instance at " << this << ". "; if(isAllocated()) { - std::size_t const nbOfCompo=_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -690,8 +682,8 @@ void DataArrayByte::reprQuickOverview(std::ostream& stream) const void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const char *data=begin(); - mcIdType const nbOfTuples=getNumberOfTuples(); - std::size_t const nbOfCompo=_info_on_compo.size(); + mcIdType nbOfTuples=getNumberOfTuples(); + std::size_t nbOfCompo=_info_on_compo.size(); std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; @@ -710,7 +702,7 @@ void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxN else { oss2 << (int)*data; data++; } if(i!=nbOfTuples-1) oss2 << ", "; - std::string const oss3Str(oss2.str()); + std::string oss3Str(oss2.str()); if(oss3Str.length()(&other); + const DataArrayByte *otherC=dynamic_cast(&other); if(!otherC) { reason="this is of type DataArrayByte whereas other is not a DataArrayByte instance"; return false; } return DataArrayChar::isEqualIfNotWhy(other,reason); @@ -740,7 +732,7 @@ std::vector DataArrayByte::toVectorOfBool() const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayByte::toVectorOfBool : this method can be used only if this has one component !"); - mcIdType const nbt(getNumberOfTuples()); + mcIdType nbt(getNumberOfTuples()); std::vector ret(nbt,false); const char *pt(begin()); for(mcIdType i=0;i DataArrayByte::toVectorOfBool() const return ret; } -DataArrayByteIterator::DataArrayByteIterator(DataArrayByte *da):_da(da),_pt(nullptr),_tuple_id(0),_nb_comp(0),_nb_tuple(0) +DataArrayByteIterator::DataArrayByteIterator(DataArrayByte *da):_da(da),_pt(0),_tuple_id(0),_nb_comp(0),_nb_tuple(0) { if(_da) { @@ -774,12 +766,12 @@ DataArrayByteTuple *DataArrayByteIterator::nextt() if(_tuple_id<_nb_tuple) { _tuple_id++; - auto *ret=new DataArrayByteTuple(_pt,_nb_comp); + DataArrayByteTuple *ret=new DataArrayByteTuple(_pt,_nb_comp); _pt+=_nb_comp; return ret; } else - return nullptr; + return 0; } DataArrayByteTuple::DataArrayByteTuple(char *pt, std::size_t nbOfComp):_pt(pt),_nb_of_compo(nbOfComp) @@ -848,7 +840,7 @@ DataArrayAsciiChar *DataArrayAsciiChar::New(const std::string& st) */ DataArrayAsciiChar::DataArrayAsciiChar(const std::string& st) { - std::size_t const lgth=st.length(); + std::size_t lgth=st.length(); if(lgth==0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar constructor with string ! Size of input string is null !"); alloc(1,lgth); @@ -889,17 +881,17 @@ DataArrayAsciiChar::DataArrayAsciiChar(const std::vector& vst, char if(vst.empty()) throw INTERP_KERNEL::Exception("DataArrayAsciiChar constructor with vector of strings ! Empty array !"); std::size_t nbCompo=0; - for(const auto & it : vst) - nbCompo=std::max(nbCompo,it.length()); + for(std::vector::const_iterator it=vst.begin();it!=vst.end();it++) + nbCompo=std::max(nbCompo,(*it).length()); if(nbCompo==0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar constructor with vector of strings ! All strings in not empty vector are empty !"); - std::size_t const nbTuples=vst.size(); + std::size_t nbTuples=vst.size(); alloc(nbTuples,nbCompo); char *pt=getPointer(); for(std::size_t i=0;i=1) @@ -1025,10 +1017,10 @@ void DataArrayAsciiChar::reprQuickOverview(std::ostream& stream) const stream << "DataArrayAsciiChar C++ instance at " << this << ". "; if(isAllocated()) { - std::size_t const nbOfCompo=_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -1042,8 +1034,8 @@ void DataArrayAsciiChar::reprQuickOverview(std::ostream& stream) const void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const char *data=begin(); - mcIdType const nbOfTuples=getNumberOfTuples(); - std::size_t const nbOfCompo=_info_on_compo.size(); + mcIdType nbOfTuples=getNumberOfTuples(); + std::size_t nbOfCompo=_info_on_compo.size(); std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; @@ -1070,7 +1062,7 @@ void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t oss2 << ")"; } if(i!=nbOfTuples-1) oss2 << ", "; - std::string const oss3Str(oss2.str()); + std::string oss3Str(oss2.str()); if(oss3Str.length()(&other); + const DataArrayAsciiChar *otherC=dynamic_cast(&other); if(!otherC) { reason="this is of type DataArrayAsciiChar whereas other is not a DataArrayAsciiChar instance"; return false; } return DataArrayChar::isEqualIfNotWhy(other,reason); } -DataArrayAsciiCharIterator::DataArrayAsciiCharIterator(DataArrayAsciiChar *da):_da(da),_pt(nullptr),_tuple_id(0),_nb_comp(0),_nb_tuple(0) +DataArrayAsciiCharIterator::DataArrayAsciiCharIterator(DataArrayAsciiChar *da):_da(da),_pt(0),_tuple_id(0),_nb_comp(0),_nb_tuple(0) { if(_da) { @@ -1115,12 +1107,12 @@ DataArrayAsciiCharTuple *DataArrayAsciiCharIterator::nextt() if(_tuple_id<_nb_tuple) { _tuple_id++; - auto *ret=new DataArrayAsciiCharTuple(_pt,_nb_comp); + DataArrayAsciiCharTuple *ret=new DataArrayAsciiCharTuple(_pt,_nb_comp); _pt+=_nb_comp; return ret; } else - return nullptr; + return 0; } DataArrayAsciiCharTuple::DataArrayAsciiCharTuple(char *pt, std::size_t nbOfComp):_pt(pt),_nb_of_compo(nbOfComp) diff --git a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx index 6aa588162..4b7132cd5 100644 --- a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx @@ -19,13 +19,6 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingMemArray.txx" -#include "MCType.hxx" -#include -#include -#include -#include -#include -#include using namespace MEDCoupling; @@ -47,8 +40,8 @@ DataArrayFloat *DataArrayFloat::deepCopy() const void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const { - mcIdType const nbTuples(getNumberOfTuples()); - std::size_t const nbComp(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbComp(getNumberOfComponents()); const float *data(begin()); stream.precision(7); stream << "DataArrayFloat *" << varName << "=DataArrayFloat::New();" << std::endl; @@ -70,10 +63,10 @@ void DataArrayFloat::reprQuickOverview(std::ostream& stream) const stream << "DataArrayFloat C++ instance at " << this << ". "; if(isAllocated()) { - std::size_t const nbOfCompo=_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - mcIdType const nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -87,8 +80,8 @@ void DataArrayFloat::reprQuickOverview(std::ostream& stream) const void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const float *data(begin()); - mcIdType const nbOfTuples(getNumberOfTuples()); - std::size_t const nbOfCompo=_info_on_compo.size(); + mcIdType nbOfTuples(getNumberOfTuples()); + std::size_t nbOfCompo=_info_on_compo.size(); std::ostringstream oss2; oss2 << "["; oss2.precision(7); std::string oss2Str(oss2.str()); @@ -108,7 +101,7 @@ void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t max else oss2 << *data++; if(i!=nbOfTuples-1) oss2 << ", "; - std::string const oss3Str(oss2.str()); + std::string oss3Str(oss2.str()); if(oss3Str.length() -#include -#include -#include #include #include #include #include -#include +#include using namespace MEDCoupling; @@ -64,7 +56,7 @@ bool MEDCouplingMesh::isStructured() const return getType()==CARTESIAN; } -bool MEDCouplingMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double /*prec*/, std::string& reason) const +bool MEDCouplingMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingMesh::isEqualIfNotWhy : other instance is NULL !"); @@ -156,8 +148,8 @@ bool MEDCouplingMesh::isEqual(const MEDCouplingMesh *other, double prec) const void MEDCouplingMesh::checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec, DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { - cellCor=nullptr; - nodeCor=nullptr; + cellCor=0; + nodeCor=0; if(this==other) return ; switch(levOfCheck) @@ -211,7 +203,7 @@ DataArrayIdType *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const mcIdTyp { std::vector crest; std::set p(partBg,partEnd); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); for(mcIdType i=0;i conn; @@ -232,7 +224,7 @@ DataArrayIdType *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const mcIdTyp /*! * This method checks fastly that \a this and \a other are equal. All common checks are done here. */ -void MEDCouplingMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double /*prec*/) const +void MEDCouplingMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingMesh::checkFastEquivalWith : input mesh is null !"); @@ -271,7 +263,7 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRange(mcIdType beginCellIds, mcIdType { if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1) { - auto *ret(const_cast(this)); + MEDCouplingMesh *ret(const_cast(this)); ret->incrRef(); return ret; } @@ -287,7 +279,7 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRange(mcIdType beginCellIds, mcIdType * * \sa MEDCouplingMesh::buildPartAndReduceNodes */ -MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& /*beginOut*/, mcIdType& /*endOut*/, mcIdType& /*stepOut*/, DataArrayIdType*& arr) const +MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const { MCAuto cellIds=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds); return buildPartAndReduceNodes(cellIds->begin(),cellIds->end(),arr); @@ -659,7 +651,7 @@ void MEDCouplingMesh::getCellsContainingPoints(const double *pos, mcIdType nbOfP { eltsIndex=DataArrayIdType::New(); elts=DataArrayIdType::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1); mcIdType *eltsIndexPtr(eltsIndex->getPointer()); - int const spaceDim(getSpaceDimension()); + int spaceDim(getSpaceDimension()); const double *work(pos); for(mcIdType i=0;i MEDCouplingMesh::computeMeshCenterOfMass() const MCAuto volXCenter( DataArrayDouble::Multiply(cellCenters,vol->getArray()) ); MCAuto ret(DataArrayDouble::New()); ret->alloc(1, this->getSpaceDimension()); volXCenter->accumulate( ret->getPointer() ); - double const volOfMesh(vol->accumulate(0)); + double volOfMesh(vol->accumulate(0)); ret->applyLin(1.0/volOfMesh,0.0); return ret; } @@ -760,7 +752,7 @@ void MEDCouplingMesh::writeVTKAdvanced(const std::string& fileName, const std::s void MEDCouplingMesh::SplitExtension(const std::string& fileName, std::string& baseName, std::string& extension) { - std::size_t const pos(fileName.find_last_of('.')); + std::size_t pos(fileName.find_last_of('.')); if(pos==std::string::npos) { baseName=fileName; diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index 562c0da3d..7ba57fc24 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -25,14 +25,12 @@ #include "MCType.hxx" #include "MEDCouplingTimeLabel.hxx" #include "MEDCouplingRefCountObject.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "MCAuto.hxx" -#include "NormalizedGeometricTypes" +#include "InterpKernelException.hxx" -#include -#include #include -#include #include namespace MEDCoupling @@ -58,7 +56,7 @@ namespace MEDCoupling class MEDCouplingMesh : public RefCountObject, public TimeLabel { public: - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT void setName(const std::string& name) { _name=name; } MEDCOUPLING_EXPORT std::string getName() const { return _name; } MEDCOUPLING_EXPORT void setDescription(const std::string& descr) { _description=descr; } @@ -165,7 +163,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingMesh(); MEDCOUPLING_EXPORT MEDCouplingMesh(const MEDCouplingMesh& other); MEDCOUPLING_EXPORT virtual std::string getVTKDataSetType() const = 0; - MEDCOUPLING_EXPORT ~MEDCouplingMesh() override = default; + MEDCOUPLING_EXPORT virtual ~MEDCouplingMesh() { } private: std::string _name; std::string _description; diff --git a/src/MEDCoupling/MEDCouplingMultiFields.cxx b/src/MEDCoupling/MEDCouplingMultiFields.cxx index a8d2ec80b..366f106d9 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.cxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.cxx @@ -19,20 +19,13 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingMultiFields.hxx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" +#include "MCAuto.hxx" -#include -#include #include #include -#include -#include using namespace MEDCoupling; @@ -51,9 +44,9 @@ MEDCouplingMultiFields *MEDCouplingMultiFields::deepCopy() const return new MEDCouplingMultiFields(*this); } -bool MEDCouplingMultiFields::isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const +bool MEDCouplingMultiFields::isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const { - std::size_t const sz=_fs.size(); + std::size_t sz=_fs.size(); if(sz!=other->_fs.size()) return false; for(std::size_t i=0;i_fs[i]; if(f1!=f2) { - if(f1==nullptr || f2==nullptr) + if(f1==0 || f2==0) return false; if(!_fs[i]->isEqual(other->_fs[i],meshPrec,valsPrec)) return false; } } std::vector refs1,refs2; - std::vector const ms1=getDifferentMeshes(refs1); - std::vector const ms2=other->getDifferentMeshes(refs2); + std::vector ms1=getDifferentMeshes(refs1); + std::vector ms2=other->getDifferentMeshes(refs2); if(ms1.size()!=ms2.size()) return false; if(refs1!=refs2) return false; std::vector< std::vector > refs3,refs4; - std::vector const das1=getDifferentArrays(refs3); - std::vector const das2=getDifferentArrays(refs4); + std::vector das1=getDifferentArrays(refs3); + std::vector das2=getDifferentArrays(refs4); if(das1.size()!=das2.size()) return false; if(refs3!=refs4) @@ -87,7 +80,7 @@ bool MEDCouplingMultiFields::isEqual(const MEDCouplingMultiFields *other, double std::string MEDCouplingMultiFields::getName() const { - auto it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) return (*it)->getName(); @@ -96,7 +89,7 @@ std::string MEDCouplingMultiFields::getName() const std::string MEDCouplingMultiFields::getDescription() const { - auto it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) return (*it)->getDescription(); @@ -105,7 +98,7 @@ std::string MEDCouplingMultiFields::getDescription() const std::string MEDCouplingMultiFields::getTimeUnit() const { - auto it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) return (*it)->getTimeUnit(); @@ -114,7 +107,7 @@ std::string MEDCouplingMultiFields::getTimeUnit() const double MEDCouplingMultiFields::getTimeResolution() const { - auto it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) return (*it)->getTimeTolerance(); @@ -145,9 +138,9 @@ std::string MEDCouplingMultiFields::advancedRepr() const return simpleRepr(); } -bool MEDCouplingMultiFields::isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const +bool MEDCouplingMultiFields::isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const { - std::size_t const sz=_fs.size(); + std::size_t sz=_fs.size(); if(sz!=other->_fs.size()) return false; for(std::size_t i=0;i >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) (*it)->updateTime(); @@ -205,19 +198,19 @@ std::size_t MEDCouplingMultiFields::getHeapMemorySizeWithoutChildren() const std::vector MEDCouplingMultiFields::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _f : _fs) - ret.push_back((const MEDCouplingFieldDouble *)_f); + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++) + ret.push_back((const MEDCouplingFieldDouble *)*it); return ret; } std::vector MEDCouplingMultiFields::getMeshes() const { std::vector ms; - for(const auto & _f : _fs) + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++) { - const MEDCouplingMesh *m=nullptr; - if((const MEDCouplingFieldDouble *)_f) - m=_f->getMesh(); + const MEDCouplingMesh *m=0; + if((const MEDCouplingFieldDouble *)(*it)) + m=(*it)->getMesh(); ms.push_back(const_cast(m)); } return ms; @@ -228,14 +221,14 @@ std::vector MEDCouplingMultiFields::getDifferentMeshes(std::v refs.resize(_fs.size()); std::vector ms; int id=0; - for(auto it=_fs.begin();it!=_fs.end();it++,id++) + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++) { - const MEDCouplingMesh *m=nullptr; + const MEDCouplingMesh *m=0; if((const MEDCouplingFieldDouble *)(*it)) m=(*it)->getMesh(); if(m) { - auto const it2=std::find(ms.begin(),ms.end(),m); + std::vector::iterator it2=std::find(ms.begin(),ms.end(),m); if(it2==ms.end()) { ms.push_back(const_cast(m)); @@ -253,9 +246,9 @@ std::vector MEDCouplingMultiFields::getDifferentMeshes(std::v std::vector MEDCouplingMultiFields::getArrays() const { std::vector tmp; - for(const auto & _f : _fs) + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++) { - std::vector tmp2=_f->getArrays(); + std::vector tmp2=(*it)->getArrays(); tmp.insert(tmp.end(),tmp2.begin(),tmp2.end()); } return tmp; @@ -266,7 +259,7 @@ std::vector MEDCouplingMultiFields::getDifferentArrays(std::v refs.resize(_fs.size()); int id=0; std::vector ret; - for(auto it=_fs.begin();it!=_fs.end();it++,id++) + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++) { std::vector tmp2; if((const MEDCouplingFieldDouble *)(*it)) @@ -281,7 +274,7 @@ std::vector MEDCouplingMultiFields::getDifferentArrays(std::v { if(*it2) { - auto const it3=std::find(ret.begin(),ret.end(),*it2); + std::vector::iterator it3=std::find(ret.begin(),ret.end(),*it2); if(it3==ret.end()) { ret.push_back(*it2); @@ -299,10 +292,10 @@ std::vector MEDCouplingMultiFields::getDifferentArrays(std::v void MEDCouplingMultiFields::checkConsistencyLight() const { - auto it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) { - if((const MEDCouplingFieldDouble *)(*it)==nullptr) + if((const MEDCouplingFieldDouble *)(*it)==0) throw INTERP_KERNEL::Exception("MEDCouplingMultiFields::checkConsistencyLight : There is an empty Field in array..."); (*it)->checkConsistencyLight(); } @@ -311,7 +304,7 @@ void MEDCouplingMultiFields::checkConsistencyLight() const MEDCouplingMultiFields::MEDCouplingMultiFields(const std::vector& fs):_fs(fs.size()) { int id=0; - for(auto it=fs.begin();it!=fs.end();it++,id++) + for(std::vector< MEDCouplingFieldDouble * >::const_iterator it=fs.begin();it!=fs.end();it++,id++) { if(*it) (*it)->incrRef(); @@ -328,17 +321,17 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const std::vector refs; std::vector< std::vector > refs2; std::vector ms=other.getDifferentMeshes(refs); - std::size_t const msLgh=ms.size(); + std::size_t msLgh=ms.size(); std::vector< MCAuto > ms2(msLgh); for(std::size_t i=0;ideepCopy(); std::vector das=other.getDifferentArrays(refs2); - std::size_t const dasLgth=das.size(); + std::size_t dasLgth=das.size(); std::vector< MCAuto > das2(dasLgth); for(std::size_t i=0;ideepCopy(); @@ -351,14 +344,14 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& oth tmp->decrRef(); if(refs[i]!=-1) _fs[i]->setMesh(ms2[refs[i]]); - std::size_t const nbOfArr=refs2[i].size(); + std::size_t nbOfArr=refs2[i].size(); std::vector tmp2(nbOfArr); for(std::size_t j=0;jsetArrays(tmp2); std::vector tinyInfo; @@ -371,24 +364,25 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& oth } MEDCouplingMultiFields::MEDCouplingMultiFields() -= default; +{ +} void MEDCouplingMultiFields::getTinySerializationInformation(std::vector& tinyInfo, std::vector& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const { std::vector refs; - std::vector const ms=getDifferentMeshes(refs); + std::vector ms=getDifferentMeshes(refs); nbOfDiffMeshes=(int)ms.size(); std::vector< std::vector > refs2; - std::vector const fs=getDifferentArrays(refs2); + std::vector fs=getDifferentArrays(refs2); nbOfDiffArr=(int)fs.size(); // - mcIdType const sz=ToIdType(refs.size());//==_fs.size() + mcIdType sz=ToIdType(refs.size());//==_fs.size() mcIdType sz2=0; for(mcIdType i=0;i const doubleDaInd(sz); + std::vector doubleDaInd(sz); std::vector timeDiscrInt; tinyInfo.resize(sz2+5*sz+3); tinyInfo[0]=sz; @@ -404,7 +398,7 @@ void MEDCouplingMultiFields::getTinySerializationInformation(std::vector& const std::vector& ft, const std::vector& ms, const std::vector& das) { - mcIdType const sz=tinyInfoI[0]; + mcIdType sz=tinyInfoI[0]; _fs.resize(sz); - mcIdType const sz2=tinyInfoI[1]; + mcIdType sz2=tinyInfoI[1]; // dealing with ft with no mesh set. for(mcIdType i=0;isetMesh(ms[meshId]); } @@ -441,23 +435,23 @@ void MEDCouplingMultiFields::finishUnserialization(const std::vector& for(mcIdType i=0;i tmp(sz3); for(mcIdType j=0;jsetArrays(tmp); // time discr tiny info - mcIdType const lgthI=tinyInfoI[4*sz+3+i]; - mcIdType const lgthD=tinyInfoI[3*sz+3+i]; + mcIdType lgthI=tinyInfoI[4*sz+3+i]; + mcIdType lgthD=tinyInfoI[3*sz+3+i]; // - std::vector const tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI); - std::vector const tdInfoD(tinyInfoD.begin()+offD,tinyInfoD.begin()+offD+lgthD); + std::vector tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI); + std::vector tdInfoD(tinyInfoD.begin()+offD,tinyInfoD.begin()+offD+lgthD); _fs[i]->getTimeDiscretizationUnderGround()->finishUnserialization2(tdInfoI,tdInfoD); // offI+=lgthI; diff --git a/src/MEDCoupling/MEDCouplingMultiFields.hxx b/src/MEDCoupling/MEDCouplingMultiFields.hxx index 2fb6b6d47..eff41fef8 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.hxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.hxx @@ -21,15 +21,13 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGMULTIFIELDS_HXX__ #define __PARAMEDMEM_MEDCOUPLINGMULTIFIELDS_HXX__ -#include "MEDCoupling.hxx" #include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingTimeLabel.hxx" #include "MCAuto.hxx" #include "MCType.hxx" +#include "InterpKernelException.hxx" -#include -#include #include namespace MEDCoupling @@ -62,9 +60,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual std::vector getDifferentMeshes(std::vector& refs) const; MEDCOUPLING_EXPORT virtual std::vector getArrays() const; MEDCOUPLING_EXPORT virtual std::vector getDifferentArrays(std::vector< std::vector >& refs) const; - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfo, std::vector& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const; MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& ft, const std::vector& ms, diff --git a/src/MEDCoupling/MEDCouplingNatureOfField.cxx b/src/MEDCoupling/MEDCouplingNatureOfField.cxx index 6c2405bf0..725e27267 100644 --- a/src/MEDCoupling/MEDCouplingNatureOfField.cxx +++ b/src/MEDCoupling/MEDCouplingNatureOfField.cxx @@ -19,14 +19,9 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingNatureOfField.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "InterpKernelException.hxx" #include -#include -#include #include -#include namespace MEDCoupling { @@ -48,7 +43,7 @@ namespace MEDCoupling oss << GetAllPossibilitiesStr() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::size_t const pos2=std::distance(POS_OF_NATUREOFFIELD,pos); + std::size_t pos2=std::distance(POS_OF_NATUREOFFIELD,pos); return REPR_OF_NATUREOFFIELD[pos2]; } @@ -57,7 +52,7 @@ namespace MEDCoupling const int *pos=std::find(POS_OF_NATUREOFFIELD,POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES,(int)nat); if(pos==POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES) return std::string("Unrecognized nature of field !"); - std::size_t const pos2=std::distance(POS_OF_NATUREOFFIELD,pos); + std::size_t pos2=std::distance(POS_OF_NATUREOFFIELD,pos); return std::string(REPR_OF_NATUREOFFIELD[pos2]); } diff --git a/src/MEDCoupling/MEDCouplingNatureOfField.hxx b/src/MEDCoupling/MEDCouplingNatureOfField.hxx index dba2966c4..af97d6894 100644 --- a/src/MEDCoupling/MEDCouplingNatureOfField.hxx +++ b/src/MEDCoupling/MEDCouplingNatureOfField.hxx @@ -24,7 +24,7 @@ #include "MEDCoupling.hxx" #include "MEDCouplingNatureOfFieldEnum" -#include +#include "InterpKernelException.hxx" namespace MEDCoupling { diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx index 3f05b001c..a590a5a58 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx @@ -21,7 +21,6 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGNORMALIZEDCARTESIANMESH_HXX__ #define __PARAMEDMEM_MEDCOUPLINGNORMALIZEDCARTESIANMESH_HXX__ -#include "MCIdType.hxx" #include "NormalizedUnstructuredMesh.hxx" namespace MEDCoupling @@ -35,7 +34,7 @@ class MEDCouplingNormalizedCartesianMesh public: static const int MY_SPACEDIM=SPACEDIM; static const int MY_MESHDIM=SPACEDIM; - using MyConnType = int; + typedef mcIdType MyConnType; static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; public: MEDCouplingNormalizedCartesianMesh(const MEDCoupling::MEDCouplingCMesh *mesh); diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx index 858d922e6..f5c0d45fe 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx @@ -21,10 +21,8 @@ // Author : Edward AGAPOV (eap) // -#include "MCIdType.hxx" #include "MEDCouplingNormalizedCartesianMesh.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingMemArray.hxx" template MEDCouplingNormalizedCartesianMesh::MEDCouplingNormalizedCartesianMesh(const MEDCoupling::MEDCouplingCMesh *mesh):_mesh(mesh) diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx index bee841eaa..7782da84d 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx @@ -21,9 +21,8 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_HXX__ #define __PARAMEDMEM_MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_HXX__ -#include "MCIdType.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include "NormalizedGeometricTypes" +#include "MCType.hxx" namespace MEDCoupling { diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx index 145406625..a4f57f3c6 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx @@ -22,15 +22,12 @@ #define __MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_TXX__ #include "MEDCouplingNormalizedUnstructuredMesh.hxx" - -#include "MCIdType.hxx" #include "InterpKernelAssert.hxx" + #include "MEDCouplingUMesh.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingMemArray.hxx" -#include "NormalizedGeometricTypes" -#include #include template @@ -113,8 +110,8 @@ void MEDCouplingNormalizedUnstructuredMesh::releaseTempArrays( { delete [] _conn_for_interp; delete [] _conn_index_for_interp; - _conn_for_interp=nullptr; - _conn_index_for_interp=nullptr; + _conn_for_interp=0; + _conn_index_for_interp=0; } template @@ -129,11 +126,11 @@ template void MEDCouplingNormalizedUnstructuredMesh::prepare() { IKAssert(_mesh->getSpaceDimension()==SPACEDIM); - const auto *m1(dynamic_cast(_mesh)); + const MEDCoupling::MEDCouplingUMesh *m1(dynamic_cast(_mesh)); if(m1) { - mcIdType const nbOfCell=ToIdType(m1->getNumberOfCells()); - mcIdType const initialConnSize=ToIdType(m1->getNodalConnectivity()->getNbOfElems()); + mcIdType nbOfCell=ToIdType(m1->getNumberOfCells()); + mcIdType initialConnSize=ToIdType(m1->getNodalConnectivity()->getNbOfElems()); _conn_for_interp=new mcIdType[initialConnSize-nbOfCell]; _conn_index_for_interp=new mcIdType[nbOfCell+1]; _conn_index_for_interp[0]=0; @@ -143,7 +140,7 @@ void MEDCouplingNormalizedUnstructuredMesh::prepare() mcIdType *work_conn_index_for_interp=_conn_index_for_interp; for(mcIdType i=0;i::prepare() } return ; } - const auto *m2(dynamic_cast(_mesh)); + const MEDCoupling::MEDCoupling1DGTUMesh *m2(dynamic_cast(_mesh)); if(m2) { - mcIdType const nbOfCell=ToIdType(m2->getNumberOfCells()); + mcIdType nbOfCell=ToIdType(m2->getNumberOfCells()); _conn_index_for_interp=new mcIdType[nbOfCell+1]; const mcIdType *conni(m2->getNodalConnectivityIndex()->begin()); std::copy(conni,conni+nbOfCell+1,_conn_index_for_interp); @@ -163,7 +160,7 @@ void MEDCouplingNormalizedUnstructuredMesh::prepare() std::copy(m2->getNodalConnectivity()->begin(),m2->getNodalConnectivity()->end(),_conn_for_interp); return ; } - const auto *m3(dynamic_cast(_mesh)); + const MEDCoupling::MEDCoupling1SGTUMesh *m3(dynamic_cast(_mesh)); if(m3) { mcIdType nbOfCell=ToIdType(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell()); diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.cxx b/src/MEDCoupling/MEDCouplingPartDefinition.cxx index c28d926ea..0457a1d03 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.cxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.cxx @@ -19,18 +19,9 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingPartDefinition.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingMemArray.hxx" - -#include -#include + #include #include -#include -#include using namespace MEDCoupling; @@ -63,7 +54,8 @@ PartDefinition *PartDefinition::Unserialize(std::vector& tinyInt, std: } PartDefinition::~PartDefinition() -= default; +{ +} DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayIdType *listOfIds) { @@ -77,7 +69,7 @@ bool DataArrayPartDefinition::isEqual(const PartDefinition *other, std::string& what="DataArrayPartDefinition::isEqual : other is null, this is not null !"; return false; } - const auto *otherC(dynamic_cast(other)); + const DataArrayPartDefinition *otherC(dynamic_cast(other)); if(!otherC) { what="DataArrayPartDefinition::isEqual : other is not DataArrayPartDefinition !"; @@ -92,7 +84,7 @@ bool DataArrayPartDefinition::isEqual(const PartDefinition *other, std::string& return false; } std::string what1; - bool const ret(arr0->isEqualIfNotWhy(*arr1,what1)); + bool ret(arr0->isEqualIfNotWhy(*arr1,what1)); if(!ret) { what=std::string("DataArrayPartDefinition::isEqual : arrays are not equal :\n")+what1; @@ -120,10 +112,10 @@ PartDefinition *DataArrayPartDefinition::operator+(const PartDefinition& other) const PartDefinition *otherPt(&other); if(!otherPt) throw INTERP_KERNEL::Exception("DataArrayPartDefinition::operator+ : NULL input !"); - const auto *other1(dynamic_cast(otherPt)); + const DataArrayPartDefinition *other1(dynamic_cast(otherPt)); if(other1) return add1(other1); - const auto *other2(dynamic_cast(otherPt)); + const SlicePartDefinition *other2(dynamic_cast(otherPt)); if(other2) return add2(other2); throw INTERP_KERNEL::Exception("DataArrayPartDefinition::operator+ : unrecognized type in input !"); @@ -150,7 +142,7 @@ PartDefinition *DataArrayPartDefinition::composeWith(const PartDefinition *other throw INTERP_KERNEL::Exception("DataArrayPartDefinition::composeWith : input PartDef must be not NULL !"); checkConsistencyLight(); other->checkConsistencyLight(); - const auto *spd(dynamic_cast(other)); + const SlicePartDefinition *spd(dynamic_cast(other)); if(spd) {//special case for optim mcIdType a(0),b(0),c(0); @@ -195,7 +187,7 @@ PartDefinition *DataArrayPartDefinition::tryToSimplify() const } } -void DataArrayPartDefinition::serialize(std::vector& /*tinyInt*/, std::vector< MCAuto >& bigArraysI) const +void DataArrayPartDefinition::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { bigArraysI.push_back(_arr); } @@ -204,7 +196,7 @@ DataArrayIdType *DataArrayPartDefinition::toDAI() const { checkInternalArrayOK(); const DataArrayIdType *arr(_arr); - auto *arr2(const_cast(arr)); + DataArrayIdType *arr2(const_cast(arr)); arr2->incrRef(); return arr2; } @@ -261,7 +253,8 @@ DataArrayPartDefinition *DataArrayPartDefinition::add2(const SlicePartDefinition } DataArrayPartDefinition::~DataArrayPartDefinition() -= default; +{ +} SlicePartDefinition *SlicePartDefinition::New(mcIdType start, mcIdType stop, mcIdType step) { @@ -275,13 +268,13 @@ bool SlicePartDefinition::isEqual(const PartDefinition *other, std::string& what what="SlicePartDefinition::isEqual : other is null, this is not null !"; return false; } - const auto *otherC(dynamic_cast(other)); + const SlicePartDefinition *otherC(dynamic_cast(other)); if(!otherC) { what="SlicePartDefinition::isEqual : other is not SlicePartDefinition !"; return false; } - bool const ret((_start==otherC->_start) && (_stop==otherC->_stop) && (_step==otherC->_step)); + bool ret((_start==otherC->_start) && (_stop==otherC->_stop) && (_step==otherC->_step)); if(!ret) { what="SlicePartDefinition::isEqual : values are not the same !"; @@ -310,10 +303,10 @@ PartDefinition *SlicePartDefinition::operator+(const PartDefinition& other) cons const PartDefinition *otherPt(&other); if(!otherPt) throw INTERP_KERNEL::Exception("DataArrayPartDefinition::operator+ : NULL input !"); - const auto *other1(dynamic_cast(otherPt)); + const DataArrayPartDefinition *other1(dynamic_cast(otherPt)); if(other1) return add1(other1); - const auto *other2(dynamic_cast(otherPt)); + const SlicePartDefinition *other2(dynamic_cast(otherPt)); if(other2) return add2(other2); throw INTERP_KERNEL::Exception("SlicePartDefinition::operator+ : unrecognized type in input !"); @@ -353,7 +346,7 @@ PartDefinition *SlicePartDefinition::tryToSimplify() const return ret; } -void SlicePartDefinition::serialize(std::vector& tinyInt, std::vector< MCAuto >& /*bigArraysI*/) const +void SlicePartDefinition::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { tinyInt.push_back(_start); tinyInt.push_back(_stop); @@ -369,7 +362,7 @@ std::string SlicePartDefinition::getRepr() const mcIdType SlicePartDefinition::getEffectiveStop() const { - mcIdType const nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop")); + mcIdType nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop")); return _start+nbElems*_step; } @@ -425,4 +418,5 @@ PartDefinition *SlicePartDefinition::add2(const SlicePartDefinition *other) cons } SlicePartDefinition::~SlicePartDefinition() -= default; +{ +} diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.hxx b/src/MEDCoupling/MEDCouplingPartDefinition.hxx index d3fcc7df1..4c6b56f46 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.hxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.hxx @@ -20,15 +20,9 @@ #pragma once -#include "MCType.hxx" #include "MEDCoupling.hxx" #include "MEDCouplingMemArray.hxx" #include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTimeLabel.hxx" -#include -#include -#include namespace MEDCoupling { @@ -49,7 +43,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual PartDefinition *tryToSimplify() const = 0; MEDCOUPLING_EXPORT virtual void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const = 0; protected: - ~PartDefinition() override; + virtual ~PartDefinition(); }; class SlicePartDefinition; @@ -59,26 +53,26 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayIdType *listOfIds); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("DataArrayPartDefinition"); } - MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const override; - MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCopy() const override; - MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const override; - MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const override; - MEDCOUPLING_EXPORT std::string getRepr() const override; - MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const override; - MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const override; + MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const; + MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCopy() const; + MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const; + MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const; + MEDCOUPLING_EXPORT std::string getRepr() const; + MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const; + MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; private: DataArrayPartDefinition(DataArrayIdType *listOfIds); void checkInternalArrayOK() const; static void CheckInternalArrayOK(const DataArrayIdType *listOfIds); - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; DataArrayPartDefinition *add1(const DataArrayPartDefinition *other) const; DataArrayPartDefinition *add2(const SlicePartDefinition *other) const; - ~DataArrayPartDefinition() override; + virtual ~DataArrayPartDefinition(); private: MCAuto _arr; }; @@ -88,27 +82,27 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static SlicePartDefinition *New(mcIdType start, mcIdType stop, mcIdType step); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("SlicePartDefinition"); } - MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const override; - MEDCOUPLING_EXPORT SlicePartDefinition *deepCopy() const override; - MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const override; - MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const override; - MEDCOUPLING_EXPORT std::string getRepr() const override; - MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const override; - MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const override; + MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const; + MEDCOUPLING_EXPORT SlicePartDefinition *deepCopy() const; + MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const; + MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const; + MEDCOUPLING_EXPORT std::string getRepr() const; + MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const; + MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; //specific method MEDCOUPLING_EXPORT mcIdType getEffectiveStop() const; MEDCOUPLING_EXPORT void getSlice(mcIdType& start, mcIdType& stop, mcIdType& step) const; private: SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step); - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; DataArrayPartDefinition *add1(const DataArrayPartDefinition *other) const; PartDefinition *add2(const SlicePartDefinition *other) const; - ~SlicePartDefinition() override; + virtual ~SlicePartDefinition(); private: mcIdType _start; mcIdType _stop; diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx old mode 100644 new mode 100755 index 745be33d4..2b1eac589 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -19,39 +19,28 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingPointSet.hxx" -#include "InterpKernelGeo2DPrecision.hxx" #include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MEDCoupling1GTUMesh.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMemArray.hxx" -#include "NormalizedUnstructuredMesh.hxx" #include "PlanarIntersector.txx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" #include "InterpKernelGeo2DNode.hxx" #include "DirectedBoundingBox.hxx" #include "InterpKernelAutoPtr.hxx" -#include #include -#include -#include -#include #include +#include #include -#include -#include using namespace MEDCoupling; -MEDCouplingPointSet::MEDCouplingPointSet():_coords(nullptr) +MEDCouplingPointSet::MEDCouplingPointSet():_coords(0) { } -MEDCouplingPointSet::MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy):MEDCouplingMesh(other),_coords(nullptr) +MEDCouplingPointSet::MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy):MEDCouplingMesh(other),_coords(0) { if(other._coords) _coords=other._coords->performCopyOrIncrRef(deepCpy); @@ -136,7 +125,7 @@ DataArrayDouble *MEDCouplingPointSet::getCoordinatesAndOwner() const void MEDCouplingPointSet::copyTinyStringsFrom(const MEDCouplingMesh *other) { MEDCouplingMesh::copyTinyStringsFrom(other); - const auto *otherC=dynamic_cast(other); + const MEDCouplingPointSet *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::copyTinyStringsFrom : meshes have not same type !"); if(_coords && otherC->_coords) @@ -147,7 +136,7 @@ bool MEDCouplingPointSet::isEqualIfNotWhy(const MEDCouplingMesh *other, double p { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::isEqualIfNotWhy : null mesh instance in input !"); - const auto *otherC=dynamic_cast(other); + const MEDCouplingPointSet *otherC=dynamic_cast(other); if(!otherC) { reason="mesh given in input is not castable in MEDCouplingPointSet !"; @@ -169,7 +158,7 @@ bool MEDCouplingPointSet::isEqualIfNotWhy(const MEDCouplingMesh *other, double p */ bool MEDCouplingPointSet::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingPointSet *otherC=dynamic_cast(other); if(!otherC) return false; if(!areCoordsEqualWithoutConsideringStr(*otherC,prec)) @@ -179,16 +168,16 @@ bool MEDCouplingPointSet::isEqualWithoutConsideringStr(const MEDCouplingMesh *ot bool MEDCouplingPointSet::areCoordsEqualIfNotWhy(const MEDCouplingPointSet& other, double prec, std::string& reason) const { - if(_coords==nullptr && other._coords==nullptr) + if(_coords==0 && other._coords==0) return true; - if(_coords==nullptr || other._coords==nullptr) + if(_coords==0 || other._coords==0) { reason="Only one PointSet between the two this and other has coordinate defined !"; return false; } if(_coords==other._coords) return true; - bool const ret=_coords->isEqualIfNotWhy(*other._coords,prec,reason); + bool ret=_coords->isEqualIfNotWhy(*other._coords,prec,reason); if(!ret) reason.insert(0,"Coordinates DataArray do not match : "); return ret; @@ -216,9 +205,9 @@ bool MEDCouplingPointSet::areCoordsEqual(const MEDCouplingPointSet& other, doubl */ bool MEDCouplingPointSet::areCoordsEqualWithoutConsideringStr(const MEDCouplingPointSet& other, double prec) const { - if(_coords==nullptr && other._coords==nullptr) + if(_coords==0 && other._coords==0) return true; - if(_coords==nullptr || other._coords==nullptr) + if(_coords==0 || other._coords==0) return false; if(_coords==other._coords) return true; @@ -243,11 +232,11 @@ void MEDCouplingPointSet::getCoordinatesOfNode(mcIdType nodeId, std::vector=0 && nodeIdgetConstPointer(); - std::size_t const spaceDim=getSpaceDimension(); + std::size_t spaceDim=getSpaceDimension(); coo.insert(coo.end(),cooPtr+spaceDim*nodeId,cooPtr+spaceDim*(nodeId+1)); } else @@ -276,7 +265,7 @@ DataArrayIdType *MEDCouplingPointSet::buildPermArrayForMergeNode(double precisio { DataArrayIdType *comm,*commI; findCommonNodes(precision,limitNodeId,comm,commI); - mcIdType const oldNbOfNodes=getNumberOfNodes(); + mcIdType oldNbOfNodes=getNumberOfNodes(); MCAuto ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); areNodesMerged=(oldNbOfNodes!=newNbOfNodes); comm->decrRef(); @@ -336,9 +325,9 @@ void MEDCouplingPointSet::findCommonNodes(double prec, mcIdType limitNodeId, Dat */ DataArrayIdType *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double eps) const { - DataArrayIdType *c=nullptr,*cI=nullptr; + DataArrayIdType *c=0,*cI=0; getNodeIdsNearPoints(pos,1,eps,c,cI); - MCAuto const cITmp(cI); + MCAuto cITmp(cI); return c; } @@ -373,7 +362,7 @@ void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, mcIdType nbOfP { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getNodeIdsNearPoint : no coordiantes set !"); - std::size_t const spaceDim=getSpaceDimension(); + std::size_t spaceDim=getSpaceDimension(); MCAuto points=DataArrayDouble::New(); points->useArray(pos,false,DeallocType::CPP_DEALLOC,nbOfPoints,spaceDim); _coords->computeTupleIdsNearTuples(points,eps,c,cI); @@ -442,11 +431,11 @@ void MEDCouplingPointSet::renumberNodesCenter(const mcIdType *newNodeNumbers, mc { DataArrayDouble *newCoords=DataArrayDouble::New(); std::vector div(newNbOfNodes); - std::size_t const spaceDim=getSpaceDimension(); + std::size_t spaceDim=getSpaceDimension(); newCoords->alloc(newNbOfNodes,spaceDim); newCoords->copyStringInfoFrom(*_coords); newCoords->fillWithZero(); - mcIdType const oldNbOfNodes=getNumberOfNodes(); + mcIdType oldNbOfNodes=getNumberOfNodes(); double *ptToFill=newCoords->getPointer(); const double *oldCoordsPtr=_coords->getConstPointer(); for(mcIdType i=0;igetConstPointer(); - std::size_t const nbOfValues=_coords->getNbOfElems(); + std::size_t nbOfValues=_coords->getNbOfElems(); return std::abs(*std::max_element(coords,coords+nbOfValues,MEDCouplingCompAbs())); } @@ -555,7 +544,7 @@ void MEDCouplingPointSet::recenterForMaxPrecision(double eps) */ void MEDCouplingPointSet::rotate(const double *center, const double *vector, double angle) { - std::size_t const spaceDim=getSpaceDimension(); + std::size_t spaceDim=getSpaceDimension(); if(spaceDim==3) rotate3D(center,vector,angle); else if(spaceDim==2) @@ -585,8 +574,8 @@ void MEDCouplingPointSet::translate(const double *vector) if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::translate : no coordinates set !"); double *coords=_coords->getPointer(); - mcIdType const nbNodes=getNumberOfNodes(); - std::size_t const dim=getSpaceDimension(); + mcIdType nbNodes=getNumberOfNodes(); + std::size_t dim=getSpaceDimension(); for(mcIdType i=0; igetPointer(); - mcIdType const nbNodes=getNumberOfNodes(); - std::size_t const dim=getSpaceDimension(); + mcIdType nbNodes=getNumberOfNodes(); + std::size_t dim=getSpaceDimension(); for(mcIdType i=0;i()); @@ -640,11 +629,11 @@ void MEDCouplingPointSet::scale(const double *point, double factor) */ void MEDCouplingPointSet::changeSpaceDimension(int newSpaceDim, double dftValue) { - if(getCoords()==nullptr) + if(getCoords()==0) throw INTERP_KERNEL::Exception("changeSpaceDimension must be called on an MEDCouplingPointSet instance with coordinates set !"); if(newSpaceDim<1) throw INTERP_KERNEL::Exception("changeSpaceDimension must be called a newSpaceDim >=1 !"); - int const oldSpaceDim=getSpaceDimension(); + int oldSpaceDim=getSpaceDimension(); if(newSpaceDim==oldSpaceDim) return ; DataArrayDouble *newCoords=getCoords()->changeNbOfComponents(newSpaceDim,dftValue); @@ -715,9 +704,9 @@ void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : NULL point pointer specified !"); if(!vec) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : NULL vector pointer specified !"); - mcIdType const nbOfNodes=getNumberOfNodes(); + mcIdType nbOfNodes=getNumberOfNodes(); double a=vec[0],b=vec[1],c=vec[2],d=-pt[0]*vec[0]-pt[1]*vec[1]-pt[2]*vec[2]; - double const deno=sqrt(a*a+b*b+c*c); + double deno=sqrt(a*a+b*b+c*c); if(deno::min()) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : vector pointer specified has norm equal to 0. !"); const double *work=_coords->getConstPointer(); @@ -748,18 +737,18 @@ void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, */ void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& nodes) const { - std::size_t const spaceDim=getSpaceDimension(); + std::size_t spaceDim=getSpaceDimension(); if(spaceDim!=2 && spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : Invalid spacedim to be applied on this ! Must be equal to 2 or 3 !"); if(!pt) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : NULL point pointer specified !"); if(!vec) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnLine : NULL vector pointer specified !"); - mcIdType const nbOfNodes=getNumberOfNodes(); + mcIdType nbOfNodes=getNumberOfNodes(); double den=0.; for(std::size_t i=0;i vecn=new double[spaceDim]; @@ -779,9 +768,9 @@ void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, d { for(mcIdType i=0;igetSpaceDimension(); + int spaceDim=m1->getSpaceDimension(); if(spaceDim!=m2->getSpaceDimension()) throw INTERP_KERNEL::Exception("Mismatch in SpaceDim during call of MergeNodesArray !"); return DataArrayDouble::Aggregate(m1->getCoords(),m2->getCoords()); @@ -816,9 +805,9 @@ DataArrayDouble *MEDCouplingPointSet::MergeNodesArray(const std::vector::const_iterator it=ms.begin(); std::vector coo(ms.size()); - int const spaceDim=(*it)->getSpaceDimension(); + int spaceDim=(*it)->getSpaceDimension(); coo[0]=(*it++)->getCoords(); if(!coo[0]->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::MergeNodesArray : first element in coordinates is not allocated !"); @@ -868,7 +857,7 @@ MEDCouplingPointSet *MEDCouplingPointSet::BuildInstanceFromMeshType(MEDCouplingM void MEDCouplingPointSet::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; - double const time=getTime(it,order); + double time=getTime(it,order); if(_coords) { int spaceDim=getSpaceDimension(); @@ -906,7 +895,7 @@ void MEDCouplingPointSet::getTinySerializationInformation(std::vector& t /*! * Third and final step of serialization process. */ -void MEDCouplingPointSet::serialize(DataArrayIdType *& /*a1*/, DataArrayDouble *&a2) const +void MEDCouplingPointSet::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const { if(_coords) { @@ -914,14 +903,14 @@ void MEDCouplingPointSet::serialize(DataArrayIdType *& /*a1*/, DataArrayDouble * a2->incrRef(); } else - a2=nullptr; + a2=0; } /*! * Second step of serialization process. * @param tinyInfo must be equal to the result given by getTinySerializationInformation method. */ -void MEDCouplingPointSet::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType * /*a1*/, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingPointSet::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { if(tinyInfo[2]>=0 && tinyInfo[1]>=1) { @@ -938,7 +927,7 @@ void MEDCouplingPointSet::resizeForUnserialization(const std::vector& * Second and final unserialization process. * @param tinyInfo must be equal to the result given by getTinySerializationInformation method. */ -void MEDCouplingPointSet::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType * /*a1*/, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingPointSet::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { if(tinyInfo[2]>=0 && tinyInfo[1]>=1) { @@ -971,12 +960,12 @@ void MEDCouplingPointSet::checkConsistencyLight() const */ bool MEDCouplingPointSet::intersectsBoundingBox(const double* bb1, const double* bb2, int dim, double eps) { - auto* bbtemp = new double[2*dim]; + double* bbtemp = new double[2*dim]; double deltamax=0.0; for (int i=0; i< dim; i++) { - double const delta = bb1[2*i+1]-bb1[2*i]; + double delta = bb1[2*i+1]-bb1[2*i]; if ( delta > deltamax ) { deltamax = delta ; @@ -990,7 +979,7 @@ bool MEDCouplingPointSet::intersectsBoundingBox(const double* bb1, const double* for (int idim=0; idim < dim; idim++) { - bool const intersects = (bbtemp[idim*2] deltamax ) { deltamax = delta ; @@ -1024,7 +1013,7 @@ bool MEDCouplingPointSet::intersectsBoundingBox(const INTERP_KERNEL::DirectedBou bbtemp[i*2+1]=bb2[i*2+1]+deltamax*eps; } - bool const intersects(!bb1.isDisjointWith(bbtemp)); + bool intersects(!bb1.isDisjointWith(bbtemp)); delete [] bbtemp; return intersects; } @@ -1035,7 +1024,7 @@ bool MEDCouplingPointSet::intersectsBoundingBox(const INTERP_KERNEL::DirectedBou void MEDCouplingPointSet::rotate3D(const double *center, const double *vect, double angle) { double *coords(_coords->getPointer()); - mcIdType const nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); DataArrayDouble::Rotate3DAlg(center,vect,angle,nbNodes,coords,coords); } @@ -1128,7 +1117,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(mcIdType beginCellIds, mcId * * \sa MEDCouplingUMesh::buildPartOfMySelfSlice */ -MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& /*beginOut*/, mcIdType& /*endOut*/, mcIdType& /*stepOut*/, DataArrayIdType*& arr) const +MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const { MCAuto ret(buildPartOfMySelfSlice(beginCellIds,endCellIds,stepCellIds,true)); arr=ret->zipCoordsTraducer(); @@ -1141,7 +1130,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(mcIdType begi void MEDCouplingPointSet::rotate2D(const double *center, double angle) { double *coords(_coords->getPointer()); - mcIdType const nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); DataArrayDouble::Rotate2DAlg(center,angle,nbNodes,coords,coords); } @@ -1152,7 +1141,7 @@ class DummyClsMCPS public: static const int MY_SPACEDIM=3; static const int MY_MESHDIM=2; - using MyConnType = mcIdType; + typedef mcIdType MyConnType; static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; }; @@ -1167,7 +1156,7 @@ public: void MEDCouplingPointSet::project2DCellOnXY(const mcIdType *startConn, const mcIdType *endConn, std::vector& res) const { const double *coords(_coords->getConstPointer()); - std::size_t const spaceDim(getSpaceDimension()); + std::size_t spaceDim(getSpaceDimension()); for(const mcIdType *it=startConn;it!=endConn;it++) res.insert(res.end(),coords+spaceDim*(*it),coords+spaceDim*(*it+1)); if(spaceDim==2) @@ -1175,7 +1164,7 @@ void MEDCouplingPointSet::project2DCellOnXY(const mcIdType *startConn, const mcI if(spaceDim==3) { std::vector cpy(res); - mcIdType const nbNodes=ToIdType(std::distance(startConn,endConn)); + mcIdType nbNodes=ToIdType(std::distance(startConn,endConn)); INTERP_KERNEL::PlanarIntersector::Projection(&res[0],&cpy[0],nbNodes,nbNodes,1.e-12,0./*max distance*/,-1./*min dot*/,0.,true); res.resize(2*nbNodes); for(mcIdType i=0;i& res, bool isQuad, double eps) { - INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps); + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); - std::size_t const nbOfNodes(res.size()/2); + std::size_t nbOfNodes(res.size()/2); std::vector nodes(nbOfNodes); for(std::size_t i=0;iisButterflyAbs()); + bool ret(pol->isButterflyAbs()); delete pol; return ret; } @@ -1223,7 +1212,7 @@ bool MEDCouplingPointSet::areCellsFrom2MeshEqual(const MEDCouplingPointSet *othe std::vector c1,c2; getNodeIdsOfCell(cellId,c1); other->getNodeIdsOfCell(cellId,c2); - std::size_t const sz(c1.size()); + std::size_t sz(c1.size()); if(sz!=c2.size()) return false; for(std::size_t i=0;i newCoords=MergeNodesArray(&other,this); _coords->incrRef(); MCAuto oldCoords=_coords; @@ -1274,7 +1263,7 @@ void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& setCoords(oldCoords); throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute fails : no nodes are mergeable with specified given epsilon !"); } - mcIdType const maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+otherNbOfNodes); + mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+otherNbOfNodes); const mcIdType *pt=std::find_if(da->getConstPointer()+otherNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind(std::greater(),std::placeholders::_1,maxId)); if(pt!=da->getConstPointer()+da->getNbOfElems()) { @@ -1327,9 +1316,9 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfSlice(mcIdType start, */ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const { - DataArrayIdType *cellIdsKept=nullptr; + DataArrayIdType *cellIdsKept=0; fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept); - MCAuto const cellIdsKept2(cellIdsKept); + MCAuto cellIdsKept2(cellIdsKept); return buildPartOfMySelf(cellIdsKept->begin(),cellIdsKept->end(),true); } @@ -1385,7 +1374,7 @@ DataArrayIdType *MEDCouplingPointSet::zipConnectivityTraducer(int compType, mcId bool MEDCouplingPointSet::areAllNodesFetched() const { checkFullyDefined(); - mcIdType const nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); std::vector fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); return std::find(fetchedNodes.begin(),fetchedNodes.end(),false)==fetchedNodes.end(); @@ -1426,13 +1415,13 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : input is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCouplingPointSet *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : other is not a PointSet mesh !"); MCAuto m=dynamic_cast(mergeMyselfWith(otherC)); bool areNodesMerged; mcIdType newNbOfNodes; - mcIdType const oldNbOfNodes=getNumberOfNodes(); + mcIdType oldNbOfNodes=getNumberOfNodes(); MCAuto da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes); //mergeNodes if(!areNodesMerged && oldNbOfNodes != 0) @@ -1446,10 +1435,10 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes); // da=m->zipConnectivityTraducer(cellCompPol); - mcIdType const nbCells=ToIdType(getNumberOfCells()); + mcIdType nbCells=ToIdType(getNumberOfCells()); if (nbCells != ToIdType(other->getNumberOfCells())) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); - mcIdType const dan(da->getNumberOfTuples()); + mcIdType dan(da->getNumberOfTuples()); if (dan) { MCAuto da1(DataArrayIdType::New()),da2(DataArrayIdType::New()); @@ -1461,8 +1450,8 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); } MCAuto cellCor2=da->selectByTupleIdSafeSlice(nbCells,ToIdType(da->getNbOfElems()),1); - nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?nullptr:nodeCor2.retn(); - cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?nullptr:cellCor2.retn(); + nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn(); + cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } /*! @@ -1487,36 +1476,36 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int * \ref py_mcumesh_checkDeepEquivalWith "Here is a Python example". * \endif */ -void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double /*prec*/, +void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, DataArrayIdType *&cellCor) const { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith : input is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCouplingPointSet *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith : other is not a PointSet mesh !"); if(_coords!=otherC->_coords) throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : meshes do not share the same coordinates ! Use tryToShareSameCoordinates or call checkDeepEquivalWith !"); MCAuto m=mergeMyselfWithOnSameCoords(otherC); MCAuto da=m->zipConnectivityTraducer(cellCompPol); - mcIdType const maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells()); + mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells()); const mcIdType *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind(std::greater(),std::placeholders::_1,maxId)); if(pt!=da->getConstPointer()+da->getNbOfElems()) { throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !"); } MCAuto cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1); - cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?nullptr:cellCor2.retn(); + cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const { MEDCouplingMesh::checkFastEquivalWith(other,prec); //other not null checked by the line before - const auto *otherC=dynamic_cast(other); + const MEDCouplingPointSet *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkFastEquivalWith : fails because other is not a pointset mesh !"); - mcIdType const nbOfCells=ToIdType(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(nbOfCells<1) return ; bool status=true; @@ -1550,7 +1539,7 @@ void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, dou */ DataArrayIdType *MEDCouplingPointSet::getCellIdsLyingOnNodes(const mcIdType *begin, const mcIdType *end, bool fullyIn) const { - DataArrayIdType *cellIdsKept=nullptr; + DataArrayIdType *cellIdsKept=0; fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept); cellIdsKept->setName(getName()); return cellIdsKept; diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 0b46cb922..6db127e8a 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -21,16 +21,11 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGPOINTSET_HXX__ #define __PARAMEDMEM_MEDCOUPLINGPOINTSET_HXX__ -#include "MCType.hxx" #include "MEDCoupling.hxx" #include "MEDCouplingMesh.hxx" #include "InterpKernelHashMap.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include -#include -#include #include namespace INTERP_KERNEL @@ -56,26 +51,26 @@ namespace MEDCoupling protected: MEDCOUPLING_EXPORT MEDCouplingPointSet(); MEDCOUPLING_EXPORT MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy); - MEDCOUPLING_EXPORT ~MEDCouplingPointSet() override; + MEDCOUPLING_EXPORT ~MEDCouplingPointSet(); public: - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const override; - MEDCOUPLING_EXPORT int getSpaceDimension() const override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const; + MEDCOUPLING_EXPORT int getSpaceDimension() const; MEDCOUPLING_EXPORT void setCoords(const DataArrayDouble *coords); MEDCOUPLING_EXPORT const DataArrayDouble *getCoords() const { return _coords; } MEDCOUPLING_EXPORT DataArrayDouble *getCoords() { return _coords; } - MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const override; - MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const override { return _coords; } - MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override; - MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const override; + MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; + MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const { return _coords; } + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; + MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const override; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayIdType *&cellCor) const override; + DataArrayIdType *&cellCor) const; MEDCOUPLING_EXPORT bool areCoordsEqualIfNotWhy(const MEDCouplingPointSet& other, double prec, std::string& reason) const; MEDCOUPLING_EXPORT bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const; MEDCOUPLING_EXPORT bool areCoordsEqualWithoutConsideringStr(const MEDCouplingPointSet& other, double prec) const; @@ -85,7 +80,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual DataArrayIdType *mergeNodesCenter(double precision, bool& areNodesMerged, mcIdType& newNbOfNodes); MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const = 0; MEDCOUPLING_EXPORT virtual void computeNodeIdsAlg(std::vector& nodeIdsInUse) const = 0; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const override; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const; MEDCOUPLING_EXPORT DataArrayIdType *buildPermArrayForMergeNode(double precision, mcIdType limitNodeId, bool& areNodesMerged, mcIdType& newNbOfNodes) const; MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsNearPoint(const double *pos, double eps) const; MEDCOUPLING_EXPORT void getNodeIdsNearPoints(const double *pos, mcIdType nbOfPoints, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const; @@ -93,13 +88,13 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const = 0; MEDCOUPLING_EXPORT DataArrayIdType *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex, mcIdType& newNbOfNodes) const; - MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const override; + MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const; MEDCOUPLING_EXPORT void zipCoords(); MEDCOUPLING_EXPORT double getCaracteristicDimension() const; MEDCOUPLING_EXPORT void recenterForMaxPrecision(double eps); - MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle) override; - MEDCOUPLING_EXPORT void translate(const double *vector) override; - MEDCOUPLING_EXPORT void scale(const double *point, double factor) override; + MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle); + MEDCOUPLING_EXPORT void translate(const double *vector); + MEDCOUPLING_EXPORT void scale(const double *point, double factor); MEDCOUPLING_EXPORT void changeSpaceDimension(int newSpaceDim, double dftVal=0.); MEDCOUPLING_EXPORT void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon); MEDCOUPLING_EXPORT void duplicateNodesInCoords(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd); @@ -110,11 +105,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static DataArrayDouble *MergeNodesArray(const std::vector& ms); MEDCOUPLING_EXPORT static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type); MEDCOUPLING_EXPORT static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps); - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const override; - MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const override; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const; + MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const; MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsLyingOnNodes(const mcIdType *begin, const mcIdType *end, bool fullyIn) const; MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelf(const mcIdType *start, const mcIdType *end, bool keepCoords=true) const; MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords=true) const; @@ -137,11 +132,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual bool isEmptyMesh(const std::vector& tinyInfo) const = 0; MEDCOUPLING_EXPORT virtual void invertOrientationOfAllCells() = 0; MEDCOUPLING_EXPORT virtual void checkFullyDefined() const = 0; - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, - const std::vector& littleStrings) override; + const std::vector& littleStrings); MEDCOUPLING_EXPORT virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const = 0; MEDCOUPLING_EXPORT virtual DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const = 0; MEDCOUPLING_EXPORT virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) = 0; @@ -153,7 +148,7 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, mcIdType cellId, double prec) const; protected: - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT static bool intersectsBoundingBox(const double* bb1, const double* bb2, int dim, double eps); MEDCOUPLING_EXPORT static bool intersectsBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bb1, const double* bb2, int dim, double eps); MEDCOUPLING_EXPORT void rotate2D(const double *center, double angle); diff --git a/src/MEDCoupling/MEDCouplingRefCountObject.cxx b/src/MEDCoupling/MEDCouplingRefCountObject.cxx index 94d24fbd2..a4a79aec1 100644 --- a/src/MEDCoupling/MEDCouplingRefCountObject.cxx +++ b/src/MEDCoupling/MEDCouplingRefCountObject.cxx @@ -24,19 +24,12 @@ #include "InterpKernelException.hxx" -#include -#include -#include -#include -#include #include #include -#include -#include using namespace MEDCoupling; -GlobalDict *GlobalDict::UNIQUE_INSTANCE=nullptr; +GlobalDict *GlobalDict::UNIQUE_INSTANCE=0; const char *MEDCoupling::MEDCouplingVersionStr() { @@ -50,7 +43,7 @@ int MEDCoupling::MEDCouplingVersion() void MEDCoupling::MEDCouplingVersionMajMinRel(int& maj, int& minor, int& releas) { - int const ver=MEDCOUPLING_VERSION; + int ver=MEDCOUPLING_VERSION; maj=(ver & 0xFF0000) >> 16; minor=(ver & 0xFF00) >> 8; releas=(ver & 0xFF); @@ -74,7 +67,7 @@ std::size_t MEDCoupling::MEDCouplingSizeOfIDs() bool MEDCoupling::MEDCouplingByteOrder() { unsigned int x(1); - auto *xc(reinterpret_cast(&x)); + unsigned char *xc(reinterpret_cast(&x)); return xc[0]==1; } @@ -112,7 +105,7 @@ std::string BigMemoryObject::debugHeapMemorySize() const ret = it->getHeapMemorySizeWithoutChildren(); sum+=ret; oss << it->getClassName() << " -> " << ret << std::endl; s1.insert(it); - std::vector const v2(it->getDirectChildren()); + std::vector v2(it->getDirectChildren()); for(auto it2 : v2) if(s1.find(it2)==s1.end()) s3.push_back(it2); @@ -126,7 +119,7 @@ std::string BigMemoryObject::debugHeapMemorySize() const std::size_t BigMemoryObject::getHeapMemorySize() const { - std::size_t const ret(getHeapMemorySizeWithoutChildren()); + std::size_t ret(getHeapMemorySizeWithoutChildren()); std::vector v(getDirectChildren()); std::set s1,s2(v.begin(),v.end()); return ret+GetHeapMemoryOfSet(s1,s2); @@ -145,16 +138,16 @@ std::vector BigMemoryObject::getAllTheProgeny() const { ret.insert(ret.end(),s1.begin(),s1.end()); std::vector s3; - for(auto it0 : s1) + for(std::vector::const_iterator it0=s1.begin();it0!=s1.end();it0++) { std::vector s2; - if(it0) - s2=it0->getDirectChildren(); - for(auto it1 : s2) + if(*it0) + s2=(*it0)->getDirectChildren(); + for(std::vector::const_iterator it1=s2.begin();it1!=s2.end();it1++) { - if(it1) - if(std::find(ret.begin(),ret.end(),it1)==ret.end()) - s3.push_back(it1); + if(*it1) + if(std::find(ret.begin(),ret.end(),*it1)==ret.end()) + s3.push_back(*it1); } } s1=s3; @@ -179,15 +172,15 @@ std::size_t BigMemoryObject::GetHeapMemorySizeOfObjs(const std::vector s1,s2; - for(auto obj : objs) + for(std::vector::const_iterator it0=objs.begin();it0!=objs.end();it0++) { - if(obj) - if(s1.find(obj)==s1.end()) + if(*it0) + if(s1.find(*it0)==s1.end()) { - std::vector vTmp(obj->getDirectChildren()); + std::vector vTmp((*it0)->getDirectChildren()); s2.insert(vTmp.begin(),vTmp.end()); - ret+=obj->getHeapMemorySizeWithoutChildren(); - s1.insert(obj); + ret+=(*it0)->getHeapMemorySizeWithoutChildren(); + s1.insert(*it0); } } return ret+GetHeapMemoryOfSet(s1,s2); @@ -199,16 +192,16 @@ std::size_t BigMemoryObject::GetHeapMemoryOfSet(std::set s3; - for(auto it : s2) + for(std::set::const_iterator it=s2.begin();it!=s2.end();it++) { - if(s1.find(it)==s1.end()) + if(s1.find(*it)==s1.end()) { - ret+=it->getHeapMemorySizeWithoutChildren(); - s1.insert(it); - std::vector const v2(it->getDirectChildren()); - for(auto it2 : v2) - if(s1.find(it2)==s1.end()) - s3.insert(it2); + ret+=(*it)->getHeapMemorySizeWithoutChildren(); + s1.insert(*it); + std::vector v2((*it)->getDirectChildren()); + for(std::vector::const_iterator it2=v2.begin();it2!=v2.end();it2++) + if(s1.find(*it2)==s1.end()) + s3.insert(*it2); } } s2=s3; @@ -233,7 +226,7 @@ std::string BigMemoryObject::getHeapMemorySizeStr() const std::ostringstream oss2; oss2 << std::fixed << ((double)remain)/1024.; std::string s(oss2.str()); s=s.substr(1,4); - std::size_t const pos(s.find_last_not_of('0')); + std::size_t pos(s.find_last_not_of('0')); if(pos==4) oss << s; else @@ -259,15 +252,16 @@ std::string BigMemoryObject::getHeapMemorySizeStr() const std::vector BigMemoryObject::getDirectChildren() const { std::vector ret; - std::vector const retWithNull(getDirectChildrenWithNull()); - for(auto it : retWithNull) - if(it) - ret.push_back(it); + std::vector retWithNull(getDirectChildrenWithNull()); + for(std::vector::const_iterator it=retWithNull.begin();it!=retWithNull.end();it++) + if(*it) + ret.push_back(*it); return ret; } BigMemoryObject::~BigMemoryObject() -= default; +{ +} //= @@ -275,13 +269,13 @@ RefCountObjectOnly::RefCountObjectOnly():_cnt(1) { } -RefCountObjectOnly::RefCountObjectOnly(const RefCountObjectOnly& /*other*/):_cnt(1) +RefCountObjectOnly::RefCountObjectOnly(const RefCountObjectOnly& other):_cnt(1) { } bool RefCountObjectOnly::decrRef() const { - bool const ret=((--_cnt)==0); + bool ret=((--_cnt)==0); if(ret) delete this; return ret; @@ -298,13 +292,14 @@ int RefCountObjectOnly::getRCValue() const } RefCountObjectOnly::~RefCountObjectOnly() -= default; +{ +} /*! * Do nothing here ! It is not a bug ( I hope :) ) because all subclasses that * copies using operator= should not copy the ref counter of \a other ! */ -RefCountObjectOnly& RefCountObjectOnly::operator=(const RefCountObjectOnly& /*other*/) +RefCountObjectOnly& RefCountObjectOnly::operator=(const RefCountObjectOnly& other) { return *this; } @@ -312,14 +307,16 @@ RefCountObjectOnly& RefCountObjectOnly::operator=(const RefCountObjectOnly& /*o //= RefCountObject::RefCountObject() -= default; +{ +} RefCountObject::RefCountObject(const RefCountObject& other):RefCountObjectOnly(other) { } RefCountObject::~RefCountObject() -= default; +{ +} //= @@ -332,13 +329,13 @@ GlobalDict *GlobalDict::GetInstance() bool GlobalDict::hasKey(const std::string& key) const { - auto const it(_my_map.find(key)); + std::map::const_iterator it(_my_map.find(key)); return it!=_my_map.end(); } std::string GlobalDict::value(const std::string& key) const { - auto const it(_my_map.find(key)); + std::map::const_iterator it(_my_map.find(key)); if(it==_my_map.end()) { std::ostringstream oss; @@ -351,14 +348,14 @@ std::string GlobalDict::value(const std::string& key) const std::vector GlobalDict::keys() const { std::vector ret; - for(const auto & it : _my_map) - ret.push_back(it.first); + for(std::map::const_iterator it=_my_map.begin();it!=_my_map.end();it++) + ret.push_back((*it).first); return ret; } void GlobalDict::erase(const std::string& key) { - auto const it(_my_map.find(key)); + std::map::iterator it(_my_map.find(key)); if(it==_my_map.end()) { std::ostringstream oss; @@ -375,7 +372,7 @@ void GlobalDict::clear() void GlobalDict::setKeyValue(const std::string& key, const std::string& val) { - std::map::const_iterator const it(_my_map.find(key)); + std::map::const_iterator it(_my_map.find(key)); if(it!=_my_map.end()) { std::ostringstream oss; @@ -393,9 +390,9 @@ void GlobalDict::setKeyValueForce(const std::string& key, const std::string& val std::string GlobalDict::printSelf() const { std::ostringstream oss; - for(const auto & it : _my_map) + for(std::map::const_iterator it=_my_map.begin();it!=_my_map.end();it++) { - oss << "(" << it.first << "," << it.second << ")" << std::endl; + oss << "(" << (*it).first << "," << (*it).second << ")" << std::endl; } return oss.str(); } diff --git a/src/MEDCoupling/MEDCouplingRefCountObject.hxx b/src/MEDCoupling/MEDCouplingRefCountObject.hxx index 0d6b4773f..ea5afa956 100644 --- a/src/MEDCoupling/MEDCouplingRefCountObject.hxx +++ b/src/MEDCoupling/MEDCouplingRefCountObject.hxx @@ -108,7 +108,7 @@ namespace MEDCoupling protected: RefCountObject(); RefCountObject(const RefCountObject& other); - ~RefCountObject() override; + virtual ~RefCountObject(); }; class MEDCOUPLING_EXPORT GlobalDict diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx old mode 100644 new mode 100755 index e9b24e662..1b1c3caf7 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -19,36 +19,19 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingRemapper.hxx" -#include "Interpolation.txx" -#include "MCAuto.hxx" -#include "InterpolationOptions.hxx" -#include "MCType.hxx" -#include "Interpolation1D.hxx" -#include "Interpolation2D.hxx" -#include "Interpolation3D.hxx" -#include "Interpolation3D1D.hxx" -#include "Interpolation1D0D.hxx" -#include "Interpolation2D1D.hxx" -#include "Interpolation2D3D.hxx" -#include "InterpolationCU.hxx" -#include "InterpolationCC.hxx" -#include "InterpKernelException.hxx" -#include "MEDCouplingGaussLocalization.hxx" -#include "MCIdType.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingFieldDiscretization.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingNatureOfFieldEnum" #include "MEDCouplingNormalizedUnstructuredMesh.txx" -#include "MEDCouplingNormalizedCartesianMesh.hxx" #include "MEDCouplingNormalizedCartesianMesh.txx" #include "MEDCouplingFieldDiscretizationOnNodesFE.hxx" -#include "MEDCouplingUMesh.hxx" +#include "Interpolation1D.txx" #include "Interpolation2DCurve.hxx" +#include "Interpolation2D.txx" #include "Interpolation3D.txx" #include "Interpolation3DSurf.hxx" #include "Interpolation2D1D.txx" @@ -57,18 +40,10 @@ #include "Interpolation1D0D.txx" #include "InterpolationCU.txx" #include "InterpolationCC.txx" -#include -#include -#include -#include -#include "MEDCouplingPointSet.hxx" -#include -#include -#include using namespace MEDCoupling; -MEDCouplingRemapper::MEDCouplingRemapper():_src_ft(nullptr),_target_ft(nullptr),_interp_matrix_pol(IK_ONLY_PREFERED),_nature_of_deno(NoNature),_time_deno_update(0) +MEDCouplingRemapper::MEDCouplingRemapper():_src_ft(0),_target_ft(0),_interp_matrix_pol(IK_ONLY_PREFERED),_nature_of_deno(NoNature),_time_deno_update(0) { } @@ -154,7 +129,7 @@ void MEDCouplingRemapper::setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, int MEDCouplingRemapper::prepareInterpKernelOnly() { - int const meshInterpType=((int)_src_ft->getMesh()->getType()*16)+(int)_target_ft->getMesh()->getType(); + int meshInterpType=((int)_src_ft->getMesh()->getType()*16)+(int)_target_ft->getMesh()->getType(); // *** Remember: // typedef enum // { @@ -429,8 +404,8 @@ void MEDCouplingRemapper::setInterpolationMatrixPolicy(int newInterpMatPol) int MEDCouplingRemapper::prepareInterpKernelOnlyUU() { - const auto *src_mesh=static_cast(_src_ft->getMesh()); - const auto *target_mesh=static_cast(_target_ft->getMesh()); + const MEDCouplingPointSet *src_mesh=static_cast(_src_ft->getMesh()); + const MEDCouplingPointSet *target_mesh=static_cast(_target_ft->getMesh()); std::string srcMeth,trgMeth; std::string method(checkAndGiveInterpolationMethodStr(srcMeth,trgMeth)); const int srcMeshDim=src_mesh->getMeshDimension(); @@ -557,7 +532,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); nbCols=ToIdType(matrixTmp.size()); - INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType const duplicateFaces=interpolation.retrieveDuplicateFaces(); + INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); if(!duplicateFaces.empty()) { std::ostringstream oss; oss << "An unexpected situation happened ! For the following 1D Cells are part of edges shared by 2D cells :\n"; @@ -598,7 +573,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D1D interpolation(*this); nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); - INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType const duplicateFaces=interpolation.retrieveDuplicateFaces(); + INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); if(!duplicateFaces.empty()) { std::ostringstream oss; oss << "An unexpected situation happened ! For the following 1D Cells are part of edges shared by 2D cells :\n"; @@ -621,7 +596,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D3D interpolation(*this); nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method); - INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces=interpolation.retrieveDuplicateFaces(); + INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); if(!duplicateFaces.empty()) { std::ostringstream oss; oss << "An unexpected situation happened ! For the following 2D Cells are part of edges shared by 3D cells :\n"; @@ -653,7 +628,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); nbCols=ToIdType(matrixTmp.size()); - INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces=interpolation.retrieveDuplicateFaces(); + INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); if(!duplicateFaces.empty()) { std::ostringstream oss; oss << "An unexpected situation happened ! For the following 2D Cells are part of edges shared by 3D cells :\n"; @@ -722,8 +697,8 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE() { std::string srcMeth,trgMeth; std::string methC=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth); - const auto *src_mesh=static_cast(_src_ft->getMesh()); - const auto *target_mesh=static_cast(_target_ft->getMesh()); + const MEDCouplingMappedExtrudedMesh *src_mesh=static_cast(_src_ft->getMesh()); + const MEDCouplingMappedExtrudedMesh *target_mesh=static_cast(_target_ft->getMesh()); if(methC!="P0P0") throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyEE : Only P0P0 method implemented for Extruded/Extruded meshes !"); MCAuto src2D(src_mesh->getMesh2D()->clone(false)); src2D->changeSpaceDimension(2,0.); @@ -755,13 +730,13 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE() int MEDCouplingRemapper::prepareInterpKernelOnlyUC() { std::string srcMeth,trgMeth; - std::string const methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth); + std::string methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth); if(methodCpp!="P0P0") throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC: only P0P0 interpolation supported for the moment !"); if(InterpolationOptions::getIntersectionType()!=INTERP_KERNEL::Triangulation) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC: only 'Triangulation' intersection type supported!"); - const auto *src_mesh=static_cast(_src_ft->getMesh()); - const auto *target_mesh=static_cast(_target_ft->getMesh()); + const MEDCouplingUMesh *src_mesh=static_cast(_src_ft->getMesh()); + const MEDCouplingCMesh *target_mesh=static_cast(_target_ft->getMesh()); const int srcMeshDim=src_mesh->getMeshDimension(); const int srcSpceDim=src_mesh->getSpaceDimension(); const int trgMeshDim=target_mesh->getMeshDimension(); @@ -807,13 +782,13 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUC() int MEDCouplingRemapper::prepareInterpKernelOnlyCU() { std::string srcMeth,trgMeth; - std::string const methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth); + std::string methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth); if(methodCpp!="P0P0") throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCU : only P0P0 interpolation supported for the moment !"); if(InterpolationOptions::getIntersectionType()!=INTERP_KERNEL::Triangulation) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCU: only 'Triangulation' intersection type supported!"); - const auto *src_mesh=static_cast(_src_ft->getMesh()); - const auto *target_mesh=static_cast(_target_ft->getMesh()); + const MEDCouplingCMesh *src_mesh=static_cast(_src_ft->getMesh()); + const MEDCouplingUMesh *target_mesh=static_cast(_target_ft->getMesh()); const int srcMeshDim=src_mesh->getMeshDimension(); const int trgMeshDim=target_mesh->getMeshDimension(); const int trgSpceDim=target_mesh->getSpaceDimension(); @@ -857,13 +832,13 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyCU() int MEDCouplingRemapper::prepareInterpKernelOnlyCC() { std::string srcMeth,trgMeth; - std::string const methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth); + std::string methodCpp=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth); if(methodCpp!="P0P0") throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCC : only P0P0 interpolation supported for the moment !"); if(InterpolationOptions::getIntersectionType()!=INTERP_KERNEL::Triangulation) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyCC: only 'Triangulation' intersection type supported!"); - const auto *src_mesh=static_cast(_src_ft->getMesh()); - const auto *target_mesh=static_cast(_target_ft->getMesh()); + const MEDCouplingCMesh *src_mesh=static_cast(_src_ft->getMesh()); + const MEDCouplingCMesh *target_mesh=static_cast(_target_ft->getMesh()); const int srcMeshDim=src_mesh->getMeshDimension(); const int trgMeshDim=target_mesh->getMeshDimension(); if(trgMeshDim!=srcMeshDim) @@ -931,7 +906,7 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() for(const mcIdType *trgId=ids0->begin();trgId!=ids0->end();trgId++) { const double *ptTrg=trgLocPtr+trgSpaceDim*(*trgId); - mcIdType const srcCellId=elts[eltsIndex[*trgId]]; + mcIdType srcCellId=elts[eltsIndex[*trgId]]; double dist=std::numeric_limits::max(); mcIdType srcEntry=-1; for(mcIdType srcId=srcOffsetArrPtr[srcCellId];srcIdgetNumberOfTuples()!=trgNbOfGaussPts) { - MCAuto const orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0); + MCAuto orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0); MCAuto orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end()); MCAuto srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg); const mcIdType *srcIdPerTrgPtr=srcIdPerTrg->begin(); @@ -968,8 +943,8 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyFEFE() THROW_IK_EXCEPTION("prepareNotInterpKernelOnlyFEFE : only spacedim 3 supported for target !") if(_src_ft->getMesh()->getSpaceDimension() != 3) THROW_IK_EXCEPTION("prepareNotInterpKernelOnlyFEFE : only spacedim 3 supported for source !") - const auto *srcUMesh( dynamic_cast(_src_ft->getMesh()) ); - const auto *trgMesh( dynamic_cast(_target_ft->getMesh()) ); + const MEDCouplingUMesh *srcUMesh( dynamic_cast(_src_ft->getMesh()) ); + const MEDCouplingPointSet *trgMesh( dynamic_cast(_target_ft->getMesh()) ); if( !srcUMesh ) THROW_IK_EXCEPTION("prepareNotInterpKernelOnlyFEFE : only 3D UMesh supported as source !"); if( !trgMesh ) @@ -1117,8 +1092,8 @@ void MEDCouplingRemapper::BuildFieldTemplatesFrom(const MEDCouplingMesh *srcMesh void MEDCouplingRemapper::releaseData(bool matrixSuppression) { - _src_ft=nullptr; - _target_ft=nullptr; + _src_ft=0; + _target_ft=0; if(matrixSuppression) { _matrix.clear(); @@ -1266,7 +1241,7 @@ void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCou void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNbOfCompo, bool isDftVal, double dftValue, double *resPointer) { int idx=0; - auto *tmp=new double[inputNbOfCompo]; + double *tmp=new double[inputNbOfCompo]; for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) { if((*iter1).empty()) @@ -1291,7 +1266,7 @@ void MEDCouplingRemapper::computeReverseProduct(const double *inputPointer, int { std::vector isReached(_deno_reverse_multiply.size(),false); mcIdType idx=0; - auto *tmp=new double[inputNbOfCompo]; + double *tmp=new double[inputNbOfCompo]; std::fill(resPointer,resPointer+inputNbOfCompo*_deno_reverse_multiply.size(),0.); for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) { @@ -1368,12 +1343,12 @@ void MEDCouplingRemapper::ComputeColSumAndRowSum(const std::vector >& m1D, const std::vector< std::map >& m2D, - const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType /*nbOf1DCellsSrc*/, + const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType nbOf1DCellsSrc, const mcIdType *corrCellIdTrg) { mcIdType nbOf2DCellsTrg=ToIdType(m2D.size()); mcIdType nbOf1DCellsTrg=ToIdType(m1D.size()); - mcIdType const nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg; + mcIdType nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg; _matrix.resize(nbOf3DCellsTrg); mcIdType id2R=0; for(std::vector< std::map >::const_iterator iter2R=m2D.begin();iter2R!=m2D.end();iter2R++,id2R++) @@ -1466,7 +1441,7 @@ int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrixAbs(double maxValAbs) */ int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrix(double scaleFactor) { - double const maxVal=getMaxValueInCrudeMatrix(); + double maxVal=getMaxValueInCrudeMatrix(); if(maxVal==0.) return -1; return nullifiedTinyCoeffInCrudeMatrixAbs(scaleFactor*maxVal); diff --git a/src/MEDCoupling/MEDCouplingRemapper.hxx b/src/MEDCoupling/MEDCouplingRemapper.hxx index 564c387a9..9110cf9d2 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.hxx +++ b/src/MEDCoupling/MEDCouplingRemapper.hxx @@ -22,15 +22,15 @@ #define __PARAMEDMEM_MEDCOUPLINGREMAPPER_HXX__ #include "MEDCoupling.hxx" -#include "MEDCouplingNatureOfFieldEnum" #include "MEDCouplingTimeLabel.hxx" #include "InterpolationOptions.hxx" +#include "MEDCouplingNatureOfField.hxx" #include "MCType.hxx" #include "MCAuto.hxx" +#include "InterpKernelException.hxx" #include -#include #include namespace MEDCoupling @@ -54,7 +54,7 @@ namespace MEDCoupling { public: MEDCOUPLINGREMAPPER_EXPORT MEDCouplingRemapper(); - MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper() override; + MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper(); MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method); MEDCOUPLINGREMAPPER_EXPORT int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target); MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector >& m); @@ -94,7 +94,7 @@ namespace MEDCoupling static int CheckInterpolationMethodManageableByNotOnlyInterpKernel(const std::string& method); // bool isInterpKernelOnlyOrNotOnly() const; - void updateTime() const override; + void updateTime() const; void checkPrepare() const; void synchronizeSizeOfSideMatricesAfterMatrixComputation(mcIdType nbOfColsInMatrix); std::string checkAndGiveInterpolationMethodStr(std::string& srcMeth, std::string& trgMeth) const; diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx old mode 100644 new mode 100755 index 1636c5b21..1ed26a036 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx @@ -18,21 +18,10 @@ // #include "MEDCouplingSkyLineArray.hxx" -#include "MCType.hxx" -#include "NormalizedGeometricTypes" -#include "MCIdType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" - -#include -#include -#include -#include -#include + #include #include #include -#include using namespace MEDCoupling; @@ -42,7 +31,8 @@ MEDCouplingSkyLineArray::MEDCouplingSkyLineArray(): } MEDCouplingSkyLineArray::~MEDCouplingSkyLineArray() -= default; +{ +} MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New() { @@ -52,7 +42,7 @@ MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New() MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector& index, const std::vector& value ) { - auto * ret = new MEDCouplingSkyLineArray(); + MEDCouplingSkyLineArray * ret = new MEDCouplingSkyLineArray(); ret->_index->reserve( index.size() ); ret->_index->insertAtTheEnd( index.begin(), index.end() ); ret->_values->reserve( value.size() ); @@ -62,14 +52,14 @@ MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vectorset(index, value); return ret; } MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const MEDCouplingSkyLineArray & other ) { - auto* ret = new MEDCouplingSkyLineArray(); + MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray(); ret->_super_index = other._super_index; ret->_index = other._index; ret->_values = other._values; @@ -84,7 +74,7 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons { using namespace std; - auto* ret = new MEDCouplingSkyLineArray(); + MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray(); const mcIdType * cP(c->begin()), * cIP(cI->begin()); mcIdType prev = -1; @@ -92,7 +82,7 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: misformatted connectivity (wrong nb of tuples)!"); for (mcIdType i=0; i < cI->getNbOfElems(); i++) { - mcIdType const j = cIP[i]; + mcIdType j = cIP[i]; if (cIP[i] < prev) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: misformatted connectivity (indices not monotonic ascending)!"); prev = cIP[i]; @@ -116,7 +106,7 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons while (w2 != cP+end) { copy(w, w2, work); - mcIdType const d = ToIdType(distance(w, w2)); + mcIdType d = ToIdType(distance(w, w2)); cnt += d; work +=d; idx.push_back(cnt); cnt2++; w = w2+1; // skip the -1 @@ -153,14 +143,14 @@ void MEDCouplingSkyLineArray::convertToPolyhedronConn( MCAuto& cI->alloc(_super_index->getNbOfElems(),1); // same number of super packs as number of cells mcIdType * cIVecP(cI->getPointer()); MCAuto dsi = _index->deltaShiftIndex(); - mcIdType const sz = dsi->accumulate((std::size_t)0) + ToIdType(dsi->getNbOfElems()); // think about it: one slot for the type, -1 at the end of each face of the cell + mcIdType sz = dsi->accumulate((std::size_t)0) + ToIdType(dsi->getNbOfElems()); // think about it: one slot for the type, -1 at the end of each face of the cell c->alloc(sz, 1); mcIdType * cVecP(c->getPointer()); for ( mcIdType i=0; i < _super_index->getNbOfElems()-1; i++) { cIVecP[i]= cnt; - mcIdType const endId = siP[i+1]; + mcIdType endId = siP[i+1]; cVecP[cnt++] = INTERP_KERNEL::NORM_POLYHED; for (mcIdType j=siP[i]; j < endId; j++) { @@ -230,7 +220,7 @@ MEDCouplingSkyLineArray *MEDCouplingSkyLineArray::deepCopy() const MCAuto ret(MEDCouplingSkyLineArray::New(indexCpy,valuesCpy)); if(_super_index.isNotNull()) { - MCAuto const superIndexCpy(this->_super_index->deepCopy()); + MCAuto superIndexCpy(this->_super_index->deepCopy()); ret->_super_index = superIndexCpy; } return ret.retn(); @@ -269,7 +259,7 @@ void MEDCouplingSkyLineArray::validIndex(const std::string& func, mcIdType idx) void MEDCouplingSkyLineArray::validSuperIndexAndIndex(const std::string& func, mcIdType superIndex, mcIdType index) const { validSuperIndex(func, superIndex); - mcIdType const idx = _super_index->begin()[superIndex] + index; + mcIdType idx = _super_index->begin()[superIndex] + index; if(idx < 0 || idx >= _index->getNbOfElems()) { std::ostringstream oss; @@ -343,7 +333,7 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const */ void MEDCouplingSkyLineArray::thresholdPerPack(mcIdType threshold, MCAuto& left, MCAuto& right) const { - mcIdType const nbPacks(this->getNumberOf()); + mcIdType nbPacks(this->getNumberOf()); MCAuto lCount(DataArrayIdType::New()); lCount->alloc(nbPacks,1); lCount->fillWithZero(); mcIdType *lCountPtr(lCount->getPointerSilent()); const mcIdType *valuesPtr(this->_values->begin()),*indexPtr(this->_index->begin()); @@ -370,7 +360,7 @@ MEDCouplingSkyLineArray *MEDCouplingSkyLineArray::groupPacks(const DataArrayIdTy indexedPacks->checkAllocated(); if( indexedPacks->getNumberOfComponents() != 1 ) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::groupPacks : number of components must be 1 !"); - std::size_t const nbTuples(indexedPacks->getNumberOfTuples()); + std::size_t nbTuples(indexedPacks->getNumberOfTuples()); if( nbTuples == 0 ) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::groupPacks : number of tuples must be > 0 !"); const DataArrayIdType *index(this->getIndexArray()); @@ -381,20 +371,20 @@ MEDCouplingSkyLineArray *MEDCouplingSkyLineArray::groupPacks(const DataArrayIdTy MEDCouplingSkyLineArray *MEDCouplingSkyLineArray::uniqueNotSortedByPack() const { - mcIdType const nbPacks(this->getNumberOf()); + mcIdType nbPacks(this->getNumberOf()); MCAuto retIndex(DataArrayIdType::New()); retIndex->alloc(nbPacks+1,1); const mcIdType *valuesPtr(this->_values->begin()),*indexPtr(this->_index->begin()); mcIdType *retIndexPtr(retIndex->getPointer()); *retIndexPtr = 0; for(mcIdType i = 0 ; i < nbPacks ; ++i, ++retIndexPtr) { - std::set const s(valuesPtr+indexPtr[i],valuesPtr+indexPtr[i+1]); + std::set s(valuesPtr+indexPtr[i],valuesPtr+indexPtr[i+1]); retIndexPtr[1] = retIndexPtr[0] + ToIdType(s.size()); } MCAuto retValues(DataArrayIdType::New()); retValues->alloc(retIndex->back(),1); mcIdType *retValuesPtr(retValues->getPointer()); for(mcIdType i = 0 ; i < nbPacks ; ++i) { - std::set const s(valuesPtr+indexPtr[i],valuesPtr+indexPtr[i+1]); + std::set s(valuesPtr+indexPtr[i],valuesPtr+indexPtr[i+1]); retValuesPtr = std::copy(s.begin(),s.end(),retValuesPtr); } MCAuto ret(MEDCouplingSkyLineArray::New(retIndex,retValues)); @@ -416,7 +406,7 @@ MEDCouplingSkyLineArray *MEDCouplingSkyLineArray::AggregatePacks(const std::vect { if(sk) { - mcIdType const curNbPacks(sk->getNumberOf()); + mcIdType curNbPacks(sk->getNumberOf()); if(sksEff.empty()) nbOfPacks = curNbPacks; if(nbOfPacks != curNbPacks) @@ -442,7 +432,7 @@ MEDCouplingSkyLineArray *MEDCouplingSkyLineArray::AggregatePacks(const std::vect std::for_each(indicesIn.begin(),indicesIn.end(),[packId,&nbOfAggPacks](const mcIdType *elt) { nbOfAggPacks+=elt[packId+1]-elt[packId]; }); indexPtr[1] = indexPtr[0] + nbOfAggPacks; } - mcIdType const nbOfTuplesOut(index->back()); + mcIdType nbOfTuplesOut(index->back()); MCAuto values(DataArrayIdType::New()); values->alloc(nbOfTuplesOut,1); mcIdType *valuesPtr(values->getPointer()); // let's go to populate values array @@ -467,7 +457,7 @@ void MEDCouplingSkyLineArray::getSimplePackSafe(const mcIdType absolutePackId, s if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems()) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!"); const mcIdType * iP(_index->begin()), *vP(_values->begin()); - mcIdType const sz = iP[absolutePackId+1]-iP[absolutePackId]; + mcIdType sz = iP[absolutePackId+1]-iP[absolutePackId]; pack.resize(sz); std::copy(vP+iP[absolutePackId], vP+iP[absolutePackId+1],pack.begin()); } @@ -502,14 +492,14 @@ void MEDCouplingSkyLineArray::findPackIds(const std::vector & superPac checkSuperIndex("findPackIds"); - mcIdType const packSz = ToIdType(std::distance(packBg, packEnd)); + mcIdType packSz = ToIdType(std::distance(packBg, packEnd)); if (!packSz) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::findPackIds: void pack!"); out.resize(superPackIndices.size()); mcIdType i = 0; const mcIdType * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin()); - for(auto it=superPackIndices.begin(); it!=superPackIndices.end(); ++it, i++) + for(vector::const_iterator it=superPackIndices.begin(); it!=superPackIndices.end(); ++it, i++) { out[i] = -1; const mcIdType sPackIdx = *it; @@ -544,7 +534,7 @@ void MEDCouplingSkyLineArray::deletePack(const mcIdType superIdx, const mcIdType _values->reAlloc(_values->getNbOfElems() - (end-start)); // _index - mcIdType const nt = _index->getNbOfElems(); + mcIdType nt = _index->getNbOfElems(); std::copy(iP+siP[superIdx]+idx+1, iP+nt, iP+siP[superIdx]+idx); _index->reAlloc(nt-1); iP = _index->getPointer(); // better not forget this ... for(mcIdType ii = siP[superIdx]+idx; ii < nt-1; ii++) @@ -563,8 +553,8 @@ void MEDCouplingSkyLineArray::deleteSimplePack(const mcIdType idx) const mcIdType start(iP[idx]), end(iP[idx+1]); // _values - mcIdType const initValSz=_values->getNbOfElems(); - mcIdType const deltaSz( start-end ); // should be negative + mcIdType initValSz=_values->getNbOfElems(); + mcIdType deltaSz( start-end ); // should be negative mcIdType *vP(_values->getPointer()); if (deltaSz < 0) { @@ -574,7 +564,7 @@ void MEDCouplingSkyLineArray::deleteSimplePack(const mcIdType idx) else throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePack"); // _index - mcIdType const nt=_index->getNbOfElems(); + mcIdType nt=_index->getNbOfElems(); std::copy(iP+idx+1, iP+nt, iP+idx); for(mcIdType ii = idx; ii < nt-1; ii++) iP[ii] += deltaSz; @@ -586,8 +576,8 @@ void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayIdType* idx, con if (idx->empty()) return; - for (long const id : *idx) - validIndex("deleteSimplePacks", id); + for (const mcIdType * id = idx->begin(); id != idx->end(); id++) + validIndex("deleteSimplePacks", *id); if (idx->getNbOfElems() != ToIdType( packs.size())) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePacks: size of list of pack is incorrect"); @@ -596,23 +586,23 @@ void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayIdType* idx, con std::deque< std::set > valuesByIdx; mcIdType* vP(_values->getPointer()); mcIdType* iP(_index->getPointer()); - mcIdType const nt = _index->getNbOfElems(); + mcIdType nt = _index->getNbOfElems(); for (mcIdType ii = 0; ii < nt-1; ii++) valuesByIdx.push_back(std::set(vP+iP[ii], vP+iP[ii+1])); // modify the deque> according to idx and packs mcIdType ii(0); - for (long const id : *idx) + for (const mcIdType *id = idx->begin(); id != idx->end(); id++) { - valuesByIdx[id] = std::set(packs[ii]->begin(), packs[ii]->end()); + valuesByIdx[*id] = std::set(packs[ii]->begin(), packs[ii]->end()); ii++; } // copy back the deque> into _index, _values mcIdType valSz(0); *iP = 0; - for (const auto & values : valuesByIdx) + for (std::deque< std::set >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++) { - valSz += ToIdType(values.size()); + valSz += ToIdType((*values).size()); *(++iP) = valSz; } _values->reAlloc(valSz); @@ -627,45 +617,45 @@ void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayIdType* idx, con void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayIdType* idx) { - for (long const id : *idx) - validIndex("deleteSimplePacks", id); + for (auto id = idx->begin(); id != idx->end(); id++) + validIndex("deleteSimplePacks", *id); - std::set const packsToDelete(idx->begin(), idx->end()); + std::set packsToDelete(idx->begin(), idx->end()); // _values mcIdType* iP(_index->getPointer()); - mcIdType const initValSz = _values->getNbOfElems(); + mcIdType initValSz = _values->getNbOfElems(); mcIdType *vP(_values->getPointer()); mcIdType end_prec(0),start_prec(0); - for(long const ii : packsToDelete) + for(std::set::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++) { - mcIdType const start = iP[ii]; + mcIdType start = iP[*ii]; if (end_prec != 0) std::copy(vP+end_prec, vP+start, vP+start_prec); start_prec += start-end_prec; - end_prec = iP[ii+1]; + end_prec = iP[*ii+1]; } if (end_prec != 0) std::copy(vP+end_prec, vP+initValSz, vP+start_prec); _values->reAlloc(initValSz-(end_prec-start_prec)); // _index - mcIdType const nt = _index->getNbOfElems(); + mcIdType nt = _index->getNbOfElems(); mcIdType offset = 0; end_prec = 0; start_prec = 0; mcIdType deleted = 0; - for(long const ii : packsToDelete) + for(std::set::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++) { if (end_prec != 0) { - std::copy(iP+end_prec, iP+ii, iP+start_prec); - for (mcIdType i=start_prec; igetNbOfElems()); + mcIdType nt = ToIdType(_index->getNbOfElems()); _index->reAlloc(nt+1); iP = _index->getPointer(); copy(iP+siP[superIdx+1]+1, iP+nt, iP+siP[superIdx+1]+2); iP[siP[superIdx+1]+1] = iP[siP[superIdx+1]] + sz; @@ -720,12 +710,12 @@ void MEDCouplingSkyLineArray::replaceSimplePack(const mcIdType idx, const mcIdTy validIndex("replaceSimplePack", idx); mcIdType * iP(_index->getPointer()); - mcIdType const newSz = ToIdType(std::distance(packBg, packEnd)); + mcIdType newSz = ToIdType(std::distance(packBg, packEnd)); const mcIdType start = iP[idx], end = iP[idx+1]; // _values - mcIdType const initValSz = _values->getNbOfElems(); - mcIdType const deltaSz = newSz-(end-start); // can be negative + mcIdType initValSz = _values->getNbOfElems(); + mcIdType deltaSz = newSz-(end-start); // can be negative if (deltaSz) { if (deltaSz > 0) @@ -754,12 +744,12 @@ void MEDCouplingSkyLineArray::replacePack(const mcIdType superIdx, const mcIdTyp validSuperIndexAndIndex("replacePack", superIdx, idx); mcIdType * siP(_super_index->getPointer()), *iP(_index->getPointer()); - mcIdType const newSz = ToIdType(std::distance(packBg, packEnd)); + mcIdType newSz = ToIdType(std::distance(packBg, packEnd)); const mcIdType start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1]; // _values - mcIdType const initValSz = _values->getNbOfElems(); - mcIdType const deltaSz = newSz-(end-start); // can be negative + mcIdType initValSz = _values->getNbOfElems(); + mcIdType deltaSz = newSz-(end-start); // can be negative if (deltaSz) { if (deltaSz > 0) diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx index fc682fec8..3beab9cb0 100644 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx @@ -19,17 +19,11 @@ #pragma once -#include "MCType.hxx" -#include "MCIdType.hxx" #include "MEDCoupling.hxx" #include "MEDCouplingMemArray.hxx" #include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" +#include "NormalizedGeometricTypes" -#include -#include -#include -#include #include #include @@ -84,16 +78,16 @@ namespace MEDCoupling static std::vector< MCAuto > RetrieveVecOfSkyLineArrayGen(const std::vector< MCAuto >& vecSka, std::function fct) { - std::size_t const sz(vecSka.size()); + std::size_t sz(vecSka.size()); std::vector< MCAuto > ret(sz); - auto it(ret.begin()); + std::vector< MCAuto >::iterator it(ret.begin()); std::for_each(vecSka.begin(),vecSka.end(),[&it,fct](MCAuto elt) { *it++ = MCAuto::TakeRef(fct(elt)); } ); return ret; } std::string getClassName() const override { return std::string("MEDCouplingSkyLineArray"); } - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; void set( DataArrayIdType* index, DataArrayIdType* value ); void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value ); @@ -139,7 +133,7 @@ namespace MEDCoupling private: MEDCouplingSkyLineArray(); - ~MEDCouplingSkyLineArray() override; + ~MEDCouplingSkyLineArray(); void checkSuperIndex(const std::string& func) const; void validSuperIndex(const std::string& func, mcIdType superIndex) const; diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx old mode 100644 new mode 100755 index 4b1031fcf..d52a07ae6 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -19,42 +19,27 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingStructuredMesh.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" -#include "CellModel.hxx" -#include "MCAuto.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCoupling1GTUMesh.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingUMesh.hxx" -#include "MEDCouplingIMesh.hxx" -#include "NormalizedGeometricTypes" - -#include -#include -#include -#include -#include +#include "MEDCouplingIMesh.hxx"//tony to throw when optimization will be performed in AssignPartOfFieldOfDoubleUsing + #include -#include -#include -#include -#include -#include using namespace MEDCoupling; MEDCouplingStructuredMesh::MEDCouplingStructuredMesh() -= default; +{ +} -MEDCouplingStructuredMesh::MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool /*deepCpy*/):MEDCouplingMesh(other) +MEDCouplingStructuredMesh::MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy):MEDCouplingMesh(other) { } MEDCouplingStructuredMesh::~MEDCouplingStructuredMesh() -= default; +{ +} std::size_t MEDCouplingStructuredMesh::getHeapMemorySizeWithoutChildren() const { @@ -71,7 +56,7 @@ bool MEDCouplingStructuredMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, do return MEDCouplingMesh::isEqualIfNotWhy(other,prec,reason); } -INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(mcIdType /*cellId*/) const +INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(mcIdType cellId) const { return GetGeoTypeGivenMeshDimension(getMeshDimension()); } @@ -102,7 +87,7 @@ std::set MEDCouplingStructuredMesh::getAllGeo mcIdType MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - mcIdType const ret(getNumberOfCells()); + mcIdType ret(getNumberOfCells()); if(type==getTypeOfCell(0)) return ret; const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0))); @@ -125,7 +110,7 @@ DataArrayIdType *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::Nor DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const { - std::size_t const nbCells=getNumberOfCells(); + std::size_t nbCells=getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); ret->alloc(nbCells,1); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)); @@ -135,7 +120,7 @@ DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const { - std::size_t const nbCells=getNumberOfCells(); + std::size_t nbCells=getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); ret->alloc(nbCells,1); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)); @@ -157,7 +142,7 @@ DataArrayIdType *MEDCouplingStructuredMesh::computeEffectiveNbOfNodesPerCell() c void MEDCouplingStructuredMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - int const meshDim=getMeshDimension(); + int meshDim=getMeshDimension(); mcIdType tmpCell[3],tmpNode[3]; getSplitCellValues(tmpCell); getSplitNodeValues(tmpNode); @@ -214,7 +199,7 @@ int MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct() const int spd1(0),pos(0); for(std::vector::const_iterator it=nodeStr.begin();it!=nodeStr.end();it++,pos++) { - mcIdType const elt(*it); + mcIdType elt(*it); if(elt<=0) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct : At pos #" << pos << " value of node grid structure is " << *it << " ! must be >=1 !"; @@ -227,14 +212,14 @@ int MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct() const void MEDCouplingStructuredMesh::getSplitCellValues(mcIdType *res) const { - std::vector const strct(getCellGridStructure()); + std::vector strct(getCellGridStructure()); std::vector ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct)); std::copy(ret.begin(),ret.end(),res); } void MEDCouplingStructuredMesh::getSplitNodeValues(mcIdType *res) const { - std::vector const strct(getNodeGridStructure()); + std::vector strct(getNodeGridStructure()); std::vector ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct)); std::copy(ret.begin(),ret.end(),res); } @@ -244,7 +229,7 @@ void MEDCouplingStructuredMesh::getSplitNodeValues(mcIdType *res) const */ mcIdType MEDCouplingStructuredMesh::getNumberOfCellsOfSubLevelMesh() const { - std::vector const cgs(getCellGridStructure()); + std::vector cgs(getCellGridStructure()); return GetNumberOfCellsOfSubLevelMesh(cgs,getMeshDimension()); } @@ -269,7 +254,7 @@ std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const */ DataArrayIdType *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !"); if(code[0]!=ToIdType(getTypeOfCell(0))) @@ -280,7 +265,7 @@ DataArrayIdType *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const if(code[2]==-1) { if(code[1]==nbOfCells) - return nullptr; + return 0; else { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : mismatch between the number of cells in this (" << nbOfCells << ") and the number of non profile (" << code[1] << ") !"; @@ -331,8 +316,8 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayIdType *profi throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile is NULL or not allocated !"); if(profile->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile should have exactly one component !"); - mcIdType const nbTuples(profile->getNumberOfTuples()); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbTuples(profile->getNumberOfTuples()); + mcIdType nbOfCells=getNumberOfCells(); code.resize(3); idsInPflPerType.resize(1); code[0]=ToIdType(getTypeOfCell(0)); code[1]=nbOfCells; idsInPflPerType.resize(1); @@ -386,7 +371,7 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const */ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTSubLevelMesh() const { - int const meshDim(getMeshDimension()); + int meshDim(getMeshDimension()); if(meshDim<1 || meshDim>3) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTSubLevelMesh : meshdim must be in [2,3] !"); MCAuto coords(getCoordinatesAndOwner()); @@ -432,14 +417,14 @@ MEDCouplingMesh *MEDCouplingStructuredMesh::buildPart(const mcIdType *start, con MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const { - std::vector const cgs(getCellGridStructure()); + std::vector cgs(getCellGridStructure()); std::vector< std::pair > cellPartFormat,nodePartFormat; if(IsPartStructured(start,end,cgs,cellPartFormat)) { MCAuto ret(buildStructuredSubPart(cellPartFormat)); nodePartFormat=cellPartFormat; - for(auto & it : nodePartFormat) - it.second++; + for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) + (*it).second++; MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); MCAuto tmp2(DataArrayIdType::New()); tmp2->alloc(getNumberOfNodes(),1); tmp2->fillWithValue(-1); @@ -455,7 +440,7 @@ MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const mcIdTy } } -DataArrayIdType *MEDCouplingStructuredMesh::simplexize(int /*policy*/) +DataArrayIdType *MEDCouplingStructuredMesh::simplexize(int policy) { throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::simplexize : not available for Cartesian mesh !"); } @@ -474,7 +459,7 @@ MEDCouplingFieldDouble *MEDCouplingStructuredMesh::buildOrthogonalField() const throw INTERP_KERNEL::Exception("Expected a MEDCouplingStructuredMesh with meshDim == 2 !"); MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME)); MCAuto array(DataArrayDouble::New()); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); array->alloc(nbOfCells,3); double *vals(array->getPointer()); for(mcIdType i=0;i const ngs(getNodeGridStructure()); - int const dim(getSpaceDimension()); + std::vector ngs(getNodeGridStructure()); + int dim(getSpaceDimension()); switch(dim) { case 1: @@ -503,7 +488,7 @@ void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayIdType *rev void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) { - mcIdType const nbNodes(ngs[0]); + mcIdType nbNodes(ngs[0]); revNodalIndx->alloc(nbNodes+1,1); if(nbNodes==0) { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; } @@ -524,7 +509,7 @@ void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) { mcIdType nbNodesX(ngs[0]),nbNodesY(ngs[1]); - mcIdType const nbNodes(nbNodesX*nbNodesY); + mcIdType nbNodes(nbNodesX*nbNodesY); if(nbNodesX==0 || nbNodesY==0) { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; } if(nbNodesX==1 || nbNodesY==1) @@ -554,7 +539,7 @@ void MEDCouplingStructuredMesh::GetReverseNodalConnectivity2(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) { mcIdType nbNodesX(ngs[0]),nbNodesY(ngs[1]),nbNodesZ(ngs[2]); - mcIdType const nbNodes(nbNodesX*nbNodesY*nbNodesZ); + mcIdType nbNodes(nbNodesX*nbNodesY*nbNodesZ); if(nbNodesX==0 || nbNodesY==0 || nbNodesZ==0) { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; } if(nbNodesX==1 || nbNodesY==1 || nbNodesZ==1) @@ -596,15 +581,15 @@ void MEDCouplingStructuredMesh::GetReverseNodalConnectivity3(const std::vector= 0 !"); - std::size_t const dim(st.size()); + std::size_t dim(st.size()); MCAuto ret(DataArrayIdType::New()); switch(dim) { @@ -701,7 +686,7 @@ DataArrayIdType *MEDCouplingStructuredMesh::ComputeCornersGhost(const std::vecto mcIdType *ptr(ret->getPointer()); for(mcIdType i=0;i= 0 !"); for(mcIdType i=0;i= 0 !"); ret->alloc(8*ghostLev,1); mcIdType *ptr(ret->getPointer()); - mcIdType const zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev)); + mcIdType zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev)); for(mcIdType i=0;i >::const_iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,ii++) { mcIdType a((*it).first),b((*it).second); if(a<0 || b<0 || b-a<0) @@ -785,11 +770,11 @@ mcIdType MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(const std::vect { mcIdType ret(1); bool isFetched(false); - for(long const i : st) + for(std::size_t i=0;i >& partCompactFormat, int& axisId, mcIdType& sizeOfRange) { - mcIdType const dim(ToIdType(partCompactFormat.size())); + mcIdType dim(ToIdType(partCompactFormat.size())); mcIdType ret(-1); for(int i=0;i const dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat)); + std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat)); mcIdType i(0); - for(auto it=partCompactFormat.begin();it!=partCompactFormat.end();it++,i++) + for(std::vector< std::pair >::iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,i++) { if(st[i] > MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(const std::vector& st, const std::vector& crit) { - std::size_t const dim(st.size()); + std::size_t dim(st.size()); std::vector< std::vector > ret(dim); switch(dim) { case 1: { - mcIdType const nx(st[0]); + mcIdType nx(st[0]); ret[0].resize(nx); std::vector& retX(ret[0]); for(mcIdType i=0;i > MEDCouplingStructuredMesh::ComputeSignature mcIdType cnt(0); for(mcIdType k=0;k > MEDCouplingStructuredMesh::ComputeSignature mcIdType cnt(0),offy(j*nx); for(mcIdType k=0;k > MEDCouplingStructuredMesh::ComputeSignature mcIdType cnt(0),offz(k*nx*ny); for(mcIdType j=0;j > MEDCouplingStructuredMesh::ComputeSignature DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const mcIdType *nodeStBg) { - mcIdType const nbOfCells=*nodeStBg-1; + mcIdType nbOfCells=*nodeStBg-1; MCAuto conn(DataArrayIdType::New()); conn->alloc(2*nbOfCells,1); mcIdType *cp=conn->getPointer(); @@ -1021,7 +1006,7 @@ DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const mc for(mcIdType j=0;j3 || spaceDim<1) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ZipNodeStructure : spaceDim must in [1,2,3] !"); zipNodeSt[0]=0; zipNodeSt[1]=0; zipNodeSt[2]=0; int zippedI(0); for(std::size_t i=0;i ngs(2); mcIdType n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1; - mcIdType const off0(nodeStBg[0]); + mcIdType off0(nodeStBg[0]); MCAuto conn(DataArrayIdType::New()); conn->alloc(2*GetNumberOfCellsOfSubLevelMesh(ngs,2)); mcIdType *cp(conn->getPointer()); @@ -1230,7 +1215,7 @@ mcIdType MEDCouplingStructuredMesh::getCellIdFromPos(mcIdType i, mcIdType j, mcI { mcIdType tmp[3]={i,j,k}; mcIdType tmp2[3]; - mcIdType const meshDim(getMeshDimension()); + mcIdType meshDim(getMeshDimension()); getSplitCellValues(tmp2); std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies()); return std::accumulate(tmp,tmp+meshDim,0); @@ -1247,7 +1232,7 @@ mcIdType MEDCouplingStructuredMesh::getNodeIdFromPos(mcIdType i, mcIdType j, mcI { mcIdType tmp[3]={i,j,k}; mcIdType tmp2[3]; - mcIdType const spaceDim(getSpaceDimension()); + mcIdType spaceDim(getSpaceDimension()); getSplitNodeValues(tmp2); std::transform(tmp,tmp+spaceDim,tmp2,tmp,std::multiplies()); return std::accumulate(tmp,tmp+spaceDim,0); @@ -1262,7 +1247,7 @@ mcIdType MEDCouplingStructuredMesh::getNumberOfCells() const std::size_t ii(0); for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++,ii++) { - mcIdType const elt(*it); + mcIdType elt(*it); if(elt<=0) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getNumberOfCells : at pos #" << ii << " the number of nodes in nodeStructure is " << *it << " ! Must be > 0 !"; @@ -1279,10 +1264,10 @@ mcIdType MEDCouplingStructuredMesh::getNumberOfCells() const mcIdType MEDCouplingStructuredMesh::getNumberOfNodes() const { - std::vector const ngs(getNodeGridStructure()); + std::vector ngs(getNodeGridStructure()); mcIdType ret(1); - for(long const ng : ngs) - ret*=ng; + for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++) + ret*=*it; return ret; } @@ -1295,10 +1280,10 @@ mcIdType MEDCouplingStructuredMesh::getNumberOfNodes() const */ std::vector MEDCouplingStructuredMesh::getLocationFromCellId(mcIdType cellId) const { - int const meshDim(getMeshDimension()); + int meshDim(getMeshDimension()); std::vector ret(meshDim); std::vector struc(getCellGridStructure()); - mcIdType const nbCells(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); + mcIdType nbCells(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); if(cellId<0 || cellId>=nbCells) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getLocationFromCellId : Input cell id (" << cellId << ") is invalid ! Should be in [0," << nbCells << ") !"; @@ -1318,10 +1303,10 @@ std::vector MEDCouplingStructuredMesh::getLocationFromCellId(mcIdType */ std::vector MEDCouplingStructuredMesh::getLocationFromNodeId(mcIdType nodeId) const { - int const spaceDim(getSpaceDimension()); + int spaceDim(getSpaceDimension()); std::vector ret(spaceDim); std::vector struc(getNodeGridStructure()); - mcIdType const nbNodes(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); + mcIdType nbNodes(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); if(nodeId<0 || nodeId>=nbNodes) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getLocationFromNodeId : Input node id (" << nodeId << ") is invalid ! Should be in [0," << nbNodes << ") !"; @@ -1337,7 +1322,7 @@ void MEDCouplingStructuredMesh::GetPosFromId(mcIdType eltId, int meshDim, const mcIdType work(eltId); for(int i=meshDim-1;i>=0;i--) { - mcIdType const pos=work/split[i]; + mcIdType pos=work/split[i]; work=work%split[i]; res[i]=pos; } @@ -1358,7 +1343,7 @@ double MEDCouplingStructuredMesh::computeSquareness() const std::vector cgs(getCellGridStructure()); if(cgs.empty()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::computeSquareness : empty mesh !"); - std::size_t const dim(cgs.size()); + std::size_t dim(cgs.size()); if(dim==1) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::computeSquareness : A segment cannot be square !"); if(dim<4) @@ -1380,7 +1365,7 @@ double MEDCouplingStructuredMesh::computeSquareness() const */ std::vector MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::vector& strct) { - std::size_t const spaceDim(strct.size()); + std::size_t spaceDim(strct.size()); std::vector res(spaceDim); for(std::size_t l=0;l MEDCouplingStructuredMesh::GetSplitVectFromStruct(const st */ bool MEDCouplingStructuredMesh::IsPartStructured(const mcIdType *startIds, const mcIdType *stopIds, const std::vector& st, std::vector< std::pair >& partCompactFormat) { - int const dim((int)st.size()); + int dim((int)st.size()); partCompactFormat.resize(dim); if(dim<1 || dim>3) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::isPartStructured : input structure must be of dimension in [1,2,3] !"); std::vector tmp2(dim),tmp(dim),tmp3(dim),tmp4(dim); tmp2[0]=1; for(int i=1;i MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(co */ std::vector< std::pair > MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(const std::vector& dims) { - std::size_t const sz(dims.size()); + std::size_t sz(dims.size()); std::vector< std::pair > ret(sz); for(std::size_t i=0;i > MEDCouplingStructuredMesh::GetCompac */ std::vector< std::pair > MEDCouplingStructuredMesh::IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2) { - std::size_t const sz(r1.size()); + std::size_t sz(r1.size()); if(sz!=r2.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::IntersectRanges : the two ranges must have the same dimension !"); std::vector< std::pair > ret(sz); @@ -1570,7 +1555,7 @@ std::vector< std::pair > MEDCouplingStructuredMesh::Intersect */ bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2) { - std::size_t const sz(r1.size()); + std::size_t sz(r1.size()); if(sz!=r2.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::AreRangesIntersect : the two ranges must have the same dimension !"); for(std::size_t i=0;i& st, { for(mcIdType i=0;i& st, { for(mcIdType j=0;j dims(GetDimensionsFromCompactFrmt(partCompactFormat)); - mcIdType const nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); + mcIdType nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); fieldOut.resize(nbOfTuplesOfOutField); mcIdType it(0); switch(st.size()) @@ -1676,10 +1661,10 @@ void MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(const std::vectorgetNumberOfTuples()!=DeduceNumberOfGivenStructure(st)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !"); std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); - mcIdType const nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); - std::size_t const nbComp(fieldOfDbl->getNumberOfComponents()); + mcIdType nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); + std::size_t nbComp(fieldOfDbl->getNumberOfComponents()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp); ret->copyStringInfoFrom(*fieldOfDbl); double *ptRet(ret->getPointer()); @@ -1739,10 +1724,10 @@ DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std:: { for(mcIdType i=0;i& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other) {//to be optimized - std::vector const facts(st.size(),1); + std::vector facts(st.size(),1); MEDCouplingIMesh::CondenseFineToCoarse(st,other,partCompactFormat,facts,fieldOfDbl); } @@ -1795,7 +1780,7 @@ void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector */ void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigInAbs, std::vector< std::pair >& partOfBigRelativeToBig, bool check) { - std::size_t const dim(bigInAbs.size()); + std::size_t dim(bigInAbs.size()); if(dim!=partOfBigInAbs.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt : The size of parts (dimension) must be the same !"); partOfBigRelativeToBig.resize(dim); @@ -1834,7 +1819,7 @@ void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std */ void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigRelativeToBig, std::vector< std::pair >& partOfBigInAbs, bool check) { - std::size_t const dim(bigInAbs.size()); + std::size_t dim(bigInAbs.size()); if(dim!=partOfBigRelativeToBig.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt : The size of parts (dimension) must be the same !"); partOfBigInAbs.resize(dim); @@ -1873,7 +1858,7 @@ void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std:: */ std::vector< std::pair > MEDCouplingStructuredMesh::TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& translation) { - std::size_t const sz(part.size()); + std::size_t sz(part.size()); if(translation.size()!=sz) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::TranslateCompactFrmt : the sizes are not equal !"); std::vector< std::pair > ret(sz); @@ -1890,7 +1875,7 @@ std::vector< std::pair > MEDCouplingStructuredMesh::Translate */ std::vector MEDCouplingStructuredMesh::FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& goingTo) { - std::size_t const sz(startingFrom.size()); + std::size_t sz(startingFrom.size()); if(goingTo.size()!=sz) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindTranslationFrom : the sizes are not equal !"); std::vector< mcIdType > ret(sz); @@ -1934,10 +1919,10 @@ DataArrayIdType *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vect { for(mcIdType i=0;i& st, throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : invalid input range 3 !"); dims[i]=part[i].second-part[i].first; } - mcIdType const nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)); - std::size_t const nbCompo(da->getNumberOfComponents()); + mcIdType nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)); + std::size_t nbCompo(da->getNumberOfComponents()); if(da->getNumberOfTuples()!=nbOfTuplesExp) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::MultiplyPartOf : invalid nb of tuples ! Expected " << nbOfTuplesExp << " having " << da->getNumberOfTuples() << " !"; @@ -2007,13 +1992,13 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, { for(mcIdType i=0;i(),std::placeholders::_1,factor)); } } @@ -2024,10 +2009,10 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, { for(mcIdType j=0;j(),std::placeholders::_1,factor)); } } @@ -2037,7 +2022,7 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, { for(mcIdType k=0;k(),std::placeholders::_1,factor)); } break; @@ -2081,7 +2066,7 @@ void MEDCouplingStructuredMesh::PutInGhostFormat(mcIdType ghostSize, const std:: { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : ghost size must be >= 0 !"); - std::size_t const dim(part.size()); + std::size_t dim(part.size()); if(st.size()!=dim) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : the dimension of input vectors must be the same !"); for(std::size_t i=0;i= 0 !"); - std::size_t const sz(partBeforeFact.size()); + std::size_t sz(partBeforeFact.size()); for(std::size_t i=0;i -#include -#include -#include -#include namespace MEDCoupling { @@ -38,39 +31,39 @@ namespace MEDCoupling class MEDCouplingStructuredMesh : public MEDCouplingMesh { public: - MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const override; - MEDCOUPLING_EXPORT std::set getAllGeoTypes() const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override; + MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const; MEDCOUPLING_EXPORT std::vector getLocationFromCellId(mcIdType cellId) const; MEDCOUPLING_EXPORT std::vector getLocationFromNodeId(mcIdType nodeId) const; MEDCOUPLING_EXPORT static void GetPosFromId(mcIdType eltId, int meshDim, const mcIdType *split, mcIdType *res); MEDCOUPLING_EXPORT static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension( int meshDim); - MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other) override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; //tools - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const override; - MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const override; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const override; + MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; + MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTUnstructured() const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const override; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const override; - MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override; - MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const; + MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy); + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; + MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const; //some useful methods MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const; MEDCOUPLING_EXPORT mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const; MEDCOUPLING_EXPORT mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const; - MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const override; - MEDCOUPLING_EXPORT int getMeshDimension() const override; + MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const; + MEDCOUPLING_EXPORT int getMeshDimension() const; MEDCOUPLING_EXPORT mcIdType getNumberOfCellsOfSubLevelMesh() const; MEDCOUPLING_EXPORT int getSpaceDimensionOnNodeStruct() const; MEDCOUPLING_EXPORT virtual void getNodeGridStructure(mcIdType *res) const = 0; @@ -125,7 +118,7 @@ namespace MEDCoupling protected: MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(); MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy); - MEDCOUPLING_EXPORT ~MEDCouplingStructuredMesh() override; + MEDCOUPLING_EXPORT ~MEDCouplingStructuredMesh(); }; } diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index ebeefe662..d01ce7784 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -19,22 +19,13 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingTimeDiscretization.txx" - #include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTimeLabel.hxx" -#include -#include +#include #include #include -#include -#include -#include using namespace MEDCoupling; @@ -81,9 +72,9 @@ bool MEDCouplingTimeDiscretization::areCompatibleForMeld(const MEDCouplingTimeDi { if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16) return false; - if(_array==nullptr && other->_array==nullptr) + if(_array==0 && other->_array==0) return true; - if(_array==nullptr || other->_array==nullptr) + if(_array==0 || other->_array==0) return false; if(_array->getNumberOfTuples()!=other->_array->getNumberOfTuples()) return false; @@ -123,23 +114,23 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFr MCAuto arr; if(arrSrc) arr=arrSrc->performCopyOrIncrRef(deepCopy); - ret->setArray(arr,nullptr); + ret->setArray(arr,0); return ret; } bool MEDCouplingTimeDiscretization::isBefore(const MEDCouplingTimeDiscretization *other) const { int iteration,order; - double const time1=getEndTime(iteration,order)-_time_tolerance; - double const time2=other->getStartTime(iteration,order)+other->getTimeTolerance(); + double time1=getEndTime(iteration,order)-_time_tolerance; + double time2=other->getStartTime(iteration,order)+other->getTimeTolerance(); return time1<=time2; } bool MEDCouplingTimeDiscretization::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const { int iteration,order; - double const time1=getEndTime(iteration,order)+_time_tolerance; - double const time2=other->getStartTime(iteration,order)-other->getTimeTolerance(); + double time1=getEndTime(iteration,order)+_time_tolerance; + double time2=other->getStartTime(iteration,order)-other->getTimeTolerance(); return time1 arrays3(arrays.size()); for(std::size_t j=0;jsetArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -177,7 +168,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::doublyContractedPr std::vector arrays3(arrays.size()); for(std::size_t j=0;jsetArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -196,7 +187,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::determinant() cons arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -215,7 +206,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenValues() cons arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -234,7 +225,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenVectors() con arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -253,7 +244,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::inverse() const arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -272,7 +263,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::trace() const arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -291,7 +282,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::deviator() const arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -310,7 +301,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::magnitude() const arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -329,7 +320,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::negate() const arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -348,7 +339,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::maxPerTuple() cons arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -367,7 +358,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedCompon arrays3[j]=arrays2[j]; MEDCouplingTimeDiscretization *ret(MEDCouplingTimeDiscretization::New(getEnum())); ret->setTimeUnit(getTimeUnit()); - ret->setArrays(arrays3,nullptr); + ret->setArrays(arrays3,0); return ret; } @@ -380,9 +371,9 @@ void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeD throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : number of arrays mismatch !"); for(std::size_t i=0;isetSelectedComponents(arrays2[i],compoIds); - else if(arrays1[i]!=nullptr || arrays2[i]!=nullptr) + else if(arrays1[i]!=0 || arrays2[i]!=0) throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : some time array in correspondence are not defined symmetrically !"); } } @@ -400,17 +391,17 @@ void MEDCouplingTimeDiscretization::changeNbOfComponents(std::size_t newNbOfComp std::vector arrays3(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - for(auto & array : arrays) + for(std::size_t j=0;jsortPerTuple(asc); + if(arrays[j]) + arrays[j]->sortPerTuple(asc); } } @@ -436,7 +427,7 @@ void MEDCouplingTimeDiscretization::setUniformValue(mcIdType nbOfTuple, int nbOf std::vector arrays3(arrays.size()); for(std::size_t j=0;j arrays3(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - for(auto & array : arrays) + for(std::size_t j=0;japplyLin(a,b,compoId); + if(arrays[j]) + arrays[j]->applyLin(a,b,compoId); } } @@ -484,10 +475,10 @@ void MEDCouplingTimeDiscretization::applyLin(double a, double b) { std::vector arrays; getArrays(arrays); - for(auto & array : arrays) + for(std::size_t j=0;japplyLin(a,b); + if(arrays[j]) + arrays[j]->applyLin(a,b); } } @@ -504,7 +495,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate f std::vector arrays3(arrays.size()); for(std::size_t j=0;japplyFunc(nbOfComp,func); else - arrays2[j]=nullptr; + arrays2[j]=0; } std::vector arrays3(arrays.size()); for(std::size_t j=0;j arrays3(arrays.size()); for(std::size_t j=0;j& varsOrder, const std::string& func) @@ -554,7 +545,7 @@ void MEDCouplingTimeDiscretization::applyFuncNamedCompo(int nbOfComp, const std: std::vector arrays3(arrays.size()); for(std::size_t j=0;j arrays3(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - for(auto & array : arrays) + for(std::size_t j=0;japplyFuncFast32(func); + if(arrays[j]) + arrays[j]->applyFuncFast32(func); } } @@ -588,10 +579,10 @@ void MEDCouplingTimeDiscretization::applyFuncFast64(const std::string& func) { std::vector arrays; getArrays(arrays); - for(auto & array : arrays) + for(std::size_t j=0;japplyFuncFast64(func); + if(arrays[j]) + arrays[j]->applyFuncFast64(func); } } @@ -605,7 +596,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, std::vector arrays3(arrays.size()); for(std::size_t j=0;j arrays3(arrays.size()); for(std::size_t j=0;j arrays3(arrays.size()); for(std::size_t j=0;j& varsOrder, const std::string& func) @@ -644,7 +635,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalyticNamedCompo(const DataArrayDo std::vector arrays3(arrays.size()); for(std::size_t j=0;j(other)); + const MEDCouplingTimeDiscretizationInt32 *otherC(dynamic_cast(other)); if(!otherC) throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt32 !"); if(!MEDCouplingTimeDiscretizationTemplate::areStrictlyCompatible(other,reason)) @@ -748,7 +739,7 @@ bool MEDCouplingTimeDiscretizationInt32::isEqualWithoutConsideringStr(const MEDC { if(prec!=0) throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt32::isEqualWithoutConsideringStr : only precision 0 is supported !"); - const auto *otherC(dynamic_cast(other)); + const MEDCouplingTimeDiscretizationInt32 *otherC(dynamic_cast(other)); if(!otherC) throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationInt !"); std::string tmp; @@ -793,7 +784,7 @@ bool MEDCouplingTimeDiscretizationInt64::isEqualIfNotWhy(const MEDCouplingTimeDi reason="Time discretization is NULL."; return false; } - const auto *otherC(dynamic_cast(other)); + const MEDCouplingTimeDiscretizationInt64 *otherC(dynamic_cast(other)); if(!otherC) throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt64 !"); if(!MEDCouplingTimeDiscretizationTemplate::areStrictlyCompatible(other,reason)) @@ -809,7 +800,7 @@ bool MEDCouplingTimeDiscretizationInt64::isEqualWithoutConsideringStr(const MEDC { if(prec!=0) throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt64::isEqualWithoutConsideringStr : only precision 0 is supported !"); - const auto *otherC(dynamic_cast(other)); + const MEDCouplingTimeDiscretizationInt64 *otherC(dynamic_cast(other)); if(!otherC) throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationInt !"); std::string tmp; @@ -852,7 +843,7 @@ bool MEDCouplingTimeDiscretizationFloat::isEqualIfNotWhy(const MEDCouplingTimeDi reason="Time discretization is NULL."; return false; } - const auto *otherC(dynamic_cast(other)); + const MEDCouplingTimeDiscretizationFloat *otherC(dynamic_cast(other)); if(!otherC) throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationFloat !"); if(!MEDCouplingTimeDiscretizationTemplate::areStrictlyCompatible(other,reason)) @@ -868,7 +859,7 @@ bool MEDCouplingTimeDiscretizationFloat::isEqualWithoutConsideringStr(const MEDC { if(prec!=0) throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationFloat::isEqualWithoutConsideringStr : only precision 0 is supported !"); - const auto *otherC(dynamic_cast(other)); + const MEDCouplingTimeDiscretizationFloat *otherC(dynamic_cast(other)); if(!otherC) throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationFloat !"); std::string tmp; @@ -885,7 +876,8 @@ bool MEDCouplingTimeDiscretizationFloat::isEqualWithoutConsideringStr(const MEDC //////////////////////// MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel() -= default; +{ +} MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCopy):MEDCouplingTimeDiscretization(other,deepCopy) { @@ -899,7 +891,7 @@ std::string MEDCouplingNoTimeLabel::getStringRepr() const return stream.str(); } -void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh * /*mesh*/) +void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh *mesh) { throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::synchronizeTimeWith : impossible to synchronize time with a MEDCouplingMesh because the time discretization is incompatible with it !"); } @@ -908,16 +900,16 @@ bool MEDCouplingNoTimeLabel::areCompatible(const MEDCouplingTimeDiscretizationTe { if(!MEDCouplingTimeDiscretization::areCompatible(other)) return false; - const auto *otherC(dynamic_cast(other)); - return otherC!=nullptr; + const MEDCouplingNoTimeLabel *otherC(dynamic_cast(other)); + return otherC!=0; } bool MEDCouplingNoTimeLabel::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const { if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason)) return false; - const auto *otherC(dynamic_cast(other)); - bool const ret=otherC!=nullptr; + const MEDCouplingNoTimeLabel *otherC(dynamic_cast(other)); + bool ret=otherC!=0; if(!ret) reason.insert(0,"time discretization of this is NO_TIME, other has a different time discretization."); return ret; @@ -927,29 +919,29 @@ bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForMul(const MEDCouplingTimeDi { if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other)) return false; - const auto *otherC(dynamic_cast(other)); - return otherC!=nullptr; + const MEDCouplingNoTimeLabel *otherC(dynamic_cast(other)); + return otherC!=0; } bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const { if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other)) return false; - const auto *otherC(dynamic_cast(other)); - return otherC!=nullptr; + const MEDCouplingNoTimeLabel *otherC(dynamic_cast(other)); + return otherC!=0; } bool MEDCouplingNoTimeLabel::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const { if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other)) return false; - const auto *otherC(dynamic_cast(other)); - return otherC!=nullptr; + const MEDCouplingNoTimeLabel *otherC(dynamic_cast(other)); + return otherC!=0; } bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const { - const auto *otherC(dynamic_cast(other)); + const MEDCouplingNoTimeLabel *otherC(dynamic_cast(other)); if(!otherC) { reason="This has time discretization NO_TIME, other not."; @@ -960,7 +952,7 @@ bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretization bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const { - const auto *otherC(dynamic_cast(other)); + const MEDCouplingNoTimeLabel *otherC(dynamic_cast(other)); if(!otherC) return false; return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec); @@ -968,12 +960,12 @@ bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeD MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC(dynamic_cast(other)); + const MEDCouplingNoTimeLabel *otherC(dynamic_cast(other)); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::aggregation on mismatched time discretization !"); MCAuto arr(DataArrayDouble::Aggregate(getArray(),other->getArray())); - auto *ret(new MEDCouplingNoTimeLabel); - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret(new MEDCouplingNoTimeLabel); + ret->setArray(arr,0); return ret; } @@ -981,89 +973,89 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const std::vect { std::vector a(other.size()); int i=0; - for(auto it=other.begin();it!=other.end();it++,i++) + for(std::vector::const_iterator it=other.begin();it!=other.end();it++,i++) { - const auto *itC=dynamic_cast(*it); + const MEDCouplingNoTimeLabel *itC=dynamic_cast(*it); if(!itC) throw INTERP_KERNEL::Exception("NoTimeLabel::aggregate on mismatched time discretization !"); a[i]=itC->getArray(); } MCAuto arr(DataArrayDouble::Aggregate(a)); - auto *ret(new MEDCouplingNoTimeLabel); - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret(new MEDCouplingNoTimeLabel); + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::meld on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Meld(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setTimeTolerance(getTimeTolerance()); - ret->setArray(arr,nullptr); + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::dot on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Dot(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::crossProduct on mismatched time discretization !"); MCAuto arr=DataArrayDouble::CrossProduct(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Max(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Min(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::add on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Add(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; + ret->setArray(arr,0); return ret; } void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::addEqual on mismatched time discretization !"); if(!getArray()) @@ -1073,20 +1065,20 @@ void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::substract on mismatched time discretization !"); if(!getArray()) throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substract : Data Array is NULL !"); MCAuto arr=DataArrayDouble::Substract(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; + ret->setArray(arr,0); return ret; } void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::substractEqual on mismatched time discretization !"); if(!getArray()) @@ -1096,18 +1088,18 @@ void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::multiply on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Multiply(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; + ret->setArray(arr,0); return ret; } void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::multiplyEqual on mismatched time discretization !"); if(!getArray()) @@ -1117,18 +1109,18 @@ void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization * MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("divide on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Divide(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; + ret->setArray(arr,0); return ret; } void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::divideEqual on mismatched time discretization !"); if(!getArray()) @@ -1138,18 +1130,18 @@ void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *ot MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("pow on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Pow(getArray(),other->getArray()); - auto *ret=new MEDCouplingNoTimeLabel; - ret->setArray(arr,nullptr); + MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; + ret->setArray(arr,0); return ret; } void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::powEqual on mismatched time discretization !"); if(!getArray()) @@ -1162,87 +1154,87 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::performCopyOrIncrRef(bool return new MEDCouplingNoTimeLabel(*this,deepCopy); } -void MEDCouplingNoTimeLabel::checkTimePresence(double /*time*/) const +void MEDCouplingNoTimeLabel::checkTimePresence(double time) const { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -std::vector< const DataArrayDouble *> MEDCouplingNoTimeLabel::getArraysForTime(double /*time*/) const +std::vector< const DataArrayDouble *> MEDCouplingNoTimeLabel::getArraysForTime(double time) const { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::getValueForTime(double /*time*/, const std::vector& /*vals*/, double * /*res*/) const +void MEDCouplingNoTimeLabel::getValueForTime(double time, const std::vector& vals, double *res) const { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -bool MEDCouplingNoTimeLabel::isBefore(const MEDCouplingTimeDiscretization * /*other*/) const +bool MEDCouplingNoTimeLabel::isBefore(const MEDCouplingTimeDiscretization *other) const { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -bool MEDCouplingNoTimeLabel::isStrictlyBefore(const MEDCouplingTimeDiscretization * /*other*/) const +bool MEDCouplingNoTimeLabel::isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -double MEDCouplingNoTimeLabel::getStartTime(int& /*iteration*/, int& /*order*/) const +double MEDCouplingNoTimeLabel::getStartTime(int& iteration, int& order) const { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -double MEDCouplingNoTimeLabel::getEndTime(int& /*iteration*/, int& /*order*/) const +double MEDCouplingNoTimeLabel::getEndTime(int& iteration, int& order) const { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::setStartIteration(int /*it*/) +void MEDCouplingNoTimeLabel::setStartIteration(int it) { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::setEndIteration(int /*it*/) +void MEDCouplingNoTimeLabel::setEndIteration(int it) { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::setStartOrder(int /*order*/) +void MEDCouplingNoTimeLabel::setStartOrder(int order) { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::setEndOrder(int /*order*/) +void MEDCouplingNoTimeLabel::setEndOrder(int order) { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::setStartTimeValue(double /*time*/) +void MEDCouplingNoTimeLabel::setStartTimeValue(double time) { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::setEndTimeValue(double /*time*/) +void MEDCouplingNoTimeLabel::setEndTimeValue(double time) { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::setStartTime(double /*time*/, int /*iteration*/, int /*order*/) +void MEDCouplingNoTimeLabel::setStartTime(double time, int iteration, int order) { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::setEndTime(double /*time*/, int /*iteration*/, int /*order*/) +void MEDCouplingNoTimeLabel::setEndTime(double time, int iteration, int order) { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::getValueOnTime(mcIdType /*eltId*/, double /*time*/, double * /*value*/) const +void MEDCouplingNoTimeLabel::getValueOnTime(mcIdType eltId, double time, double *value) const { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::getValueOnDiscTime(mcIdType /*eltId*/, int /*iteration*/, int /*order*/, double * /*value*/) const +void MEDCouplingNoTimeLabel::getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const { throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } @@ -1267,7 +1259,7 @@ void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector& /*tinyInfoI*/, const std::vector& tinyInfoD) +void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) { _time_tolerance=tinyInfoD[0]; } @@ -1277,7 +1269,8 @@ MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& } MEDCouplingWithTimeStep::MEDCouplingWithTimeStep() -= default; +{ +} std::string MEDCouplingWithTimeStep::getStringRepr() const { @@ -1292,9 +1285,9 @@ void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh) if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !"); int it=-1,order=-1; - double const val=mesh->getTime(it,order); + double val=mesh->getTime(it,order); _tk.setAllInfo(val,it,order); - std::string const tUnit(mesh->getTimeUnit()); + std::string tUnit(mesh->getTimeUnit()); setTimeUnit(tUnit); } @@ -1354,16 +1347,16 @@ bool MEDCouplingWithTimeStep::areCompatible(const MEDCouplingTimeDiscretizationT { if(!MEDCouplingTimeDiscretization::areCompatible(other)) return false; - const auto *otherC=dynamic_cast(other); - return otherC!=nullptr; + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); + return otherC!=0; } bool MEDCouplingWithTimeStep::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const { if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason)) return false; - const auto *otherC=dynamic_cast(other); - bool const ret=otherC!=nullptr; + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); + bool ret=otherC!=0; if(!ret) reason.insert(0,"time discretization of this is ONE_TIME, other has a different time discretization."); return ret; @@ -1373,29 +1366,29 @@ bool MEDCouplingWithTimeStep::areStrictlyCompatibleForMul(const MEDCouplingTimeD { if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other)) return false; - const auto *otherC=dynamic_cast(other); - return otherC!=nullptr; + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); + return otherC!=0; } bool MEDCouplingWithTimeStep::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const { if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other)) return false; - const auto *otherC=dynamic_cast(other); - return otherC!=nullptr; + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); + return otherC!=0; } bool MEDCouplingWithTimeStep::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const { if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other)) return false; - const auto *otherC=dynamic_cast(other); - return otherC!=nullptr; + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); + return otherC!=0; } bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); std::ostringstream oss; oss.precision(15); if(!otherC) { @@ -1409,7 +1402,7 @@ bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretizatio bool MEDCouplingWithTimeStep::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) return false; if(!_tk.isEqual(otherC->_tk,_time_tolerance)) @@ -1420,7 +1413,7 @@ bool MEDCouplingWithTimeStep::isEqualWithoutConsideringStr(const MEDCouplingTime void MEDCouplingWithTimeStep::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other) { MEDCouplingTimeDiscretization::copyTinyAttrFrom(other); - const auto *otherC=dynamic_cast(&other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(&other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::copyTinyAttrFrom : mismatch of time discretization !"); _tk.copyFrom(otherC->_tk); @@ -1428,12 +1421,12 @@ void MEDCouplingWithTimeStep::copyTinyAttrFrom(const MEDCouplingTimeDiscretizati MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::aggregation on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Aggregate(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); return ret; } @@ -1441,91 +1434,91 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const std::vec { std::vector a(other.size()); int i=0; - for(auto it=other.begin();it!=other.end();it++,i++) + for(std::vector::const_iterator it=other.begin();it!=other.end();it++,i++) { - const auto *itC=dynamic_cast(*it); + const MEDCouplingWithTimeStep *itC=dynamic_cast(*it); if(!itC) throw INTERP_KERNEL::Exception("WithTimeStep::aggregate on mismatched time discretization !"); a[i]=itC->getArray(); } MCAuto arr=DataArrayDouble::Aggregate(a); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::meld on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Meld(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::dot on mismatched time discretization !"); - auto *ret=new MEDCouplingWithTimeStep; + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; MCAuto arr=DataArrayDouble::Dot(getArray(),other->getArray()); - ret->setArray(arr,nullptr); + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::crossProduct on mismatched time discretization !"); MCAuto arr=DataArrayDouble::CrossProduct(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::max on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Max(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::min on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Min(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::add on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Add(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); int tmp1,tmp2; - double const tmp3=getStartTime(tmp1,tmp2); + double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); return ret; } void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::addEqual on mismatched time discretization !"); if(!getArray()) @@ -1535,21 +1528,21 @@ void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *othe MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::substract on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Substract(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); int tmp1,tmp2; - double const tmp3=getStartTime(tmp1,tmp2); + double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); return ret; } void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::substractEqual on mismatched time discretization !"); if(!getArray()) @@ -1559,21 +1552,21 @@ void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::multiply on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Multiply(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); int tmp1,tmp2; - double const tmp3=getStartTime(tmp1,tmp2); + double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); return ret; } void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::multiplyEqual on mismatched time discretization !"); if(!getArray()) @@ -1583,21 +1576,21 @@ void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::divide on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Divide(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); int tmp1,tmp2; - double const tmp3=getStartTime(tmp1,tmp2); + double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); return ret; } void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::divideEqual on mismatched time discretization !"); if(!getArray()) @@ -1607,21 +1600,21 @@ void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *o MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::pow on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Pow(getArray(),other->getArray()); - auto *ret=new MEDCouplingWithTimeStep; - ret->setArray(arr,nullptr); + MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; + ret->setArray(arr,0); int tmp1,tmp2; - double const tmp3=getStartTime(tmp1,tmp2); + double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); return ret; } void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::powEqual on mismatched time discretization !"); if(!getArray()) @@ -1656,7 +1649,7 @@ std::vector< const DataArrayDouble *> MEDCouplingWithTimeStep::getArraysForTime( throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingWithTimeStep::getValueForTime(double /*time*/, const std::vector& vals, double *res) const +void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector& vals, double *res) const { std::copy(vals.begin(),vals.end(),res); } @@ -1684,12 +1677,13 @@ void MEDCouplingWithTimeStep::getValueOnDiscTime(mcIdType eltId, int iteration, } MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval() -= default; +{ +} void MEDCouplingConstOnTimeInterval::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other) { MEDCouplingTimeDiscretization::copyTinyAttrFrom(other); - const auto *otherC=dynamic_cast(&other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(&other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingConstOnTimeInterval::copyTinyAttrFrom : mismatch of time discretization !"); _start.copyFrom(otherC->_start); @@ -1779,10 +1773,10 @@ void MEDCouplingConstOnTimeInterval::synchronizeTimeWith(const MEDCouplingMesh * if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingWithTimeStep::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !"); int it=-1,order=-1; - double const val=mesh->getTime(it,order); + double val=mesh->getTime(it,order); _start.setAllInfo(val,it,order); _end.setAllInfo(val,it,order); - std::string const tUnit(mesh->getTimeUnit()); + std::string tUnit(mesh->getTimeUnit()); setTimeUnit(tUnit); } @@ -1803,7 +1797,7 @@ std::vector< const DataArrayDouble *> MEDCouplingConstOnTimeInterval::getArraysF throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingConstOnTimeInterval::getValueForTime(double /*time*/, const std::vector& vals, double *res) const +void MEDCouplingConstOnTimeInterval::getValueForTime(double time, const std::vector& vals, double *res) const { std::copy(vals.begin(),vals.end(),res); } @@ -1812,16 +1806,16 @@ bool MEDCouplingConstOnTimeInterval::areCompatible(const MEDCouplingTimeDiscreti { if(!MEDCouplingTimeDiscretization::areCompatible(other)) return false; - const auto *otherC=dynamic_cast(other); - return otherC!=nullptr; + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); + return otherC!=0; } bool MEDCouplingConstOnTimeInterval::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const { if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason)) return false; - const auto *otherC=dynamic_cast(other); - bool const ret=otherC!=nullptr; + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); + bool ret=otherC!=0; if(!ret) reason.insert(0,"time discretization of this is CONST_ON_TIME_INTERVAL, other has a different time discretization."); return ret; @@ -1831,29 +1825,29 @@ bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForMul(const MEDCoupli { if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other)) return false; - const auto *otherC(dynamic_cast(other)); - return otherC!=nullptr; + const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast(other)); + return otherC!=0; } bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const { if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other)) return false; - const auto *otherC(dynamic_cast(other)); - return otherC!=nullptr; + const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast(other)); + return otherC!=0; } bool MEDCouplingConstOnTimeInterval::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const { if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other)) return false; - const auto *otherC(dynamic_cast(other)); - return otherC!=nullptr; + const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast(other)); + return otherC!=0; } bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const { - const auto *otherC(dynamic_cast(other)); + const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast(other)); std::ostringstream oss; oss.precision(15); if(!otherC) { @@ -1869,7 +1863,7 @@ bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscre bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const { - const auto *otherC(dynamic_cast(other)); + const MEDCouplingConstOnTimeInterval *otherC(dynamic_cast(other)); if(!otherC) return false; if(!_start.isEqual(otherC->_start,_time_tolerance)) @@ -1890,7 +1884,7 @@ void MEDCouplingConstOnTimeInterval::getValueOnTime(mcIdType eltId, double time, throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(mcIdType eltId, int iteration, int /*order*/, double *value) const +void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const { if(iteration>=_start.getIteration() && iteration<=_end.getIteration()) if(_array) @@ -1919,12 +1913,12 @@ void MEDCouplingConstOnTimeInterval::checkTimePresence(double time) const MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregation on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Aggregate(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); return ret; } @@ -1932,83 +1926,83 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const s { std::vector a(other.size()); int i=0; - for(auto it=other.begin();it!=other.end();it++,i++) + for(std::vector::const_iterator it=other.begin();it!=other.end();it++,i++) { - const auto *itC=dynamic_cast(*it); + const MEDCouplingConstOnTimeInterval *itC=dynamic_cast(*it); if(!itC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregate on mismatched time discretization !"); a[i]=itC->getArray(); } MCAuto arr=DataArrayDouble::Aggregate(a); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::meld on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Meld(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setTimeTolerance(getTimeTolerance()); - ret->setArray(arr,nullptr); + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::dot on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Dot(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::crossProduct on mismatched time discretization !"); MCAuto arr=DataArrayDouble::CrossProduct(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::max on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Max(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::min on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Min(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::add on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Add(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); int tmp1,tmp2; double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); @@ -2019,7 +2013,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCoup void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::addEqual on mismatched time discretization !"); if(!getArray()) @@ -2029,12 +2023,12 @@ void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretizatio MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substract on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Substract(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); int tmp1,tmp2; double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); @@ -2045,7 +2039,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const M void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substractEqual on mismatched time discretization !"); if(!getArray()) @@ -2055,12 +2049,12 @@ void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscret MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("multiply on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Multiply(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); int tmp1,tmp2; double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); @@ -2071,7 +2065,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const ME void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::multiplyEqual on mismatched time discretization !"); if(!getArray()) @@ -2081,12 +2075,12 @@ void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscreti MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("divide on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Divide(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); int tmp1,tmp2; double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); @@ -2097,7 +2091,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDC void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::divideEqual on mismatched time discretization !"); if(!getArray()) @@ -2107,12 +2101,12 @@ void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretiza MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("pow on mismatched time discretization !"); MCAuto arr=DataArrayDouble::Pow(getArray(),other->getArray()); - auto *ret=new MEDCouplingConstOnTimeInterval; - ret->setArray(arr,nullptr); + MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; + ret->setArray(arr,0); int tmp1,tmp2; double tmp3=getStartTime(tmp1,tmp2); ret->setStartTime(tmp3,tmp1,tmp2); @@ -2123,7 +2117,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCoup void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::powEqual on mismatched time discretization !"); if(!getArray()) @@ -2137,7 +2131,7 @@ MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& if(other._end_array) _end_array=other._end_array->performCopyOrIncrRef(deepCopy); else - _end_array=nullptr; + _end_array=0; } void MEDCouplingTwoTimeSteps::updateTime() const @@ -2152,10 +2146,10 @@ void MEDCouplingTwoTimeSteps::synchronizeTimeWith(const MEDCouplingMesh *mesh) if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::synchronizeTimeWith : mesh instance is NULL ! Impossible to synchronize time !"); int it=-1,order=-1; - double const val=mesh->getTime(it,order); + double val=mesh->getTime(it,order); _start.setAllInfo(val,it,order); _end.setAllInfo(val,it,order); - std::string const tUnit(mesh->getTimeUnit()); + std::string tUnit(mesh->getTimeUnit()); setTimeUnit(tUnit); } @@ -2174,7 +2168,7 @@ std::vector MEDCouplingTwoTimeSteps::getDirectChildrenW void MEDCouplingTwoTimeSteps::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other) { MEDCouplingTimeDiscretization::copyTinyAttrFrom(other); - const auto *otherC=dynamic_cast(&other); + const MEDCouplingTwoTimeSteps *otherC=dynamic_cast(&other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingTwoTimeSteps::copyTinyAttrFrom : mismatch of time discretization !"); _start.copyFrom(otherC->_start); @@ -2184,7 +2178,7 @@ void MEDCouplingTwoTimeSteps::copyTinyAttrFrom(const MEDCouplingTimeDiscretizati void MEDCouplingTwoTimeSteps::copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate& other) { MEDCouplingTimeDiscretization::copyTinyStringsFrom(other); - const auto *otherC=dynamic_cast(&other); + const MEDCouplingTwoTimeSteps *otherC=dynamic_cast(&other); if(!otherC) throw INTERP_KERNEL::Exception("Trying to operate copyTinyStringsFrom on different field type (two times//one time) !"); if(_end_array && otherC->_end_array) @@ -2214,8 +2208,8 @@ void MEDCouplingTwoTimeSteps::checkConsistencyLight() const bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const { - std::ostringstream const oss; - const auto *otherC(dynamic_cast(other)); + std::ostringstream oss; + const MEDCouplingTwoTimeSteps *otherC(dynamic_cast(other)); if(!otherC) { reason="This has time discretization LINEAR_TIME, other not."; @@ -2236,7 +2230,7 @@ bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretizatio bool MEDCouplingTwoTimeSteps::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const { - const auto *otherC(dynamic_cast(other)); + const MEDCouplingTwoTimeSteps *otherC(dynamic_cast(other)); if(!otherC) return false; if(!_start.isEqual(otherC->_start,_time_tolerance)) @@ -2249,7 +2243,7 @@ bool MEDCouplingTwoTimeSteps::isEqualWithoutConsideringStr(const MEDCouplingTime return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec); } -MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps():_end_array(nullptr) +MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps():_end_array(0) { } @@ -2324,7 +2318,7 @@ void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector& tinyInfo) const { - std::size_t const nbOfCompo=_array->getNumberOfComponents(); + std::size_t nbOfCompo=_array->getNumberOfComponents(); for(std::size_t i=0;igetInfoOnComponent(i)); for(std::size_t i=0;i& tinyInfoI, std::vector& arrays) { arrays.resize(2); - if(_array!=nullptr) + if(_array!=0) _array->decrRef(); - if(_end_array!=nullptr) + if(_end_array!=0) _end_array->decrRef(); - DataArrayDouble *arr=nullptr; + DataArrayDouble *arr=0; if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1) { arr=DataArrayDouble::New(); @@ -2346,7 +2340,7 @@ void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vectordecrRef(); - if(_end_array!=nullptr) + if(_end_array!=0) _end_array->decrRef(); - _array=nullptr; _end_array=nullptr; + _array=0; _end_array=0; if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1) { if(!arrays[0]) @@ -2456,7 +2450,8 @@ MEDCouplingLinearTime::MEDCouplingLinearTime(const MEDCouplingLinearTime& other, } MEDCouplingLinearTime::MEDCouplingLinearTime() -= default; +{ +} std::string MEDCouplingLinearTime::getStringRepr() const { @@ -2483,12 +2478,12 @@ bool MEDCouplingLinearTime::areCompatible(const MEDCouplingTimeDiscretizationTem { if(!MEDCouplingTimeDiscretization::areCompatible(other)) return false; - const auto *otherC=dynamic_cast(other); - if(otherC==nullptr) + const MEDCouplingLinearTime *otherC=dynamic_cast(other); + if(otherC==0) return false; - if(_end_array==nullptr && otherC->_end_array==nullptr) + if(_end_array==0 && otherC->_end_array==0) return true; - if(_end_array==nullptr || otherC->_end_array==nullptr) + if(_end_array==0 || otherC->_end_array==0) return false; if(_end_array->getNumberOfComponents()!=otherC->_end_array->getNumberOfComponents()) return false; @@ -2499,8 +2494,8 @@ bool MEDCouplingLinearTime::areStrictlyCompatible(const MEDCouplingTimeDiscretiz { if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason)) return false; - const auto *otherC=dynamic_cast(other); - bool const ret=otherC!=nullptr; + const MEDCouplingLinearTime *otherC=dynamic_cast(other); + bool ret=otherC!=0; if(!ret) reason.insert(0,"time discretization of this is LINEAR_TIME, other has a different time discretization."); return ret; @@ -2510,23 +2505,23 @@ bool MEDCouplingLinearTime::areStrictlyCompatibleForMul(const MEDCouplingTimeDis { if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other)) return false; - const auto *otherC=dynamic_cast(other); - return otherC!=nullptr; + const MEDCouplingLinearTime *otherC=dynamic_cast(other); + return otherC!=0; } bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const { if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other)) return false; - const auto *otherC=dynamic_cast(other); - if(otherC==nullptr) + const MEDCouplingLinearTime *otherC=dynamic_cast(other); + if(otherC==0) return false; - if(_end_array==nullptr && otherC->_end_array==nullptr) + if(_end_array==0 && otherC->_end_array==0) return true; - if(_end_array==nullptr || otherC->_end_array==nullptr) + if(_end_array==0 || otherC->_end_array==0) return false; - std::size_t const nbC1=_end_array->getNumberOfComponents(); - std::size_t const nbC2=otherC->_end_array->getNumberOfComponents(); + std::size_t nbC1=_end_array->getNumberOfComponents(); + std::size_t nbC2=otherC->_end_array->getNumberOfComponents(); if(nbC1!=nbC2 && nbC2!=1) return false; return true; @@ -2536,8 +2531,8 @@ bool MEDCouplingLinearTime::areCompatibleForMeld(const MEDCouplingTimeDiscretiza { if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other)) return false; - const auto *otherC=dynamic_cast(other); - return otherC!=nullptr; + const MEDCouplingLinearTime *otherC=dynamic_cast(other); + return otherC!=0; } /*! @@ -2545,8 +2540,8 @@ bool MEDCouplingLinearTime::areCompatibleForMeld(const MEDCouplingTimeDiscretiza */ void MEDCouplingLinearTime::getValueForTime(double time, const std::vector& vals, double *res) const { - double const alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue()); - std::size_t const nbComp=vals.size()/2; + double alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue()); + std::size_t nbComp=vals.size()/2; std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind(std::multiplies(),std::placeholders::_1,alpha)); std::vector tmp(nbComp); std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind(std::multiplies(),std::placeholders::_1,1-alpha)); @@ -2555,12 +2550,12 @@ void MEDCouplingLinearTime::getValueForTime(double time, const std::vectorgetTuple(eltId,value); else throw INTERP_KERNEL::Exception("No start array existing."); - std::size_t const nbComp=_array->getNumberOfComponents(); + std::size_t nbComp=_array->getNumberOfComponents(); std::transform(value,value+nbComp,value,std::bind(std::multiplies(),std::placeholders::_1,alpha)); std::vector tmp(nbComp); if(_end_array) @@ -2593,14 +2588,14 @@ void MEDCouplingLinearTime::getValueOnDiscTime(mcIdType eltId, int iteration, in MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::aggregation on mismatched time discretization !"); MCAuto arr1=DataArrayDouble::Aggregate(getArray(),other->getArray()); MCAuto arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray()); - auto *ret=new MEDCouplingLinearTime; - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } @@ -2609,97 +2604,97 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const std::vecto std::vector a(other.size()); std::vector b(other.size()); int i=0; - for(auto it=other.begin();it!=other.end();it++,i++) + for(std::vector::const_iterator it=other.begin();it!=other.end();it++,i++) { - const auto *itC=dynamic_cast(*it); + const MEDCouplingLinearTime *itC=dynamic_cast(*it); if(!itC) throw INTERP_KERNEL::Exception("MEDCouplingLinearTime::aggregate on mismatched time discretization !"); a[i]=itC->getArray(); b[i]=itC->getEndArray(); } MCAuto arr(DataArrayDouble::Aggregate(a)),arr2(DataArrayDouble::Aggregate(b)); - auto *ret(new MEDCouplingLinearTime); - ret->setArray(arr,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret(new MEDCouplingLinearTime); + ret->setArray(arr,0); + ret->setEndArray(arr2,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::meld on mismatched time discretization !"); MCAuto arr1(DataArrayDouble::Meld(getArray(),other->getArray())),arr2(DataArrayDouble::Meld(getEndArray(),other->getEndArray())); - auto *ret(new MEDCouplingLinearTime); + MEDCouplingLinearTime *ret(new MEDCouplingLinearTime); ret->setTimeTolerance(getTimeTolerance()); - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::dot on mismatched time discretization !"); MCAuto arr1(DataArrayDouble::Dot(getArray(),other->getArray())),arr2(DataArrayDouble::Dot(getEndArray(),other->getEndArray())); - auto *ret(new MEDCouplingLinearTime); - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret(new MEDCouplingLinearTime); + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::crossProduct on mismatched time discretization !"); MCAuto arr1(DataArrayDouble::CrossProduct(getArray(),other->getArray())),arr2(DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray())); - auto *ret(new MEDCouplingLinearTime); - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret(new MEDCouplingLinearTime); + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::max on mismatched time discretization !"); - auto *ret=new MEDCouplingLinearTime; + MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; MCAuto arr1(DataArrayDouble::Max(getArray(),other->getArray())),arr2(DataArrayDouble::Max(getEndArray(),other->getEndArray())); - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::min on mismatched time discretization !"); MCAuto arr1(DataArrayDouble::Min(getArray(),other->getArray())),arr2(DataArrayDouble::Min(getEndArray(),other->getEndArray())); - auto *ret(new MEDCouplingLinearTime); - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret(new MEDCouplingLinearTime); + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::add on mismatched time discretization !"); MCAuto arr1(DataArrayDouble::Add(getArray(),other->getArray())),arr2(DataArrayDouble::Add(getEndArray(),other->getEndArray())); - auto *ret(new MEDCouplingLinearTime); - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret(new MEDCouplingLinearTime); + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !"); if(!getArray()) @@ -2712,20 +2707,20 @@ void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other) MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::substract on mismatched time discretization !"); MCAuto arr1=DataArrayDouble::Substract(getArray(),other->getArray()); MCAuto arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray()); - auto *ret=new MEDCouplingLinearTime; - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !"); if(!getArray()) @@ -2738,20 +2733,20 @@ void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization * MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::multiply on mismatched time discretization !"); MCAuto arr1=DataArrayDouble::Multiply(getArray(),other->getArray()); MCAuto arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray()); - auto *ret=new MEDCouplingLinearTime; - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !"); if(!getArray()) @@ -2764,20 +2759,20 @@ void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *o MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::divide on mismatched time discretization !"); MCAuto arr1=DataArrayDouble::Divide(getArray(),other->getArray()); MCAuto arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray()); - auto *ret=new MEDCouplingLinearTime; - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !"); if(!getArray()) @@ -2790,20 +2785,20 @@ void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *oth MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeDiscretization *other) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::pow on mismatched time discretization !"); MCAuto arr1=DataArrayDouble::Pow(getArray(),other->getArray()); MCAuto arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray()); - auto *ret=new MEDCouplingLinearTime; - ret->setArray(arr1,nullptr); - ret->setEndArray(arr2,nullptr); + MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; + ret->setArray(arr1,0); + ret->setEndArray(arr2,0); return ret; } void MEDCouplingLinearTime::powEqual(const MEDCouplingTimeDiscretization *other) { - const auto *otherC=dynamic_cast(other); + const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::addEqual on mismatched time discretization !"); if(!getArray()) diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx index a49929959..5a31fdc21 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx @@ -21,14 +21,12 @@ #ifndef __MEDCOUPLINGTIMEDISCRETIZATION_HXX__ #define __MEDCOUPLINGTIMEDISCRETIZATION_HXX__ -#include "MCType.hxx" #include "MEDCoupling.hxx" #include "MEDCouplingTimeLabel.hxx" #include "MEDCouplingRefCountObject.hxx" +#include "InterpKernelException.hxx" #include "MEDCouplingTraits.hxx" -#include -#include #include namespace MEDCoupling @@ -47,8 +45,8 @@ namespace MEDCoupling void copyTinyAttrFrom(const TimeHolder& other) { _time_unit=other._time_unit; } protected: TimeHolder() { } - TimeHolder(const TimeHolder& other) = default; - virtual ~TimeHolder() = default; + TimeHolder(const TimeHolder& other):_time_unit(other._time_unit) { } + virtual ~TimeHolder() { } private: std::string _time_unit; }; @@ -57,7 +55,7 @@ namespace MEDCoupling class MEDCouplingTimeDiscretizationTemplate : public TimeLabel, public BigMemoryObject, public TimeHolder { public: - MEDCOUPLING_EXPORT void updateTime() const override; + MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT virtual void setArray(typename Traits::ArrayType *array, TimeLabel *owner); MEDCOUPLING_EXPORT typename Traits::ArrayType *getArray() { return _array; } MEDCOUPLING_EXPORT const typename Traits::ArrayType *getArray() const { return _array; } @@ -90,8 +88,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other); MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate& other); MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT virtual std::vector getDirectChildrenWithNull() const; // MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, T prec, std::string& reason) const = 0; MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, T prec) const = 0; @@ -100,7 +98,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const; - MEDCOUPLING_EXPORT ~MEDCouplingTimeDiscretizationTemplate() override; + MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretizationTemplate(); MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT virtual void getTinySerializationStrInformation(std::vector& tinyInfo) const; @@ -120,7 +118,7 @@ namespace MEDCoupling class MEDCouplingTimeKeeper { public: - MEDCOUPLING_EXPORT MEDCouplingTimeKeeper() = default; + MEDCOUPLING_EXPORT MEDCouplingTimeKeeper():_time(0.),_iteration(-1),_order(-1) { } MEDCOUPLING_EXPORT double getAllInfo(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; } MEDCOUPLING_EXPORT void setAllInfo(double time, int iteration, int order) { _time=time; _iteration=iteration; _order=order; } MEDCOUPLING_EXPORT int getIteration() const { return _iteration; } @@ -134,9 +132,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void copyFrom(const MEDCouplingTimeKeeper& other); MEDCOUPLING_EXPORT void checkTimePresence(double time, double eps) const; private: - double _time{0.}; - int _iteration{-1}; - int _order{-1}; + double _time; + int _iteration; + int _order; }; class MEDCouplingTimeDiscretization : public MEDCouplingTimeDiscretizationTemplate @@ -147,8 +145,8 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type); MEDCOUPLING_EXPORT virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const override; + MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const; + MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const; MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const; MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCopy) const; MEDCOUPLING_EXPORT virtual void synchronizeTimeWith(const MEDCouplingMesh *mesh) = 0; @@ -217,18 +215,18 @@ namespace MEDCoupling class MEDCouplingTimeDiscretizationSimple : public MEDCouplingTimeDiscretizationTemplate { public: - std::string getStringRepr() const override; - double getStartTime(int& iteration, int& order) const override { return _tk.getAllInfo(iteration,order); } - void setStartIteration(int it) override { _tk.setIteration(it); } - void setStartOrder(int order) override { _tk.setOrder(order); } - void setStartTimeValue(double time) override { _tk.setTimeValue(time); } - void setStartTime(double time, int iteration, int order) override { _tk.setAllInfo(time,iteration,order); } - double getEndTime(int& iteration, int& order) const override; - void setEndIteration(int it) override; - void setEndOrder(int order) override; - void setEndTimeValue(double time) override; - void setEndTime(double time, int iteration, int order) override; - TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; } + std::string getStringRepr() const; + double getStartTime(int& iteration, int& order) const { return _tk.getAllInfo(iteration,order); } + void setStartIteration(int it) { _tk.setIteration(it); } + void setStartOrder(int order) { _tk.setOrder(order); } + void setStartTimeValue(double time) { _tk.setTimeValue(time); } + void setStartTime(double time, int iteration, int order) { _tk.setAllInfo(time,iteration,order); } + double getEndTime(int& iteration, int& order) const; + void setEndIteration(int it); + void setEndOrder(int order); + void setEndTimeValue(double time); + void setEndTime(double time, int iteration, int order); + TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; } protected: MEDCouplingTimeDiscretizationSimple(const MEDCouplingTimeDiscretizationSimple& other, bool deepCopy); MEDCouplingTimeDiscretizationSimple() { } @@ -243,23 +241,23 @@ namespace MEDCoupling class MEDCouplingTimeDiscretizationInt32 : public MEDCouplingTimeDiscretizationSimple { public: - MEDCouplingTimeDiscretizationInt32() = default; + MEDCouplingTimeDiscretizationInt32() { } std::string getClassName() const override { return std::string("MEDCouplingTimeDiscretizationInt32"); } MEDCouplingTimeDiscretizationInt32(const MEDCouplingTimeDiscretizationInt32& other, bool deepCopy); static MEDCouplingTimeDiscretizationInt32 *New(TypeOfTimeDiscretization type); - MEDCouplingTimeDiscretizationInt32 *performCopyOrIncrRef(bool deepCopy) const override; - bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, Int32 prec, std::string& reason) const override; - bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, Int32 prec) const override; + MEDCouplingTimeDiscretizationInt32 *performCopyOrIncrRef(bool deepCopy) const; + bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, Int32 prec, std::string& reason) const; + bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, Int32 prec) const; }; class MEDCouplingTimeDiscretizationInt64 : public MEDCouplingTimeDiscretizationSimple { public: - MEDCouplingTimeDiscretizationInt64() = default; + MEDCouplingTimeDiscretizationInt64() { } std::string getClassName() const override { return std::string("MEDCouplingTimeDiscretizationInt64"); } MEDCouplingTimeDiscretizationInt64(const MEDCouplingTimeDiscretizationInt64& other, bool deepCopy); static MEDCouplingTimeDiscretizationInt64 *New(TypeOfTimeDiscretization type); - MEDCouplingTimeDiscretizationInt64 *performCopyOrIncrRef(bool deepCopy) const override; + MEDCouplingTimeDiscretizationInt64 *performCopyOrIncrRef(bool deepCopy) const; bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, Int64 prec, std::string& reason) const override; bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, Int64 prec) const override; }; @@ -267,13 +265,13 @@ namespace MEDCoupling class MEDCouplingTimeDiscretizationFloat : public MEDCouplingTimeDiscretizationSimple { public: - MEDCouplingTimeDiscretizationFloat() = default; + MEDCouplingTimeDiscretizationFloat() { } std::string getClassName() const override { return std::string("MEDCouplingTimeDiscretizationFloat"); } MEDCouplingTimeDiscretizationFloat(const MEDCouplingTimeDiscretizationFloat& other, bool deepCopy); static MEDCouplingTimeDiscretizationFloat *New(TypeOfTimeDiscretization type); - MEDCouplingTimeDiscretizationFloat *performCopyOrIncrRef(bool deepCopy) const override; - bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, float prec, std::string& reason) const override; - bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, float prec) const override; + MEDCouplingTimeDiscretizationFloat *performCopyOrIncrRef(bool deepCopy) const; + bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, float prec, std::string& reason) const; + bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, float prec) const; private: static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME; }; @@ -283,56 +281,56 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel(); MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCopy); - MEDCOUPLING_EXPORT std::string getStringRepr() const override; + MEDCOUPLING_EXPORT std::string getStringRepr() const; MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingNoTimeLabel"); } - MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; } - MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector& other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const override; - MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const override; - MEDCOUPLING_EXPORT void checkNoTimePresence() const override { } - MEDCOUPLING_EXPORT void checkTimePresence(double time) const override; - MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const override; - MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& vals, double *res) const override; - MEDCOUPLING_EXPORT bool isBefore(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const override; - MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const override; - MEDCOUPLING_EXPORT void setStartIteration(int it) override; - MEDCOUPLING_EXPORT void setEndIteration(int it) override; - MEDCOUPLING_EXPORT void setStartOrder(int order) override; - MEDCOUPLING_EXPORT void setEndOrder(int order) override; - MEDCOUPLING_EXPORT void setStartTimeValue(double time) override; - MEDCOUPLING_EXPORT void setEndTimeValue(double time) override; - MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) override; - MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) override; - MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const override; - MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const override; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) override; + MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; } + MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector& other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const; + MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; + MEDCOUPLING_EXPORT void checkNoTimePresence() const { } + MEDCOUPLING_EXPORT void checkTimePresence(double time) const; + MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const; + MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& vals, double *res) const; + MEDCOUPLING_EXPORT bool isBefore(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const; + MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const; + MEDCOUPLING_EXPORT void setStartIteration(int it); + MEDCOUPLING_EXPORT void setEndIteration(int it); + MEDCOUPLING_EXPORT void setStartOrder(int order); + MEDCOUPLING_EXPORT void setEndOrder(int order); + MEDCOUPLING_EXPORT void setStartTimeValue(double time); + MEDCOUPLING_EXPORT void setEndTimeValue(double time); + MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order); + MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order); + MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const; + MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); public: static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME; MEDCOUPLING_EXPORT static const char REPR[]; @@ -347,57 +345,57 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT MEDCouplingWithTimeStep(); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingWithTimeLabel"); } - MEDCOUPLING_EXPORT std::string getStringRepr() const override; - MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other) override; - MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; } - MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector& other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const override; - MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) override; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const override; - MEDCOUPLING_EXPORT void checkNoTimePresence() const override; - MEDCOUPLING_EXPORT void checkTimePresence(double time) const override; - MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) override { _tk.setAllInfo(time,iteration,order); } - MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) override { _tk.setAllInfo(time,iteration,order); } - MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const override { return _tk.getAllInfo(iteration,order); } - MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const override { return _tk.getAllInfo(iteration,order); } - MEDCOUPLING_EXPORT void setStartIteration(int it) override { _tk.setIteration(it); } - MEDCOUPLING_EXPORT void setEndIteration(int it) override { _tk.setIteration(it); } - MEDCOUPLING_EXPORT void setStartOrder(int order) override { _tk.setOrder(order); } - MEDCOUPLING_EXPORT void setEndOrder(int order) override { _tk.setOrder(order); } - MEDCOUPLING_EXPORT void setStartTimeValue(double time) override { _tk.setTimeValue(time); } - MEDCOUPLING_EXPORT void setEndTimeValue(double time) override { _tk.setTimeValue(time); } - MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const override; - MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& vals, double *res) const override; - MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const override; - MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const override; + MEDCOUPLING_EXPORT std::string getStringRepr() const; + MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other); + MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; } + MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector& other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const; + MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; + MEDCOUPLING_EXPORT void checkNoTimePresence() const; + MEDCOUPLING_EXPORT void checkTimePresence(double time) const; + MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _tk.setAllInfo(time,iteration,order); } + MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) { _tk.setAllInfo(time,iteration,order); } + MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { return _tk.getAllInfo(iteration,order); } + MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { return _tk.getAllInfo(iteration,order); } + MEDCOUPLING_EXPORT void setStartIteration(int it) { _tk.setIteration(it); } + MEDCOUPLING_EXPORT void setEndIteration(int it) { _tk.setIteration(it); } + MEDCOUPLING_EXPORT void setStartOrder(int order) { _tk.setOrder(order); } + MEDCOUPLING_EXPORT void setEndOrder(int order) { _tk.setOrder(order); } + MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _tk.setTimeValue(time); } + MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _tk.setTimeValue(time); } + MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const; + MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& vals, double *res) const; + MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const; + MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const; public: static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME; MEDCOUPLING_EXPORT static const char REPR[]; @@ -414,57 +412,57 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval(); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingConstOnTimeInterval"); } - MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other) override; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) override; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const override; - MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const override; - MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const override; - MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& vals, double *res) const override; - MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const override; - MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const override; - MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; } - MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh) override; - MEDCOUPLING_EXPORT std::string getStringRepr() const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector& other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) override { _start.setAllInfo(time,iteration,order); } - MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) override { _end.setAllInfo(time,iteration,order); } - MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const override { return _start.getAllInfo(iteration,order); } - MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const override { return _end.getAllInfo(iteration,order); } - MEDCOUPLING_EXPORT void setStartIteration(int it) override { _start.setIteration(it); } - MEDCOUPLING_EXPORT void setEndIteration(int it) override { _end.setIteration(it); } - MEDCOUPLING_EXPORT void setStartOrder(int order) override { _start.setOrder(order); } - MEDCOUPLING_EXPORT void setEndOrder(int order) override { _end.setOrder(order); } - MEDCOUPLING_EXPORT void setStartTimeValue(double time) override { _start.setTimeValue(time); } - MEDCOUPLING_EXPORT void setEndTimeValue(double time) override { _end.setTimeValue(time); } - MEDCOUPLING_EXPORT void checkNoTimePresence() const override; - MEDCOUPLING_EXPORT void checkTimePresence(double time) const override; + MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other); + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; + MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const; + MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const; + MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& vals, double *res) const; + MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const; + MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const; + MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; } + MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh); + MEDCOUPLING_EXPORT std::string getStringRepr() const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector& other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other); + MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _start.setAllInfo(time,iteration,order); } + MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) { _end.setAllInfo(time,iteration,order); } + MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { return _start.getAllInfo(iteration,order); } + MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { return _end.getAllInfo(iteration,order); } + MEDCOUPLING_EXPORT void setStartIteration(int it) { _start.setIteration(it); } + MEDCOUPLING_EXPORT void setEndIteration(int it) { _end.setIteration(it); } + MEDCOUPLING_EXPORT void setStartOrder(int order) { _start.setOrder(order); } + MEDCOUPLING_EXPORT void setEndOrder(int order) { _end.setOrder(order); } + MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _start.setTimeValue(time); } + MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _end.setTimeValue(time); } + MEDCOUPLING_EXPORT void checkNoTimePresence() const; + MEDCOUPLING_EXPORT void checkTimePresence(double time) const; public: static const TypeOfTimeDiscretization DISCRETIZATION=CONST_ON_TIME_INTERVAL; MEDCOUPLING_EXPORT static const char REPR[]; @@ -480,45 +478,45 @@ namespace MEDCoupling protected: MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCopy); MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps(); - MEDCOUPLING_EXPORT ~MEDCouplingTwoTimeSteps() override; + MEDCOUPLING_EXPORT ~MEDCouplingTwoTimeSteps(); public: MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingTwoTimeSteps"); } - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh) override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other) override; - MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate& other) override; - MEDCOUPLING_EXPORT const DataArrayDouble *getEndArray() const override; - MEDCOUPLING_EXPORT DataArrayDouble *getEndArray() override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const override; - MEDCOUPLING_EXPORT void checkNoTimePresence() const override; - MEDCOUPLING_EXPORT void checkTimePresence(double time) const override; - MEDCOUPLING_EXPORT void getArrays(std::vector& arrays) const override; - MEDCOUPLING_EXPORT void setEndArray(DataArrayDouble *array, TimeLabel *owner) override; - MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) override { _start.setAllInfo(time,iteration,order); } - MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) override { _end.setAllInfo(time,iteration,order); } - MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const override { return _start.getAllInfo(iteration,order); } - MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const override { return _end.getAllInfo(iteration,order); } - MEDCOUPLING_EXPORT void setStartIteration(int it) override { _start.setIteration(it); } - MEDCOUPLING_EXPORT void setEndIteration(int it) override { _end.setIteration(it); } - MEDCOUPLING_EXPORT void setStartOrder(int order) override { _start.setOrder(order); } - MEDCOUPLING_EXPORT void setEndOrder(int order) override { _end.setOrder(order); } - MEDCOUPLING_EXPORT void setStartTimeValue(double time) override { _start.setTimeValue(time); } - MEDCOUPLING_EXPORT void setEndTimeValue(double time) override { _end.setTimeValue(time); } - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, std::vector& arrays) override; - MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfoI, const std::vector& arrays) override; - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) override; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) override; - MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const override; - MEDCOUPLING_EXPORT void setArrays(const std::vector& arrays, TimeLabel *owner) override; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh); + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other); + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate& other); + MEDCOUPLING_EXPORT const DataArrayDouble *getEndArray() const; + MEDCOUPLING_EXPORT DataArrayDouble *getEndArray(); + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, double prec) const; + MEDCOUPLING_EXPORT void checkNoTimePresence() const; + MEDCOUPLING_EXPORT void checkTimePresence(double time) const; + MEDCOUPLING_EXPORT void getArrays(std::vector& arrays) const; + MEDCOUPLING_EXPORT void setEndArray(DataArrayDouble *array, TimeLabel *owner); + MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _start.setAllInfo(time,iteration,order); } + MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) { _end.setAllInfo(time,iteration,order); } + MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { return _start.getAllInfo(iteration,order); } + MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { return _end.getAllInfo(iteration,order); } + MEDCOUPLING_EXPORT void setStartIteration(int it) { _start.setIteration(it); } + MEDCOUPLING_EXPORT void setEndIteration(int it) { _end.setIteration(it); } + MEDCOUPLING_EXPORT void setStartOrder(int order) { _start.setOrder(order); } + MEDCOUPLING_EXPORT void setEndOrder(int order) { _end.setOrder(order); } + MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _start.setTimeValue(time); } + MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _end.setTimeValue(time); } + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, std::vector& arrays); + MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfoI, const std::vector& arrays); + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); + MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const; + MEDCOUPLING_EXPORT void setArrays(const std::vector& arrays, TimeLabel *owner); protected: static const char EXCEPTION_MSG[]; protected: @@ -533,35 +531,35 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCopy); public: MEDCOUPLING_EXPORT MEDCouplingLinearTime(); - MEDCOUPLING_EXPORT std::string getStringRepr() const override; - MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const override { return DISCRETIZATION; } - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const override; - MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const override; - MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& vals, double *res) const override; - MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const override; - MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector& other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other) override; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const override; - MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other) override; + MEDCOUPLING_EXPORT std::string getStringRepr() const; + MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; } + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; + MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate *other, std::string& reason) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const; + MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector& vals, double *res) const; + MEDCOUPLING_EXPORT void getValueOnTime(mcIdType eltId, double time, double *value) const; + MEDCOUPLING_EXPORT void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector& other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const; + MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other); public: static const TypeOfTimeDiscretization DISCRETIZATION=LINEAR_TIME; MEDCOUPLING_EXPORT static const char REPR[]; diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.txx b/src/MEDCoupling/MEDCouplingTimeDiscretization.txx index f48d9b772..a02489ac1 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.txx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.txx @@ -21,19 +21,11 @@ #ifndef __MEDCOUPLINGTIMEDISCRETIZATION_TXX__ #define __MEDCOUPLINGTIMEDISCRETIZATION_TXX__ -#include "MEDCouplingRefCountObject.hxx" -#include "MCType.hxx" #include "MEDCouplingTimeDiscretization.hxx" -#include "MEDCouplingTraits.hxx" -#include "InterpKernelException.hxx" #include "MEDCouplingMemArray.txx" -#include #include -#include #include -#include -#include namespace MEDCoupling { @@ -119,9 +111,9 @@ namespace MEDCoupling reason=oss.str(); return false; } - if(_array==nullptr && other->_array==nullptr) + if(_array==0 && other->_array==0) return true; - if(_array==nullptr || other->_array==nullptr) + if(_array==0 || other->_array==0) { reason="Field discretizations differ : Only one timediscretization between the two this and other has a DataArrayDouble for values defined"; return false; @@ -138,9 +130,9 @@ namespace MEDCoupling { if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16) return false; - if(_array==nullptr && other->_array==nullptr) + if(_array==0 && other->_array==0) return true; - if(_array==nullptr || other->_array==nullptr) + if(_array==0 || other->_array==0) return false; if(_array->getNumberOfComponents()!=other->_array->getNumberOfComponents()) return false; @@ -152,12 +144,12 @@ namespace MEDCoupling { if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16) return false; - if(_array==nullptr && other->_array==nullptr) + if(_array==0 && other->_array==0) return true; - if(_array==nullptr || other->_array==nullptr) + if(_array==0 || other->_array==0) return false; std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); - std::size_t const nbMin(std::min(nbC1,nbC2)); + std::size_t nbMin(std::min(nbC1,nbC2)); if(nbC1!=nbC2 && nbMin!=1) return false; return true; @@ -168,9 +160,9 @@ namespace MEDCoupling { if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16) return false; - if(_array==nullptr && other->_array==nullptr) + if(_array==0 && other->_array==0) return true; - if(_array==nullptr || other->_array==nullptr) + if(_array==0 || other->_array==0) return false; std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); if(nbC1!=nbC2 && nbC2!=1) @@ -179,7 +171,7 @@ namespace MEDCoupling } template - MEDCouplingTimeDiscretizationTemplate::MEDCouplingTimeDiscretizationTemplate():_time_tolerance(TIME_TOLERANCE_DFT),_array(nullptr) + MEDCouplingTimeDiscretizationTemplate::MEDCouplingTimeDiscretizationTemplate():_time_tolerance(TIME_TOLERANCE_DFT),_array(0) { } @@ -189,7 +181,7 @@ namespace MEDCoupling if(other._array) _array=other._array->performCopyOrIncrRef(deepCopy); else - _array=nullptr; + _array=0; } template @@ -200,7 +192,7 @@ namespace MEDCoupling } template - void MEDCouplingTimeDiscretizationTemplate::setEndArray(typename Traits::ArrayType * /*array*/, TimeLabel * /*owner*/) + void MEDCouplingTimeDiscretizationTemplate::setEndArray(typename Traits::ArrayType *array, TimeLabel *owner) { throw INTERP_KERNEL::Exception("setEndArray not available for this type of time discretization !"); } @@ -256,7 +248,7 @@ namespace MEDCoupling template void MEDCouplingTimeDiscretizationTemplate::getTinySerializationStrInformation(std::vector& tinyInfo) const { - std::size_t const nbOfCompo(_array->getNumberOfComponents()); + std::size_t nbOfCompo(_array->getNumberOfComponents()); for(std::size_t i=0;igetInfoOnComponent(i)); } @@ -265,9 +257,9 @@ namespace MEDCoupling void MEDCouplingTimeDiscretizationTemplate::resizeForUnserialization(const std::vector& tinyInfoI, std::vector::ArrayType *>& arrays) { arrays.resize(1); - if(_array!=nullptr) + if(_array!=0) _array->decrRef(); - typename Traits::ArrayType *arr=nullptr; + typename Traits::ArrayType *arr=0; if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1) { arr=Traits::ArrayType::New(); @@ -283,9 +275,9 @@ namespace MEDCoupling static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size one !"; if(arrays.size()!=1) throw INTERP_KERNEL::Exception(MSG); - if(_array!=nullptr) + if(_array!=0) _array->decrRef(); - _array=nullptr; + _array=0; if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1) { if(!arrays[0]) @@ -297,10 +289,10 @@ namespace MEDCoupling } template - void MEDCouplingTimeDiscretizationTemplate::finishUnserialization(const std::vector& /*tinyInfoI*/, const std::vector& tinyInfoD, const std::vector& tinyInfoS) + void MEDCouplingTimeDiscretizationTemplate::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { _time_tolerance=tinyInfoD[0]; - std::size_t const nbOfCompo=_array->getNumberOfComponents(); + std::size_t nbOfCompo=_array->getNumberOfComponents(); for(std::size_t i=0;isetInfoOnComponent(i,tinyInfoS[i]); } @@ -317,31 +309,31 @@ namespace MEDCoupling } template - double MEDCouplingTimeDiscretizationSimple::getEndTime(int& /*iteration*/, int& /*order*/) const + double MEDCouplingTimeDiscretizationSimple::getEndTime(int& iteration, int& order) const { throw INTERP_KERNEL::Exception("getEndTime : invalid for this type of time discr !"); } template - void MEDCouplingTimeDiscretizationSimple::setEndIteration(int /*it*/) + void MEDCouplingTimeDiscretizationSimple::setEndIteration(int it) { throw INTERP_KERNEL::Exception("setEndIteration : invalid for this type of time discr !"); } template - void MEDCouplingTimeDiscretizationSimple::setEndOrder(int /*order*/) + void MEDCouplingTimeDiscretizationSimple::setEndOrder(int order) { throw INTERP_KERNEL::Exception("setEndOrder : invalid for this type of time discr !"); } template - void MEDCouplingTimeDiscretizationSimple::setEndTimeValue(double /*time*/) + void MEDCouplingTimeDiscretizationSimple::setEndTimeValue(double time) { throw INTERP_KERNEL::Exception("setEndTimeValue : invalid for this type of time discr !"); } template - void MEDCouplingTimeDiscretizationSimple::setEndTime(double /*time*/, int /*iteration*/, int /*order*/) + void MEDCouplingTimeDiscretizationSimple::setEndTime(double time, int iteration, int order) { throw INTERP_KERNEL::Exception("setEndTime : invalid for this type of time discr !"); } diff --git a/src/MEDCoupling/MEDCouplingTimeLabel.cxx b/src/MEDCoupling/MEDCouplingTimeLabel.cxx index c0ca4e22b..fe4173d30 100644 --- a/src/MEDCoupling/MEDCouplingTimeLabel.cxx +++ b/src/MEDCoupling/MEDCouplingTimeLabel.cxx @@ -22,8 +22,6 @@ #include "InterpKernelException.hxx" -#include -#include #include using namespace MEDCoupling; @@ -35,9 +33,10 @@ TimeLabel::TimeLabel():_time(GLOBAL_TIME++) } TimeLabel::~TimeLabel() -= default; +{ +} -TimeLabel& TimeLabel::operator=(const TimeLabel& /*other*/) +TimeLabel& TimeLabel::operator=(const TimeLabel& other) { _time=GLOBAL_TIME++; return *this; diff --git a/src/MEDCoupling/MEDCouplingTraits.cxx b/src/MEDCoupling/MEDCouplingTraits.cxx index 37167fa0d..55417282c 100644 --- a/src/MEDCoupling/MEDCouplingTraits.cxx +++ b/src/MEDCoupling/MEDCouplingTraits.cxx @@ -19,7 +19,6 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingTraits.hxx" -#include "MCType.hxx" using namespace MEDCoupling; diff --git a/src/MEDCoupling/MEDCouplingTraits.hxx b/src/MEDCoupling/MEDCouplingTraits.hxx index 1a4381179..7602cbfd6 100644 --- a/src/MEDCoupling/MEDCouplingTraits.hxx +++ b/src/MEDCoupling/MEDCouplingTraits.hxx @@ -22,6 +22,7 @@ #include "MEDCoupling.hxx" #include "MCType.hxx" +#include namespace MEDCoupling { diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx old mode 100644 new mode 100755 index 853a68b5c..5f7cccd60 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -18,30 +18,19 @@ // // Author : Anthony Geay (EDF R&D) -#include "InterpKernelHashMap.hxx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" -#include "InterpKernelException.hxx" -#include "InterpKernelGeo2DPrecision.hxx" +#include "MEDCouplingUMesh.txx" #include "MEDCouplingCMesh.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingPointSet.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingMemArray.txx" #include "MEDCouplingSkyLineArray.hxx" #include "CellModel.hxx" -#include "MEDCouplingUMesh.txx" -#include "NormalizedGeometricTypes" -#include "NormalizedUnstructuredMesh.hxx" -#include "VolSurfFormulae.hxx" -#include "MEDCouplingTraits.hxx" #include "VolSurfUser.txx" #include "InterpolationUtils.hxx" +#include "PointLocatorAlgos.txx" +#include "BBTree.txx" #include "BBTreeDst.txx" -#include "SplitterTetra.txx" +#include "SplitterTetra.hxx" +#include "DiameterCalculator.hxx" #include "DirectedBoundingBox.hxx" #include "InterpKernelMatrixTools.hxx" #include "InterpKernelMeshQuality.hxx" @@ -49,30 +38,19 @@ #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelAutoPtr.hxx" #include "InterpKernelGeo2DNode.hxx" +#include "InterpKernelGeo2DEdgeLin.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" -#include "MEDCouplingUMesh_internal.hxx" #include "OrientationInverter.hxx" -#include "DiameterCalculator.hxx" +#include "MEDCouplingUMesh_internal.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include #include +#include #include #include -#include -#include -#include +#include using namespace MEDCoupling; @@ -90,7 +68,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::New() MEDCouplingUMesh *MEDCouplingUMesh::New(const std::string& meshName, int meshDim) { - auto *ret=new MEDCouplingUMesh; + MEDCouplingUMesh *ret=new MEDCouplingUMesh; ret->setName(meshName); ret->setMeshDimension(meshDim); return ret; @@ -140,16 +118,16 @@ void MEDCouplingUMesh::shallowCopyConnectivityFrom(const MEDCouplingPointSet *ot { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::shallowCopyConnectivityFrom : input pointer is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCouplingUMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::shallowCopyConnectivityFrom : input pointer is not an MEDCouplingUMesh instance !"); - auto *otherC2=const_cast(otherC);//sorry :( + MEDCouplingUMesh *otherC2=const_cast(otherC);//sorry :( setConnectivity(otherC2->getNodalConnectivity(),otherC2->getNodalConnectivityIndex(),true); } std::size_t MEDCouplingUMesh::getHeapMemorySizeWithoutChildren() const { - std::size_t const ret(MEDCouplingPointSet::getHeapMemorySizeWithoutChildren()); + std::size_t ret(MEDCouplingPointSet::getHeapMemorySizeWithoutChildren()); return ret; } @@ -174,7 +152,7 @@ void MEDCouplingUMesh::updateTime() const } } -MEDCouplingUMesh::MEDCouplingUMesh():_mesh_dim(-2),_nodal_connec(nullptr),_nodal_connec_index(nullptr) +MEDCouplingUMesh::MEDCouplingUMesh():_mesh_dim(-2),_nodal_connec(0),_nodal_connec_index(0) { } @@ -197,12 +175,12 @@ void MEDCouplingUMesh::checkConsistencyLight() const throw INTERP_KERNEL::Exception("No mesh dimension specified !"); if(_mesh_dim!=-1) MEDCouplingPointSet::checkConsistencyLight(); - for(auto _type : _types) + for(std::set::const_iterator iter=_types.begin();iter!=_types.end();iter++) { - if(ToIdType(INTERP_KERNEL::CellModel::GetCellModel(_type).getDimension())!=_mesh_dim) + if(ToIdType(INTERP_KERNEL::CellModel::GetCellModel(*iter).getDimension())!=_mesh_dim) { std::ostringstream message; - message << "Mesh invalid because dimension is " << _mesh_dim << " and there is presence of cell(s) with type " << _type; + message << "Mesh invalid because dimension is " << _mesh_dim << " and there is presence of cell(s) with type " << (*iter); throw INTERP_KERNEL::Exception(message.str().c_str()); } } @@ -248,14 +226,14 @@ void MEDCouplingUMesh::checkConsistencyLight() const * \throw If number of nodes defining an element does not correspond to the type of element. * \throw If the nodal connectivity includes an invalid node id. */ -void MEDCouplingUMesh::checkConsistency(double /*eps*/) const +void MEDCouplingUMesh::checkConsistency(double eps) const { checkConsistencyLight(); if(_mesh_dim==-1) return ; - int const meshDim=getMeshDimension(); - mcIdType const nbOfNodes=getNumberOfNodes(); - mcIdType const nbOfCells=getNumberOfCells(); + int meshDim=getMeshDimension(); + mcIdType nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *ptr=_nodal_connec->getConstPointer(); const mcIdType *ptrI=_nodal_connec_index->getConstPointer(); for(mcIdType i=0;i=0) { if(nodeId>=nbOfNodes) @@ -325,7 +303,7 @@ void MEDCouplingUMesh::checkGeomConsistency(double eps) const const mcIdType *ptr(_nodal_connec->begin()),*ptrI(_nodal_connec_index->begin()); for(auto icell = 0 ; icell < nbOfCells ; ++icell) { - std::set const s(ptr+ptrI[icell]+1,ptr+ptrI[icell+1]); + std::set s(ptr+ptrI[icell]+1,ptr+ptrI[icell+1]); if(ToIdType(s.size())==ptrI[icell+1]-ptrI[icell]-1) continue; std::ostringstream oss; oss << "MEDCouplingUMesh::checkGeomConsistency : for cell #" << icell << " presence of multiple same nodeID !"; @@ -398,7 +376,7 @@ void MEDCouplingUMesh::allocateCells(mcIdType nbOfCells) void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, const mcIdType *nodalConnOfCell) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); - if(_nodal_connec_index==nullptr) + if(_nodal_connec_index==0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::insertNextCell : nodal connectivity not set ! invoke allocateCells before calling insertNextCell !"); if(ToIdType(cm.getDimension())==_mesh_dim) { @@ -409,8 +387,8 @@ void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, mc oss << " ! Expecting " << cm.getNumberOfNodes() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } - mcIdType const idx=_nodal_connec_index->back(); - mcIdType const val=idx+size+1; + mcIdType idx=_nodal_connec_index->back(); + mcIdType val=idx+size+1; _nodal_connec_index->pushBackSilent(val); _nodal_connec->writeOnPlace(idx,type,nodalConnOfCell,size); _types.insert(type); @@ -488,7 +466,7 @@ std::vector MEDCouplingUMesh::getAllGeoTypesS { std::vector ret; checkConnectivityFullyDefined(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(nbOfCells==0) return ret; if(getNodalConnectivityArrayLen()<1) @@ -510,7 +488,7 @@ bool MEDCouplingUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec if(!other) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isEqualIfNotWhy : input other pointer is null !"); std::ostringstream oss; oss.precision(15); - const auto *otherC=dynamic_cast(other); + const MEDCouplingUMesh *otherC=dynamic_cast(other); if(!otherC) { reason="mesh given in input is not castable in MEDCouplingUMesh !"; @@ -527,16 +505,16 @@ bool MEDCouplingUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec if(_types!=otherC->_types) { oss << "umesh geometric type mismatch :\nThis geometric types are :"; - for(auto _type : _types) - { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); oss << cm.getRepr() << ", "; } + for(std::set::const_iterator iter=_types.begin();iter!=_types.end();iter++) + { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*iter); oss << cm.getRepr() << ", "; } oss << "\nOther geometric types are :"; - for(auto _type : otherC->_types) - { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); oss << cm.getRepr() << ", "; } + for(std::set::const_iterator iter=otherC->_types.begin();iter!=otherC->_types.end();iter++) + { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*iter); oss << cm.getRepr() << ", "; } reason=oss.str(); return false; } - if(_nodal_connec!=nullptr || otherC->_nodal_connec!=nullptr) - if(_nodal_connec==nullptr || otherC->_nodal_connec==nullptr) + if(_nodal_connec!=0 || otherC->_nodal_connec!=0) + if(_nodal_connec==0 || otherC->_nodal_connec==0) { reason="Only one UMesh between the two this and other has its nodal connectivity DataArrayInt defined !"; return false; @@ -547,8 +525,8 @@ bool MEDCouplingUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec reason.insert(0,"Nodal connectivity DataArrayInt differ : "); return false; } - if(_nodal_connec_index!=nullptr || otherC->_nodal_connec_index!=nullptr) - if(_nodal_connec_index==nullptr || otherC->_nodal_connec_index==nullptr) + if(_nodal_connec_index!=0 || otherC->_nodal_connec_index!=0) + if(_nodal_connec_index==0 || otherC->_nodal_connec_index==0) { reason="Only one UMesh between the two this and other has its nodal connectivity index DataArrayInt defined !"; return false; @@ -572,7 +550,7 @@ bool MEDCouplingUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec */ bool MEDCouplingUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const { - const auto *otherC=dynamic_cast(other); + const MEDCouplingUMesh *otherC=dynamic_cast(other); if(!otherC) return false; if(!MEDCouplingPointSet::isEqualWithoutConsideringStr(other,prec)) @@ -581,14 +559,14 @@ bool MEDCouplingUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other return false; if(_types!=otherC->_types) return false; - if(_nodal_connec!=nullptr || otherC->_nodal_connec!=nullptr) - if(_nodal_connec==nullptr || otherC->_nodal_connec==nullptr) + if(_nodal_connec!=0 || otherC->_nodal_connec!=0) + if(_nodal_connec==0 || otherC->_nodal_connec==0) return false; if(_nodal_connec!=otherC->_nodal_connec) if(!_nodal_connec->isEqualWithoutConsideringStr(*otherC->_nodal_connec)) return false; - if(_nodal_connec_index!=nullptr || otherC->_nodal_connec_index!=nullptr) - if(_nodal_connec_index==nullptr || otherC->_nodal_connec_index==nullptr) + if(_nodal_connec_index!=0 || otherC->_nodal_connec_index!=0) + if(_nodal_connec_index==0 || otherC->_nodal_connec_index==0) return false; if(_nodal_connec_index!=otherC->_nodal_connec_index) if(!_nodal_connec_index->isEqualWithoutConsideringStr(*otherC->_nodal_connec_index)) @@ -609,7 +587,7 @@ bool MEDCouplingUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other void MEDCouplingUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const { MEDCouplingPointSet::checkFastEquivalWith(other,prec); - const auto *otherC=dynamic_cast(other); + const MEDCouplingUMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkFastEquivalWith : Two meshes are not not unstructured !"); } @@ -640,8 +618,8 @@ void MEDCouplingUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const { checkFullyDefined(); - mcIdType const nbOfNodes(getNumberOfNodes()); - auto *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType)); + mcIdType nbOfNodes(getNumberOfNodes()); + mcIdType *revNodalIndxPtr=(mcIdType *)malloc((nbOfNodes+1)*sizeof(mcIdType)); revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1); std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0); const mcIdType *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin()); @@ -657,7 +635,7 @@ void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, Da } } std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); - auto *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType)); + mcIdType *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType)); revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1); std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1); for(mcIdType eltId=0;eltId MEDCouplingUMesh::explodeMeshTo(int targetDeltaLevel, M if( targetDeltaLevel == -1 ) { desc = DataArrayIdType::New(); descIndx = DataArrayIdType::New(); revDesc = DataArrayIdType::New(); revDescIndx = DataArrayIdType::New(); - MCAuto const ret( this->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx) ); + MCAuto ret( this->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx) ); return ret; } if( targetDeltaLevel == -2 && this->getMeshDimension() == 3 ) { desc = DataArrayIdType::New(); descIndx = DataArrayIdType::New(); revDesc = DataArrayIdType::New(); revDescIndx = DataArrayIdType::New(); - MCAuto const ret( this->explode3DMeshTo1D(desc,descIndx,revDesc,revDescIndx) ); + MCAuto ret( this->explode3DMeshTo1D(desc,descIndx,revDesc,revDescIndx) ); return ret; } if( targetDeltaLevel == -this->getMeshDimension() ) { - MCAuto const ret = MEDCouplingUMesh::Build0DMeshFromCoords( const_cast( this->getCoords() ) ); + MCAuto ret = MEDCouplingUMesh::Build0DMeshFromCoords( const_cast( this->getCoords() ) ); MEDCouplingUMesh::DeleteCellTypeInIndexedArray(getNodalConnectivity(),getNodalConnectivityIndex(),desc,descIndx); revDesc = DataArrayIdType::New(); revDescIndx = DataArrayIdType::New(); this->getReverseNodalConnectivity(revDesc,revDescIndx); @@ -871,7 +849,7 @@ void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayIdType *&neighbors, Data MCAuto revDesc=DataArrayIdType::New(); MCAuto revDescIndx=DataArrayIdType::New(); MCAuto meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - meshDM1=nullptr; + meshDM1=0; ComputeNeighborsOfCellsAdv(desc,descIndx,revDesc,revDescIndx,neighbors,neighborsIndx); } @@ -900,7 +878,7 @@ void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayIdType nodeNeigh->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh"); nodeNeighI->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh index"); nodeNeighI->checkNbOfTuples(1+getNumberOfNodes(),"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : invalid length"); - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); const mcIdType *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()),*ne(nodeNeigh->begin()),*nei(nodeNeighI->begin()); cellNeigh=DataArrayIdType::New(); cellNeigh->alloc(0,1); cellNeighIndex=DataArrayIdType::New(); cellNeighIndex->alloc(1,1); cellNeighIndex->setIJ(0,0,0); for(mcIdType i=0;ibegin(); const mcIdType *revDescIPtr=revDescIndx->begin(); // - mcIdType const nbCells=descIndx->getNumberOfTuples()-1; + mcIdType nbCells=descIndx->getNumberOfTuples()-1; MCAuto out0=DataArrayIdType::New(); MCAuto out1=DataArrayIdType::New(); out1->alloc(nbCells+1,1); mcIdType *out1Ptr=out1->getPointer(); @@ -971,7 +949,7 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, c MCAuto MEDCouplingUMesh::explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& revDescIndx) const { checkFullyDefined(); - int const mdim(getMeshDimension()); + int mdim(getMeshDimension()); desc=DataArrayIdType::New(); descIndex=DataArrayIdType::New(); revDesc=DataArrayIdType::New(); revDescIndx=DataArrayIdType::New(); MCAuto mesh1D; switch(mdim) @@ -1039,7 +1017,7 @@ void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayIdType *&neighbors, Data throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computeNeighborsOfNodes : Mesh dimension supported are [3,2,1] !"); } } - desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=nullptr; revDescIndx=nullptr; + desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=0; revDescIndx=0; mesh1D->getReverseNodalConnectivity(desc,descIndx); MCAuto ret0(DataArrayIdType::New()); ret0->alloc(desc->getNumberOfTuples(),1); @@ -1064,15 +1042,15 @@ void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayIdType *&neighbors, Data void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto &neighbors, MCAuto& neighborsIdx) const { checkFullyDefined(); - mcIdType const nbOfNodes(getNumberOfNodes()); + mcIdType nbOfNodes(getNumberOfNodes()); const mcIdType *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin()); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); std::vector< std::set > st0(nbOfNodes); for(mcIdType eltId=0;eltId s(strtNdlConnOfCurCell,endNdlConnOfCurCell); s.erase(-1); //for polyhedrons - for(auto iter2=s.begin();iter2!=s.end();iter2++) + for(std::set::const_iterator iter2=s.begin();iter2!=s.end();iter2++) st0[*iter2].insert(s.begin(),s.end()); } neighborsIdx=DataArrayIdType::New(); neighborsIdx->alloc(nbOfNodes+1,1); neighborsIdx->setIJ(0,0,0); @@ -1124,10 +1102,10 @@ void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto & void MEDCouplingUMesh::convertToPolyTypes(const mcIdType *cellIdsToConvertBg, const mcIdType *cellIdsToConvertEnd) { checkFullyDefined(); - int const dim=getMeshDimension(); + int dim=getMeshDimension(); if(dim<2 || dim>3) throw INTERP_KERNEL::Exception("Invalid mesh dimension : must be 2 or 3 !"); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(dim==2) { const mcIdType *connIndex=_nodal_connec_index->begin(); @@ -1170,21 +1148,21 @@ void MEDCouplingUMesh::convertToPolyTypes(const mcIdType *cellIdsToConvertBg, co for(mcIdType cellId=0;cellIdpushBackValsSilent(tmp,tmp+newLgth); connNewI->pushBackSilent(connNewI->back()+ToIdType(newLgth)); delete [] tmp; @@ -1212,7 +1190,7 @@ void MEDCouplingUMesh::convertToPolyTypes(const mcIdType *cellIdsToConvertBg, co */ void MEDCouplingUMesh::convertAllToPoly() { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); std::vector cellIds(nbOfCells); for(mcIdType i=0;i newCi=DataArrayIdType::New(); newCi->alloc(nbOfCells+1,1); mcIdType *newci=newCi->getPointer(); @@ -1260,7 +1238,7 @@ void MEDCouplingUMesh::convertExtrudedPolyhedra() newci[0]=0; for(mcIdType i=0;igetPointer(); for(mcIdType i=0;igetPointer(); mcIdType *index=_nodal_connec_index->getPointer(); mcIdType posOfCurCell=0; @@ -1345,7 +1323,7 @@ bool MEDCouplingUMesh::unPolyze() for(mcIdType i=0;i coords=getCoords()->deepCopy(); coords->recenterForMaxPrecision(eps); // - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *conn=_nodal_connec->getConstPointer(); const mcIdType *index=_nodal_connec_index->getConstPointer(); MCAuto connINew=DataArrayIdType::New(); @@ -1457,7 +1435,7 @@ void MEDCouplingUMesh::colinearizeEdges(double eps) checkFullyDefined(); if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearizeEdges() : works with meshdim=3 and spaceDim=3!"); - double const seps = sqrt(1-eps); + double seps = sqrt(1-eps); // Computing connectivities and correspondances : elements -> segments -> points DAI E_Fi(DataArrayIdType::New()), E_F(DataArrayIdType::New()), F_Ei(DataArrayIdType::New()), F_E(DataArrayIdType::New()), F_Si(DataArrayIdType::New()), F_S(DataArrayIdType::New()), S_Fi(DataArrayIdType::New()), S_F(DataArrayIdType::New()), @@ -1469,7 +1447,7 @@ void MEDCouplingUMesh::colinearizeEdges(double eps) std::set pt_rem; const mcIdType *m_pi = m_p->getNodalConnectivityIndex()->begin(), *m_pc = m_p->getNodalConnectivity()->begin(); - auto *coord = (double (*)[3]) getCoords()->begin(); + double (*coord)[3] = (double (*)[3]) getCoords()->begin(); // Find all points only connected to exaclty 2 segments - they are the candidates for elimination // Note that in 3D this can only happen for polyhedrons (when this happens at all) DAI dsi = P_Si->deltaShiftIndex(); @@ -1481,9 +1459,9 @@ void MEDCouplingUMesh::colinearizeEdges(double eps) for (mcIdType j = 0; j < 2; j++) for (mcIdType k = 0; k < 2; k++) { - mcIdType const off1 = P_Sip[i] + j; // offset to get ID of the j-th seg (around the i-th point) in the point->seg correspondance - mcIdType const pt_id = P_Sp[off1] + k; // ID of the k-th point of the j-th seg in the point->seg correspondance - mcIdType const pt_id2 = S_Pp[S_Pip[pt_id]]; // ID of the point in the point mesh + mcIdType off1 = P_Sip[i] + j; // offset to get ID of the j-th seg (around the i-th point) in the point->seg correspondance + mcIdType pt_id = P_Sp[off1] + k; // ID of the k-th point of the j-th seg in the point->seg correspondance + mcIdType pt_id2 = S_Pp[S_Pip[pt_id]]; // ID of the point in the point mesh p[j][k] = m_pc[m_pi[pt_id2] + 1]; // Absolute ID, as read from the connectvity (+1 to skip type: NORM_POINT1) // Just for fun, as initially written by Antoine :-) // p[j][k] = m_pc[m_pi[S_P->getIJ(S_Pi->getIJ(P_S->getIJ(P_Si->getIJ(i, 0) + j, 0), 0) + k, 0)] + 1]; @@ -1528,7 +1506,7 @@ DataArrayIdType *MEDCouplingUMesh::computeFetchedNodeIds() const { checkConnectivityFullyDefined(); const mcIdType *maxEltPt(std::max_element(_nodal_connec->begin(),_nodal_connec->end())); - mcIdType const maxElt(maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1); + mcIdType maxElt(maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1); std::vector retS(maxElt,false); computeNodeIdsAlg(retS); return DataArrayIdType::BuildListOfSwitchedOn(retS); @@ -1561,9 +1539,9 @@ void MEDCouplingUMesh::computeNodeIdsAlg(std::vector& nodeIdsInUse) const struct MEDCouplingAccVisit { - MEDCouplingAccVisit() = default; + MEDCouplingAccVisit():_new_nb_of_nodes(0) { } mcIdType operator()(mcIdType val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; } - mcIdType _new_nb_of_nodes{0}; + mcIdType _new_nb_of_nodes; }; /// @endcond @@ -1590,12 +1568,12 @@ struct MEDCouplingAccVisit DataArrayIdType *MEDCouplingUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const { nbrOfNodesInUse=-1; - mcIdType const nbOfNodes(getNumberOfNodes()); + mcIdType nbOfNodes(getNumberOfNodes()); MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfNodes,1); mcIdType *traducer=ret->getPointer(); std::fill(traducer,traducer+nbOfNodes,-1); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *connIndex=_nodal_connec_index->getConstPointer(); const mcIdType *conn=_nodal_connec->getConstPointer(); for(mcIdType i=0;i ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); mcIdType *retPtr=ret->getPointer(); @@ -1653,7 +1631,7 @@ DataArrayIdType *MEDCouplingUMesh::computeNbOfNodesPerCell() const DataArrayIdType *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const { checkConnectivityFullyDefined(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); mcIdType *retPtr=ret->getPointer(); @@ -1682,7 +1660,7 @@ DataArrayIdType *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const DataArrayIdType *MEDCouplingUMesh::computeNbOfFacesPerCell() const { checkConnectivityFullyDefined(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); mcIdType *retPtr=ret->getPointer(); @@ -1755,18 +1733,18 @@ int MEDCouplingUMesh::AreCellsEqualPolicy0(const mcIdType *conn, const mcIdType */ int MEDCouplingUMesh::AreCellsEqualPolicy1(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2) { - mcIdType const sz=connI[cell1+1]-connI[cell1]; + mcIdType sz=connI[cell1+1]-connI[cell1]; if(sz==connI[cell2+1]-connI[cell2]) { if(conn[connI[cell1]]==conn[connI[cell2]]) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[cell1]]); - unsigned const dim=cm.getDimension(); + unsigned dim=cm.getDimension(); if(dim!=3) { if(dim!=1) { - mcIdType const sz1=2*(sz-1); + mcIdType sz1=2*(sz-1); INTERP_KERNEL::AutoPtr tmp=new mcIdType[sz1]; mcIdType *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(mcIdType *)tmp); std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],work); @@ -1792,8 +1770,8 @@ int MEDCouplingUMesh::AreCellsEqualPolicy2(const mcIdType *conn, const mcIdType { if(conn[connI[cell1]]==conn[connI[cell2]]) { - std::set const s1(conn+connI[cell1]+1,conn+connI[cell1+1]); - std::set const s2(conn+connI[cell2]+1,conn+connI[cell2+1]); + std::set s1(conn+connI[cell1]+1,conn+connI[cell1+1]); + std::set s2(conn+connI[cell2]+1,conn+connI[cell2+1]); return s1==s2?1:0; } } @@ -1807,8 +1785,8 @@ int MEDCouplingUMesh::AreCellsEqualPolicy2NoType(const mcIdType *conn, const mcI { if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2]) { - std::set const s1(conn+connI[cell1]+1,conn+connI[cell1+1]); - std::set const s2(conn+connI[cell2]+1,conn+connI[cell2+1]); + std::set s1(conn+connI[cell1]+1,conn+connI[cell1+1]); + std::set s2(conn+connI[cell2]+1,conn+connI[cell2+1]); return s1==s2?1:0; } return 0; @@ -1819,18 +1797,18 @@ int MEDCouplingUMesh::AreCellsEqualPolicy2NoType(const mcIdType *conn, const mcI */ int MEDCouplingUMesh::AreCellsEqualPolicy7(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2) { - mcIdType const sz=connI[cell1+1]-connI[cell1]; + mcIdType sz=connI[cell1+1]-connI[cell1]; if(sz==connI[cell2+1]-connI[cell2]) { if(conn[connI[cell1]]==conn[connI[cell2]]) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[cell1]]); - unsigned const dim=cm.getDimension(); + unsigned dim=cm.getDimension(); if(dim!=3) { if(dim!=1) { - mcIdType const sz1=2*(sz-1); + mcIdType sz1=2*(sz-1); INTERP_KERNEL::AutoPtr tmp=new mcIdType[sz1]; mcIdType *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(mcIdType *)tmp); std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],work); @@ -1839,8 +1817,8 @@ int MEDCouplingUMesh::AreCellsEqualPolicy7(const mcIdType *conn, const mcIdType return 1; else { - std::reverse_iterator const it1((mcIdType *)tmp+sz1); - std::reverse_iterator const it2((mcIdType *)tmp); + std::reverse_iterator it1((mcIdType *)tmp+sz1); + std::reverse_iterator it2((mcIdType *)tmp); if(std::search(it1,it2,conn+connI[cell2]+1,conn+connI[cell2+1])!=it2) return 2; else @@ -1853,8 +1831,8 @@ int MEDCouplingUMesh::AreCellsEqualPolicy7(const mcIdType *conn, const mcIdType return 1; if(!cm.isQuadratic()) { - std::reverse_iterator const it1(conn+connI[cell1+1]); - std::reverse_iterator const it2(conn+connI[cell1]+1); + std::reverse_iterator it1(conn+connI[cell1+1]); + std::reverse_iterator it2(conn+connI[cell1]+1); if(std::equal(it1,it2,conn+connI[cell2]+1)) return 2; return 0; @@ -1904,7 +1882,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, mcIdType startCellId, co DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) { MCAuto commonCells=DataArrayIdType::New(),commonCellsI=DataArrayIdType::New(); commonCells->alloc(0,1); - mcIdType const nbOfCells=nodalI->getNumberOfTuples()-1; + mcIdType nbOfCells=nodalI->getNumberOfTuples()-1; commonCellsI->reserve(1); commonCellsI->pushBackSilent(0); const mcIdType *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer(); const mcIdType *connPtr=nodal->getConstPointer(),*connIPtr=nodalI->getConstPointer(); @@ -1928,14 +1906,14 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, mcIdType startCellId, co { v=v2; const mcIdType *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i); - auto const it=std::set_intersection(v.begin(),v.end(),locRevNodal,revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin()); + std::vector::iterator it=std::set_intersection(v.begin(),v.end(),locRevNodal,revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin()); v2.resize(std::distance(v2.begin(),it)); } if(v2.size()>1) { if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells)) { - mcIdType const pos=commonCellsI->back(); + mcIdType pos=commonCellsI->back(); commonCellsI->pushBackSilent(commonCells->getNumberOfTuples()); for(const mcIdType *it=commonCells->begin()+pos;it!=commonCells->end();it++) isFetched[*it]=true; @@ -1962,7 +1940,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, mcIdType startCellId, co if(*connOfNode>=0) { v=v2; - auto const it=std::set_intersection(v.begin(),v.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin()); + std::vector::iterator it=std::set_intersection(v.begin(),v.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin()); v2.resize(std::distance(v2.begin(),it)); } // v2 contains now candidates. Problem candidates are sorted using id rank. @@ -1975,8 +1953,8 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, mcIdType startCellId, co } if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells)) { - mcIdType const newPos(commonCells->getNumberOfTuples()); - mcIdType const pos(commonCellsI->back()); + mcIdType newPos(commonCells->getNumberOfTuples()); + mcIdType pos(commonCellsI->back()); std::sort(commonCells->getPointerSilent()+pos,commonCells->getPointerSilent()+newPos); commonCellsI->pushBackSilent(newPos); for(const mcIdType *it=commonCells->begin()+pos;it!=commonCells->end();it++) @@ -2017,7 +1995,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, mcIdType startCellId, co bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayIdType *& arr) const { MCAuto mesh=MergeUMeshesOnSameCoords(this,other); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); static const int possibleCompType[]={0,1,2}; if(std::find(possibleCompType,possibleCompType+sizeof(possibleCompType)/sizeof(int),compType)==possibleCompType+sizeof(possibleCompType)/sizeof(int)) { @@ -2038,8 +2016,8 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com mcIdType newNbOfCells=-1; MCAuto o2n = DataArrayIdType::ConvertIndexArrayToO2N(ToIdType(mesh->getNumberOfCells()),commonCells->begin(),commonCellsI->begin(),commonCellsI->end(),newNbOfCells); MCAuto p0(o2n->selectByTupleIdSafeSlice(0,nbOfCells,1)); - mcIdType const maxPart(p0->getMaxValueInArray()); - bool const ret(maxPart==newNbOfCells-1); + mcIdType maxPart(p0->getMaxValueInArray()); + bool ret(maxPart==newNbOfCells-1); MCAuto p1(p0->invertArrayO2N2N2O(newNbOfCells)); // fill p1 array in case of presence of cells in other not in this mcIdType *pt(p1->getPointer()); @@ -2065,26 +2043,26 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com bool MEDCouplingUMesh::areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayIdType *& arr) const { MCAuto mesh=MergeUMeshesOnSameCoords(this,other); - DataArrayIdType *commonCells=nullptr,*commonCellsI=nullptr; - mcIdType const thisNbCells=getNumberOfCells(); + DataArrayIdType *commonCells=0,*commonCellsI=0; + mcIdType thisNbCells=getNumberOfCells(); mesh->findCommonCells(7,thisNbCells,commonCells,commonCellsI); MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); const mcIdType *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer(); - mcIdType const otherNbCells=other->getNumberOfCells(); + mcIdType otherNbCells=other->getNumberOfCells(); MCAuto arr2=DataArrayIdType::New(); arr2->alloc(otherNbCells,1); arr2->fillWithZero(); mcIdType *arr2Ptr=arr2->getPointer(); - mcIdType const nbOfCommon=commonCellsI->getNumberOfTuples()-1; + mcIdType nbOfCommon=commonCellsI->getNumberOfTuples()-1; for(mcIdType i=0;i0?1:-1; - mcIdType const val=std::abs(commonCellsPtr[j])-1; + mcIdType sig=commonCellsPtr[j]>0?1:-1; + mcIdType val=std::abs(commonCellsPtr[j])-1; if(val>=thisNbCells) arr2Ptr[val-thisNbCells]=sig*(start+1); } @@ -2101,7 +2079,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::mergeMyselfWithOnSameCoords(const MEDCouplin { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::mergeMyselfWithOnSameCoords : input other is null !"); - const auto *otherC=dynamic_cast(other); + const MEDCouplingUMesh *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::mergeMyselfWithOnSameCoords : the input other mesh is not of type unstructured !"); std::vector ms(2); @@ -2130,7 +2108,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfSlice(mcIdType start, mcIdT return static_cast(MEDCouplingPointSet::buildPartOfMySelfSlice(start,end,step,keepCoords)); else { - mcIdType const newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfSlice for -1 dimension mesh "); + mcIdType newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfSlice for -1 dimension mesh "); if(newNbOfCells!=1) throw INTERP_KERNEL::Exception("-1D mesh has only one cell !"); if(start!=0) @@ -2202,13 +2180,13 @@ void MEDCouplingUMesh::setPartOfMySelf(const mcIdType *cellIdsBg, const mcIdType oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } - mcIdType const nbOfCellsToModify( ToIdType((std::distance(cellIdsBg,cellIdsEnd)))); + mcIdType nbOfCellsToModify( ToIdType((std::distance(cellIdsBg,cellIdsEnd)))); if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells()) { std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !"; throw INTERP_KERNEL::Exception(oss.str()); } - mcIdType const nbOfCells(getNumberOfCells()); + mcIdType nbOfCells(getNumberOfCells()); bool easyAssign(true); const mcIdType *connI(_nodal_connec_index->begin()); const mcIdType *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->begin(); @@ -2231,7 +2209,7 @@ void MEDCouplingUMesh::setPartOfMySelf(const mcIdType *cellIdsBg, const mcIdType } else { - DataArrayIdType *arrOut=nullptr,*arrIOut=nullptr; + DataArrayIdType *arrOut=0,*arrIOut=0; DataArrayIdType::SetPartOfIndexedArrays(cellIdsBg,cellIdsEnd,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index, arrOut,arrIOut); MCAuto arrOutAuto(arrOut),arrIOutAuto(arrIOut); @@ -2251,13 +2229,13 @@ void MEDCouplingUMesh::setPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdTy oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } - mcIdType const nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : "); + mcIdType nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : "); if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells()) { std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !"; throw INTERP_KERNEL::Exception(oss.str()); } - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); bool easyAssign=true; const mcIdType *connI=_nodal_connec_index->getConstPointer(); const mcIdType *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer(); @@ -2281,7 +2259,7 @@ void MEDCouplingUMesh::setPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdTy } else { - DataArrayIdType *arrOut=nullptr,*arrIOut=nullptr; + DataArrayIdType *arrOut=0,*arrIOut=0; DataArrayIdType::SetPartOfIndexedArraysSlice(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index, arrOut,arrIOut); MCAuto arrOutAuto(arrOut),arrIOutAuto(arrIOut); @@ -2319,7 +2297,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildFacePartOfMySelfNode(const mcIdType *be MCAuto desc,descIndx,revDesc,revDescIndx; desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=DataArrayIdType::New(); revDescIndx=DataArrayIdType::New(); MCAuto subMesh=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - desc=nullptr; descIndx=nullptr; revDesc=nullptr; revDescIndx=nullptr; + desc=0; descIndx=0; revDesc=0; revDescIndx=0; return static_cast(subMesh->buildPartOfMySelfNode(begin,end,fullyIn)); } @@ -2350,7 +2328,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const revDesc->decrRef(); desc->decrRef(); descIndx->decrRef(); - mcIdType const nbOfCells=meshDM1->getNumberOfCells(); + mcIdType nbOfCells=meshDM1->getNumberOfCells(); const mcIdType *revDescIndxC=revDescIndx->getConstPointer(); std::vector boundaryCells; for(mcIdType i=0;i desc(DataArrayIdType::New()), descIndx(DataArrayIdType::New()), revDesc(DataArrayIdType::New()), revDescIndx(DataArrayIdType::New()); // buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)->decrRef(); - desc=(DataArrayIdType*)nullptr; descIndx=(DataArrayIdType*)nullptr; + desc=(DataArrayIdType*)0; descIndx=(DataArrayIdType*)0; // MCAuto tmp=revDescIndx->deltaShiftIndex(); - MCAuto faceIds=tmp->findIdsEqual(1); tmp=(DataArrayIdType*)nullptr; + MCAuto faceIds=tmp->findIdsEqual(1); tmp=(DataArrayIdType*)0; const mcIdType *revDescPtr=revDesc->getConstPointer(); const mcIdType *revDescIndxPtr=revDescIndx->getConstPointer(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); std::vector ret1(nbOfCells,false); mcIdType sz=0; - for(long const pt : *faceIds) - if(!ret1[revDescPtr[revDescIndxPtr[pt]]]) - { ret1[revDescPtr[revDescIndxPtr[pt]]]=true; sz++; } + for(const mcIdType *pt=faceIds->begin();pt!=faceIds->end();pt++) + if(!ret1[revDescPtr[revDescIndxPtr[*pt]]]) + { ret1[revDescPtr[revDescIndxPtr[*pt]]]=true; sz++; } // ret2->alloc(sz,1); mcIdType *ret2Ptr=ret2->getPointer(); @@ -2435,14 +2413,14 @@ void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSa MCAuto descThisPart=DataArrayIdType::New(),descIThisPart=DataArrayIdType::New(),revDescThisPart=DataArrayIdType::New(),revDescIThisPart=DataArrayIdType::New(); MCAuto thisPartConsti=thisPart->buildDescendingConnectivity(descThisPart,descIThisPart,revDescThisPart,revDescIThisPart); const mcIdType *revDescThisPartPtr=revDescThisPart->getConstPointer(),*revDescIThisPartPtr=revDescIThisPart->getConstPointer(); - DataArrayIdType *idsOtherInConsti=nullptr; - bool const b=thisPartConsti->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsOtherInConsti); - MCAuto const idsOtherInConstiAuto(idsOtherInConsti); + DataArrayIdType *idsOtherInConsti=0; + bool b=thisPartConsti->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsOtherInConsti); + MCAuto idsOtherInConstiAuto(idsOtherInConsti); if(!b) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : the given mdim-1 mesh in other is not a constituent of this !"); std::set s1; - for(long const idOther : *idsOtherInConsti) - s1.insert(revDescThisPartPtr+revDescIThisPartPtr[idOther],revDescThisPartPtr+revDescIThisPartPtr[idOther+1]); + for(const mcIdType *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++) + s1.insert(revDescThisPartPtr+revDescIThisPartPtr[*idOther],revDescThisPartPtr+revDescIThisPartPtr[*idOther+1]); MCAuto s1arr_renum1=DataArrayIdType::New(); s1arr_renum1->alloc(s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer()); s1arr_renum1->sort(); cellIdsRk0=s0arr.retn(); @@ -2464,7 +2442,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::computeSkin() const MCAuto revDescIndx=DataArrayIdType::New(); // MCAuto meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - revDesc=nullptr; desc=nullptr; descIndx=nullptr; + revDesc=0; desc=0; descIndx=0; MCAuto revDescIndx2=revDescIndx->deltaShiftIndex(); MCAuto part=revDescIndx2->findIdsEqual(1); return static_cast(meshDM1->buildPartOfMySelf(part->begin(),part->end(),true)); @@ -2539,11 +2517,11 @@ DataArrayIdType* MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& DAInt idsTmp0 = dsi->findIdsNotInRange(-1, 3); // for 2D: if a point is connected to more than 2 segs. For 3D: if a seg is connected to more than two faces. if(idsTmp0->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group: group is too complex: some points (or edges) have more than two connected segments (or faces)!"); - dt0=nullptr; dit0=nullptr; rdt0=nullptr; rdit0=nullptr; idsTmp0=nullptr; + dt0=0; dit0=0; rdt0=0; rdit0=0; idsTmp0=0; // Get extreme nodes from the group (they won't be duplicated except if they also lie on bound of M0 -- see below), // ie nodes belonging to the boundary "cells" (might be points) of M1 - DAInt const xtremIdsM2 = dsi->findIdsEqual(1); dsi = nullptr; + DAInt xtremIdsM2 = dsi->findIdsEqual(1); dsi = 0; MCUMesh meshM2Part = static_cast(meshM2->buildPartOfMySelf(xtremIdsM2->begin(), xtremIdsM2->end(),true)); DAInt xtrem = meshM2Part->computeFetchedNodeIds(); // Remove from the list points on the boundary of the M0 mesh (those need duplication!). @@ -2551,13 +2529,13 @@ DataArrayIdType* MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& // Think of a partial (plane) crack in a cube: the points at the tip of the crack and not located inside the volume of the cube are not duplicated // although they are technically on the skin of the cube. DAInt fNodes = m0skin->computeFetchedNodeIds(); - DAInt notDup = nullptr; + DAInt notDup = 0; if (getMeshDimension() == 3) { DAInt dnu1=DataArrayIdType::New(), dnu2=DataArrayIdType::New(), dnu3=DataArrayIdType::New(), dnu4=DataArrayIdType::New(); MCUMesh m0skinDesc = m0skin->buildDescendingConnectivity(dnu1, dnu2, dnu3, dnu4); // all segments of the skin of the 3D (M0) mesh - dnu1=nullptr;dnu2=nullptr;dnu3=nullptr;dnu4=nullptr; - DataArrayIdType * corresp=nullptr; + dnu1=0;dnu2=0;dnu3=0;dnu4=0; + DataArrayIdType * corresp=0; meshM2->areCellsIncludedIn(m0skinDesc,2,corresp); // validIds is the list of segments which are on both the skin of *this*, and in the segments of the M1 group // In the cube example above, this is a U-shaped polyline. @@ -2578,17 +2556,17 @@ DataArrayIdType* MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& // algorithm would be duplicating too much ... // This is a costly algorithm so only go into it if a simple (non sufficient) criteria is met: a node connected to more than 3 segs in meshM2: dnu1=DataArrayIdType::New(), dnu2=DataArrayIdType::New(), dnu3=DataArrayIdType::New(), rdit0=DataArrayIdType::New(); - MCUMesh const meshM2Desc = meshM2->buildDescendingConnectivity(dnu1, dnu2, dnu3, rdit0); // a mesh made of node cells - dnu1=nullptr;dnu2=nullptr;dnu3=nullptr; - dsi = rdit0->deltaShiftIndex(); rdit0=nullptr; - DAInt singPoints = dsi->findIdsNotInRange(-1,4) ; dsi=nullptr;// points connected to (strictly) more than 3 segments + MCUMesh meshM2Desc = meshM2->buildDescendingConnectivity(dnu1, dnu2, dnu3, rdit0); // a mesh made of node cells + dnu1=0;dnu2=0;dnu3=0; + dsi = rdit0->deltaShiftIndex(); rdit0=0; + DAInt singPoints = dsi->findIdsNotInRange(-1,4) ; dsi=0;// points connected to (strictly) more than 3 segments if (singPoints->getNumberOfTuples()) { DAInt boundNodes = m1IntersecSkin->computeFetchedNodeIds(); // If a point on this U-shape line is connected to cells which do not share any face with M1, then it // should not be duplicated // 1. Extract N D cells touching U-shape line: - DAInt const cellsAroundBN = getCellIdsLyingOnNodes(boundNodes->begin(), boundNodes->end(), false); // false= take cell in, even if not all nodes are in dupl + DAInt cellsAroundBN = getCellIdsLyingOnNodes(boundNodes->begin(), boundNodes->end(), false); // false= take cell in, even if not all nodes are in dupl MCUMesh mAroundBN = static_cast(this->buildPartOfMySelf(cellsAroundBN->begin(), cellsAroundBN->end(), true)); DAInt descBN=DataArrayIdType::New(), descIBN=DataArrayIdType::New(), revDescBN=DataArrayIdType::New(), revDescIBN=DataArrayIdType::New(); MCUMesh mAroundBNDesc = mAroundBN->buildDescendingConnectivity(descBN,descIBN,revDescBN,revDescIBN); @@ -2603,13 +2581,13 @@ DataArrayIdType* MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& { if (v >= nCellsDesc) // Keep valid match only continue; - mcIdType const idx0 = revDescIBNP[v]; + mcIdType idx0 = revDescIBNP[v]; // Keep the two cells on either side of the face v of M1: mcIdType c1=revDescBNP[idx0], c2=revDescBNP[idx0+1]; idsTouch->pushBackSilent(c1); idsTouch->pushBackSilent(c2); } // 3. Build complement - DAInt const idsTouchCompl = idsTouch->buildComplement(nCells); + DAInt idsTouchCompl = idsTouch->buildComplement(nCells); MCUMesh mAroundBNStrict = static_cast(mAroundBN->buildPartOfMySelf(idsTouchCompl->begin(), idsTouchCompl->end(), true)); DAInt nod3 = mAroundBNStrict->computeFetchedNodeIds(); DAInt inters = boundNodes->buildIntersection(nod3); @@ -2667,21 +2645,21 @@ void MEDCouplingUMesh::findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnS // Compute cell IDs of the mesh with cells that touch the M1 group with a least one node: DAInt cellsAroundGroupLarge = getCellIdsLyingOnNodes(nodeIdsToDuplicateBg, nodeIdsToDuplicateEnd, false); // false= take cell in, even if not all nodes are in dupl MCUMesh mAroundGrpLarge=static_cast(buildPartOfMySelf(cellsAroundGroupLarge->begin(),cellsAroundGroupLarge->end(),true)); - mcIdType const nCellsLarge=cellsAroundGroupLarge->getNumberOfTuples(); + mcIdType nCellsLarge=cellsAroundGroupLarge->getNumberOfTuples(); DAInt descL=DataArrayIdType::New(),descIL=DataArrayIdType::New(),revDescL=DataArrayIdType::New(),revDescIL=DataArrayIdType::New(); MCUMesh mArGrpLargeDesc=mAroundGrpLarge->buildDescendingConnectivity(descL,descIL,revDescL,revDescIL); const mcIdType *descILP=descIL->begin(), *descLP=descL->begin(); DataArrayIdType *idsOfM1t; mArGrpLargeDesc->areCellsIncludedIn(&otherDimM1OnSameCoords,2, idsOfM1t); DAInt idsOfM1Large(idsOfM1t); - mcIdType const nL = mArGrpLargeDesc->getNumberOfCells(); + mcIdType nL = mArGrpLargeDesc->getNumberOfCells(); // Computation of the neighbor information of the mesh WITH the crack (some neighbor links are removed): // In the neighbor information remove the connection between high dimension cells and its low level constituents which are part // of the frontier given in parameter (i.e. the cells of low dimension from the group delimiting the crack): DAInt descLTrunc = descL->deepCopy(), descILTrunc = descIL->deepCopy(); DataArrayIdType::RemoveIdsFromIndexedArrays(idsOfM1Large->begin(), idsOfM1Large->end(),descLTrunc,descILTrunc); - DataArrayIdType *neight=nullptr, *neighIt=nullptr; + DataArrayIdType *neight=0, *neighIt=0; MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(descLTrunc,descILTrunc,revDescL,revDescIL, neight, neighIt); DAInt neighL(neight), neighIL(neighIt); @@ -2694,7 +2672,7 @@ void MEDCouplingUMesh::findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnS for(const auto& v: *idsOfM1Large) { if (v >= nL) continue; // Keep valid match only - see doc of areCellsIncludedIn() - mcIdType const idx0 = revDescILP[v]; + mcIdType idx0 = revDescILP[v]; // Retrieve the two cells on either side of the face v of M1: mcIdType c1=revDescLP[idx0], c2=revDescLP[idx0+1]; std::map toOther = {{c1, c2}, {c2, c1}}; @@ -2714,7 +2692,7 @@ void MEDCouplingUMesh::findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnS // If a valid value was found, use it: mcIdType val = sv.size()==1 ? *sv.begin() : 0; // Hopefully this does not conflict with an potential value on the other side: - mcIdType const other = toOther[c]; + mcIdType other = toOther[c]; if (hitCellsLargeP[other]) { if(val && hitCellsLargeP[other] != -val) @@ -2734,7 +2712,7 @@ void MEDCouplingUMesh::findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnS if (cellsRet1->getNumberOfTuples() + cellsRet2->getNumberOfTuples() != cellsAroundGroupLarge->getNumberOfTuples()) { - DAInt const nonHitCells = hitCellsLarge->findIdsEqual(0); // variable kept for debug ... + DAInt nonHitCells = hitCellsLarge->findIdsEqual(0); // variable kept for debug ... throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellsToRenumber: Some cells not hit - Internal error should not happen"); } cellsRet1->transformWithIndArr(cellsAroundGroupLarge->begin(),cellsAroundGroupLarge->end()); @@ -2759,7 +2737,7 @@ void MEDCouplingUMesh::findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnS */ void MEDCouplingUMesh::duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd) { - mcIdType const nbOfNodes=getNumberOfNodes(); + mcIdType nbOfNodes=getNumberOfNodes(); duplicateNodesInCoords(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd); duplicateNodesInConn(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd,nbOfNodes); } @@ -2777,7 +2755,7 @@ void MEDCouplingUMesh::renumberNodesWithOffsetInConn(mcIdType offset) checkConnectivityFullyDefined(); mcIdType *conn(getNodalConnectivity()->getPointer()); const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer()); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); for(mcIdType i=0;igetPointer(); const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); for(mcIdType i=0;igetPointer(); const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); for(mcIdType i=0;igetPointer(); const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); for(mcIdType i=0;i=0)//avoid polyhedron separator { - auto const it=m.find(node); + std::map::iterator it=m.find(node); if(it!=m.end()) node=(*it).second; } @@ -2931,7 +2909,7 @@ void MEDCouplingUMesh::duplicateNodesInConn(const mcIdType *nodeIdsToDuplicateBg void MEDCouplingUMesh::renumberCells(const mcIdType *old2NewBg, bool check) { checkConnectivityFullyDefined(); - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); const mcIdType *array=old2NewBg; if(check) array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells); @@ -2954,8 +2932,8 @@ void MEDCouplingUMesh::renumberCells(const mcIdType *old2NewBg, bool check) newCI[0]=loc; for(mcIdType i=0;ipushBackSilent(0); return elems.retn(); } - int const dim=getSpaceDimension(); + int dim=getSpaceDimension(); INTERP_KERNEL::AutoPtr elem_bb=new double[2*dim]; const mcIdType* conn = getNodalConnectivity()->getConstPointer(); const mcIdType* conn_index= getNodalConnectivityIndex()->getConstPointer(); const double* coords = getCoords()->getConstPointer(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); for ( mcIdType ielem=0; ielem=0)//avoid polyhedron separator { for (int idim=0; idimpushBackSilent(0); return elems.retn(); } - int const dim=getSpaceDimension(); + int dim=getSpaceDimension(); INTERP_KERNEL::AutoPtr elem_bb=new double[2*dim]; const mcIdType* conn = getNodalConnectivity()->getConstPointer(); const mcIdType* conn_index= getNodalConnectivityIndex()->getConstPointer(); const double* coords = getCoords()->getConstPointer(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); for ( mcIdType ielem=0; ielem=0)//avoid polyhedron separator { for (int idim=0; idim ret=DataArrayIdType::New(); ret->alloc(0,1); checkConnectivityFullyDefined(); - mcIdType const nbCells=getNumberOfCells(); - int const mdim=getMeshDimension(); + mcIdType nbCells=getNumberOfCells(); + int mdim=getMeshDimension(); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); if(mdim!=ToIdType(cm.getDimension())) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::giveCellsWithType : Mismatch between mesh dimension and dimension of the cell !"); @@ -3167,14 +3145,14 @@ std::string MEDCouplingUMesh::simpleRepr() const ret << "Unstructured mesh with name : \"" << getName() << "\"\n"; ret << "Description of mesh : \"" << getDescription() << "\"\n"; int tmpp1,tmpp2; - double const tt=getTime(tmpp1,tmpp2); + double tt=getTime(tmpp1,tmpp2); ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n"; ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; if(_mesh_dim>=-1) { ret << "Mesh dimension : " << _mesh_dim << "\nSpace dimension : "; } else { ret << " Mesh dimension has not been set or is invalid !"; } - if(_coords!=nullptr) + if(_coords!=0) { const int spaceDim=getSpaceDimension(); ret << spaceDim << "\nInfo attached on space dimension : "; @@ -3185,19 +3163,19 @@ std::string MEDCouplingUMesh::simpleRepr() const else ret << msg0 << "\n"; ret << "Number of nodes : "; - if(_coords!=nullptr) + if(_coords!=0) ret << getNumberOfNodes() << "\n"; else ret << msg0 << "\n"; ret << "Number of cells : "; - if(_nodal_connec!=nullptr && _nodal_connec_index!=nullptr) + if(_nodal_connec!=0 && _nodal_connec_index!=0) ret << getNumberOfCells() << "\n"; else ret << "No connectivity specified !" << "\n"; ret << "Cell types present : "; - for(auto _type : _types) + for(std::set::const_iterator iter=_types.begin();iter!=_types.end();iter++) { - const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); + const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*iter); ret << cm.getRepr() << " "; } ret << "\n"; @@ -3258,7 +3236,7 @@ std::string MEDCouplingUMesh::reprConnectivityOfThis() const */ MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(std::size_t spaceDim) const { - int const mdim=getMeshDimension(); + int mdim=getMeshDimension(); if(mdim<0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSetInstanceFromThis : invalid mesh dimension ! Should be >= 0 !"); MCAuto ret=MEDCouplingUMesh::New(getName(),mdim); @@ -3354,7 +3332,7 @@ void MEDCouplingUMesh::setConnectivity(DataArrayIdType *conn, DataArrayIdType *c * If 'deeCpy' is true all arrays (coordinates and connectivities) are deeply copied. */ MEDCouplingUMesh::MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy):MEDCouplingPointSet(other,deepCpy),_mesh_dim(other._mesh_dim), - _nodal_connec(nullptr),_nodal_connec_index(nullptr), + _nodal_connec(0),_nodal_connec_index(0), _types(other._types) { if(other._nodal_connec) @@ -3474,7 +3452,7 @@ void MEDCouplingUMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) con std::copy(conn,conn+getNodalConnectivityArrayLen(),ptA1); } else - a1=nullptr; + a1=0; } /*! @@ -3517,20 +3495,20 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const { std::string name="MeasureOfMesh_"; name+=getName(); - mcIdType const nbelem=getNumberOfCells(); + mcIdType nbelem=getNumberOfCells(); MCAuto field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); MCAuto array=DataArrayDouble::New(); array->alloc(nbelem,1); double *area_vol=array->getPointer(); - field->setArray(array) ; array=nullptr; + field->setArray(array) ; array=0; field->setMesh(const_cast(this)); field->synchronizeTimeWithMesh(); if(getMeshDimension()!=-1) { mcIdType ipt; INTERP_KERNEL::NormalizedCellType type; - int const dim_space=getSpaceDimension(); + int dim_space=getSpaceDimension(); const double *coords=getCoords()->getConstPointer(); const mcIdType *connec=getNodalConnectivity()->getConstPointer(); const mcIdType *connec_index=getNodalConnectivityIndex()->getConstPointer(); @@ -3574,7 +3552,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const mcIdTyp { std::string name="PartMeasureOfMesh_"; name+=getName(); - std::size_t const nbelem=std::distance(begin,end); + std::size_t nbelem=std::distance(begin,end); MCAuto array=DataArrayDouble::New(); array->setName(name); array->alloc(nbelem,1); @@ -3583,7 +3561,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const mcIdTyp { mcIdType ipt; INTERP_KERNEL::NormalizedCellType type; - int const dim_space=getSpaceDimension(); + int dim_space=getSpaceDimension(); const double *coords=getCoords()->getConstPointer(); const mcIdType *connec=getNodalConnectivity()->getConstPointer(); const mcIdType *connec_index=getNodalConnectivityIndex()->getConstPointer(); @@ -3623,7 +3601,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) cons MCAuto tmp=getMeasureField(isAbs); std::string name="MeasureOnNodeOfMesh_"; name+=getName(); - mcIdType const nbNodes=getNumberOfNodes(); + mcIdType nbNodes=getNumberOfNodes(); MCAuto nnpc; { MCAuto tmp2(computeNbOfNodesPerCell()); @@ -3673,8 +3651,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); MCAuto array=DataArrayDouble::New(); - mcIdType const nbOfCells=getNumberOfCells(); - int const nbComp=getMeshDimension()+1; + mcIdType nbOfCells=getNumberOfCells(); + int nbComp=getMeshDimension()+1; array->alloc(nbOfCells,nbComp); double *vals=array->getPointer(); const mcIdType *connI=_nodal_connec_index->getConstPointer(); @@ -3688,9 +3666,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const const double *locPtr=loc->getConstPointer(); for(mcIdType i=0;i(locPtr+3*i,coords+3*conn[offset+1],coords+3*conn[offset+2],vals); - double const n=INTERP_KERNEL::norm<3>(vals); + double n=INTERP_KERNEL::norm<3>(vals); std::transform(vals,vals+3,vals,std::bind(std::multiplies(),std::placeholders::_1,1./n)); } } @@ -3707,9 +3685,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const double tmp[2]; for(mcIdType i=0;i()); - double const n=INTERP_KERNEL::norm<2>(tmp); + double n=INTERP_KERNEL::norm<2>(tmp); std::transform(tmp,tmp+2,tmp,std::bind(std::multiplies(),std::placeholders::_1,1./n)); *vals++=-tmp[1]; *vals++=tmp[0]; @@ -3752,8 +3730,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const mcIdTyp throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); MCAuto array=DataArrayDouble::New(); - std::size_t const nbelems=std::distance(begin,end); - int const nbComp=getMeshDimension()+1; + std::size_t nbelems=std::distance(begin,end); + int nbComp=getMeshDimension()+1; array->alloc(nbelems,nbComp); double *vals=array->getPointer(); const mcIdType *connI=_nodal_connec_index->getConstPointer(); @@ -3767,9 +3745,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const mcIdTyp const double *locPtr=loc->getConstPointer(); for(const mcIdType *i=begin;i!=end;i++,vals+=3,locPtr+=3) { - mcIdType const offset=connI[*i]; + mcIdType offset=connI[*i]; INTERP_KERNEL::crossprod<3>(locPtr,coords+3*conn[offset+1],coords+3*conn[offset+2],vals); - double const n=INTERP_KERNEL::norm<3>(vals); + double n=INTERP_KERNEL::norm<3>(vals); std::transform(vals,vals+3,vals,std::bind(std::multiplies(),std::placeholders::_1,1./n)); } } @@ -3784,9 +3762,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const mcIdTyp double tmp[2]; for(const mcIdType *i=begin;i!=end;i++) { - mcIdType const offset=connI[*i]; + mcIdType offset=connI[*i]; std::transform(coords+2*conn[offset+2],coords+2*conn[offset+2]+2,coords+2*conn[offset+1],tmp,std::minus()); - double const n=INTERP_KERNEL::norm<2>(tmp); + double n=INTERP_KERNEL::norm<2>(tmp); std::transform(tmp,tmp+2,tmp,std::bind(std::multiplies(),std::placeholders::_1,1./n)); *vals++=-tmp[1]; *vals++=tmp[0]; @@ -3818,8 +3796,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildDirectionVectorField() const throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildDirectionVectorField !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); MCAuto array=DataArrayDouble::New(); - mcIdType const nbOfCells=getNumberOfCells(); - int const spaceDim=getSpaceDimension(); + mcIdType nbOfCells=getNumberOfCells(); + int spaceDim=getSpaceDimension(); array->alloc(nbOfCells,spaceDim); double *pt=array->getPointer(); const double *coo=getCoords()->getConstPointer(); @@ -3869,7 +3847,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3D(const double *origin, const dou if(candidates->empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane considering bounding boxes !"); std::vector nodes; - DataArrayIdType *cellIds1D=nullptr; + DataArrayIdType *cellIds1D=0; MCAuto subMesh=static_cast(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); subMesh->findNodesOnPlane(origin,vec,eps,nodes); MCAuto desc1=DataArrayIdType::New(),desc2=DataArrayIdType::New(); @@ -3877,19 +3855,19 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3D(const double *origin, const dou MCAuto revDesc1=DataArrayIdType::New(),revDesc2=DataArrayIdType::New(); MCAuto revDescIndx1=DataArrayIdType::New(),revDescIndx2=DataArrayIdType::New(); MCAuto mDesc2=subMesh->buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2);//meshDim==2 spaceDim==3 - revDesc2=nullptr; revDescIndx2=nullptr; + revDesc2=0; revDescIndx2=0; MCAuto mDesc1=mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3 - revDesc1=nullptr; revDescIndx1=nullptr; + revDesc1=0; revDescIndx1=0; //Marking all 1D cells that contained at least one node located on the plane //the intersection between those cells and the plane, which consist of the nodes previously tagged, thus don't need to be computed afterwards //(if said intersection is computed in MEDCouplingUMesh::split3DCurveWithPlane, then we might create additional nodes //due to accuracy errors when the needed nodes already exist) mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),false,cellIds1D); - MCAuto const cellIds1DTmp(cellIds1D); + MCAuto cellIds1DTmp(cellIds1D); // std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); - for(long const it : *cellIds1D) - cut3DCurve[it]=-1; + for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++) + cut3DCurve[*it]=-1; mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve); std::vector< std::pair > cut3DSurf(mDesc2->getNumberOfCells()); AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->getConstPointer(),mDesc2->getNodalConnectivityIndex()->getConstPointer(), @@ -3939,19 +3917,19 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const if(candidates->empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : No 3D surf cells in this intercepts the specified plane considering bounding boxes !"); std::vector nodes; - DataArrayIdType *cellIds1D(nullptr); + DataArrayIdType *cellIds1D(0); MCAuto subMesh(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); subMesh->findNodesOnPlane(origin,vec,eps,nodes); MCAuto desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()); MCAuto mDesc1(subMesh->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));//meshDim==1 spaceDim==3 mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D); - MCAuto const cellIds1DTmp(cellIds1D); + MCAuto cellIds1DTmp(cellIds1D); // std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); - for(long const it : *cellIds1D) - cut3DCurve[it]=-1; + for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++) + cut3DCurve[*it]=-1; mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve); - mcIdType const ncellsSub=subMesh->getNumberOfCells(); + mcIdType ncellsSub=subMesh->getNumberOfCells(); std::vector< std::pair > cut3DSurf(ncellsSub); AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,subMesh->getNodalConnectivity()->getConstPointer(),subMesh->getNodalConnectivityIndex()->getConstPointer(), mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(), @@ -3972,9 +3950,9 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const } else { - mcIdType const cellId3DSurf=cut3DSurf[i].second; - mcIdType const offset=nodalI[cellId3DSurf]+1; - mcIdType const nbOfEdges=nodalI[cellId3DSurf+1]-offset; + mcIdType cellId3DSurf=cut3DSurf[i].second; + mcIdType offset=nodalI[cellId3DSurf]+1; + mcIdType nbOfEdges=nodalI[cellId3DSurf+1]-offset; for(mcIdType j=0;jpushBackSilent(ToIdType(INTERP_KERNEL::NORM_SEG2)); conn->pushBackSilent(nodal[offset+j]); conn->pushBackSilent(nodal[offset+(j+1)%nbOfEdges]); @@ -4005,18 +3983,18 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double findNodesOnPlane(origin,vec,eps,nodes); MCAuto desc1(DataArrayIdType::New()),desc2(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),descIndx2(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDesc2(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()),revDescIndx2(DataArrayIdType::New()); MCAuto mDesc2(buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2));//meshDim==2 spaceDim==3 - revDesc2=nullptr; revDescIndx2=nullptr; + revDesc2=0; revDescIndx2=0; MCAuto mDesc1(mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));//meshDim==1 spaceDim==3 - revDesc1=nullptr; revDescIndx1=nullptr; - DataArrayIdType *cellIds1D(nullptr); + revDesc1=0; revDescIndx1=0; + DataArrayIdType *cellIds1D(0); mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D); - MCAuto const cellIds1DTmp(cellIds1D); + MCAuto cellIds1DTmp(cellIds1D); std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); - for(long const it : *cellIds1D) - cut3DCurve[it]=-1; + for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++) + cut3DCurve[*it]=-1; bool sameNbNodes; { - mcIdType const oldNbNodes(mDesc1->getNumberOfNodes()); + mcIdType oldNbNodes(mDesc1->getNumberOfNodes()); mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve); sameNbNodes=(mDesc1->getNumberOfNodes()==oldNbNodes); } @@ -4034,7 +4012,7 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double } std::vector > res; buildSubCellsFromCut(cut3DSurf,desc2->begin(),descIndx2->begin(),mDesc1->getCoords()->begin(),eps,res); - std::size_t const sz(res.size()); + std::size_t sz(res.size()); if(ToIdType(res.size())==mDesc1->getNumberOfCells() && sameNbNodes) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane : cell is not clipped !"); for(std::size_t i=0;i MEDCouplingUMesh::clipSingle3DCellByPlane(const double MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(mDesc1->getCoords()); ret->setConnectivity(conn,connI,true); - mcIdType const nbCellsRet(ret->getNumberOfCells()); + mcIdType nbCellsRet(ret->getNumberOfCells()); // MCAuto vec2(DataArrayDouble::New()); vec2->alloc(1,3); std::copy(vec,vec+3,vec2->getPointer()); MCAuto ortho(ret->buildOrthogonalField()); @@ -4128,18 +4106,18 @@ DataArrayIdType *MEDCouplingUMesh::getCellIdsCrossingPlane(const double *origin, checkFullyDefined(); if(getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D works on umeshes with spaceDim equal to 3 !"); - double const normm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]); + double normm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]); if(normm<1e-6) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getCellIdsCrossingPlane : parameter 'vec' should have a norm2 greater than 1e-6 !"); double vec2[3]; vec2[0]=vec[1]; vec2[1]=-vec[0]; vec2[2]=0.;//vec2 is the result of cross product of vec with (0,0,1) - double const angle=acos(vec[2]/normm); + double angle=acos(vec[2]/normm); MCAuto cellIds; double bbox[6]; if(angle>eps) { MCAuto coo=_coords->deepCopy(); - double const normm2(sqrt(vec2[0]*vec2[0]+vec2[1]*vec2[1]+vec2[2]*vec2[2])); + double normm2(sqrt(vec2[0]*vec2[0]+vec2[1]*vec2[1]+vec2[2]*vec2[2])); if(normm2/normm>1e-6) DataArrayDouble::Rotate3DAlg(origin,vec2,angle,coo->getNumberOfTuples(),coo->getPointer(),coo->getPointer()); MCAuto mw=clone(false);//false -> shallow copy @@ -4168,7 +4146,7 @@ bool MEDCouplingUMesh::isContiguous1D() const { if(getMeshDimension()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense only for 1D mesh !"); - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); if(nbCells<1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense for non empty mesh !"); const mcIdType *connI(_nodal_connec_index->begin()),*conn(_nodal_connec->begin()); @@ -4252,7 +4230,7 @@ double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd checkFullyDefined(); if(ToIdType(std::distance(ptBg,ptEnd))!=spaceDim) { std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoint : input point has to have dimension equal to the space dimension of this (" << spaceDim << ") !"; throw INTERP_KERNEL::Exception(oss.str()); } - DataArrayIdType *ret1=nullptr; + DataArrayIdType *ret1=0; MCAuto pts=DataArrayDouble::New(); pts->useArray(ptBg,false,DeallocType::C_DEALLOC,1,spaceDim); MCAuto ret0=distanceToPoints(pts,ret1); MCAuto ret1Safe(ret1); @@ -4297,10 +4275,10 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, throw INTERP_KERNEL::Exception(oss.str()); } checkFullyDefined(); - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); if(nbCells==0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !"); - mcIdType const nbOfPts=pts->getNumberOfTuples(); + mcIdType nbOfPts=pts->getNumberOfTuples(); MCAuto ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1); MCAuto ret1=DataArrayIdType::New(); ret1->alloc(nbOfPts,1); const mcIdType *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin(); @@ -4311,7 +4289,7 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, { case 3: { - BBTreeDst<3> const myTree(bbox,nullptr,0,nbCells); + BBTreeDst<3> myTree(bbox,0,0,nbCells); for(mcIdType i=0;i::max(); @@ -4324,7 +4302,7 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, } case 2: { - BBTreeDst<2> const myTree(bbox,nullptr,0,nbCells); + BBTreeDst<2> myTree(bbox,0,0,nbCells); for(mcIdType i=0;i::max(); @@ -4499,20 +4477,20 @@ void MEDCouplingUMesh::checkButterflyCells(std::vector& cells, double const char msg[]="Butterfly detection work only for 2D cells with spaceDim==2 or 3!"; if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception(msg); - int const spaceDim=getSpaceDimension(); + int spaceDim=getSpaceDimension(); if(spaceDim!=2 && spaceDim!=3) throw INTERP_KERNEL::Exception(msg); const mcIdType *conn=_nodal_connec->getConstPointer(); const mcIdType *connI=_nodal_connec_index->getConstPointer(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); std::vector cell2DinS2; for(mcIdType i=0;igetConstPointer(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto nodalConnecIndexOut=DataArrayIdType::New(); nodalConnecIndexOut->alloc(nbOfCells+1,1); MCAuto nodalConnecOut(DataArrayIdType::New()); @@ -4554,14 +4532,14 @@ DataArrayIdType *MEDCouplingUMesh::convexEnvelop2D() isChanged->alloc(0,1); for(mcIdType i=0;igetNumberOfTuples(); + mcIdType pos=nodalConnecOut->getNumberOfTuples(); if(BuildConvexEnvelopOf2DCellJarvis(coords,nodalConnecIn+nodalConnecIndexIn[i],nodalConnecIn+nodalConnecIndexIn[i+1],nodalConnecOut)) isChanged->pushBackSilent(i); types.insert((INTERP_KERNEL::NormalizedCellType)nodalConnecOut->getIJ(pos,0)); workIndexOut[1]=nodalConnecOut->getNumberOfTuples(); } if(isChanged->empty()) - return nullptr; + return 0; setConnectivity(nodalConnecOut,nodalConnecIndexOut,false); _types=types; return isChanged.retn(); @@ -4600,7 +4578,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMesh(const MEDCouplingUMesh *me else throw INTERP_KERNEL::Exception("Invalid 2D mesh and 1D mesh because 2D mesh has quadratic cells and 1D is not fully quadratic !"); } - mcIdType const oldNbOfNodes(getNumberOfNodes()); + mcIdType oldNbOfNodes(getNumberOfNodes()); MCAuto newCoords; switch(policy) { @@ -4634,10 +4612,10 @@ bool MEDCouplingUMesh::isFullyQuadratic() const { checkFullyDefined(); bool ret=true; - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); for(mcIdType i=0;ibegin(); for(mcIdType i=0;i types; checkFullyDefined(); MCAuto ret,connSafe,connISafe; MCAuto coordsSafe; - int const meshDim=getMeshDimension(); + int meshDim=getMeshDimension(); switch(conversionType) { case 0: @@ -4930,10 +4908,10 @@ DataArrayIdType *MEDCouplingUMesh::simplexize(int policy) bool MEDCouplingUMesh::areOnlySimplexCells() const { checkFullyDefined(); - int const mdim=getMeshDimension(); + int mdim=getMeshDimension(); if(mdim<1 || mdim>3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::areOnlySimplexCells : only available with meshes having a meshdim 1, 2 or 3 !"); - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); for(mcIdType i=0;igetPointer(); mcIdType *index=_nodal_connec_index->getPointer(); mcIdType posOfCurCell=0; @@ -4975,9 +4953,9 @@ void MEDCouplingUMesh::convertDegeneratedCells() for(mcIdType i=0;i ret(DataArrayIdType::New()); ret->alloc(0,1); if(nbOfCells<1) return ret.retn(); - mcIdType const initMeshLgth=getNodalConnectivityArrayLen(); + mcIdType initMeshLgth=getNodalConnectivityArrayLen(); mcIdType *conn=_nodal_connec->getPointer(); mcIdType *index=_nodal_connec_index->getPointer(); mcIdType posOfCurCell=0; @@ -5016,12 +4994,12 @@ DataArrayIdType *MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes() for(mcIdType i=0;ibegin(); const mcIdType *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); for(mcIdType i=0;igetPointer()); const mcIdType *connI(_nodal_connec_index->begin()); const double *coordsPtr(_coords->begin()); bool isModified(false); for(mcIdType i=0;igetPointer()); const mcIdType *connI(_nodal_connec_index->begin()); if(mdim==2) {//2D for(mcIdType i=0;i& { if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply arePolyhedronsNotCorrectlyOriented on it : must be meshDim==3 and spaceDim==3 !"); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); for(mcIdType i=0;igetPointer(); const mcIdType *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); for(mcIdType i=0;i const gts(getAllGeoTypes()); + std::set gts(getAllGeoTypes()); mcIdType *conn(_nodal_connec->getPointer()); const mcIdType *conni(_nodal_connec_index->begin()); - for(auto gt : gts) + for(std::set::const_iterator gt=gts.begin();gt!=gts.end();gt++) { - INTERP_KERNEL::AutoCppPtr oi((INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(gt))); - MCAuto cwt(giveCellsWithType(gt)); - for(long const it : *cwt) - oi->operate(conn+conni[it]+1,conn+conni[it+1]); + INTERP_KERNEL::AutoCppPtr oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(*gt)); + MCAuto cwt(giveCellsWithType(*gt)); + for(const mcIdType *it=cwt->begin();it!=cwt->end();it++) + oi->operate(conn+conni[*it]+1,conn+conni[*it+1]); } updateTime(); } @@ -5330,11 +5308,11 @@ DataArrayIdType *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() const char msg[]="check3DCellsWellOriented detection works only for 3D cells !"; if(getMeshDimension()!=3) throw INTERP_KERNEL::Exception(msg); - int const spaceDim=getSpaceDimension(); + int spaceDim=getSpaceDimension(); if(spaceDim!=3) throw INTERP_KERNEL::Exception(msg); // - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); mcIdType *conn=_nodal_connec->getPointer(); const mcIdType *connI=_nodal_connec_index->begin(); const double *coo=getCoords()->begin(); @@ -5366,14 +5344,14 @@ DataArrayIdType *MEDCouplingUMesh::findAndCorrectBadOriented3DCells() { if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply findAndCorrectBadOriented3DCells on it : must be meshDim==3 and spaceDim==3 !"); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); mcIdType *conn=_nodal_connec->getPointer(); const mcIdType *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); MCAuto ret=DataArrayIdType::New(); ret->alloc(0,1); for(mcIdType i=0;i ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); @@ -5485,7 +5463,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getEdgeRatioField() const double tmp[12]; for(mcIdType i=0;i ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); @@ -5557,7 +5535,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getAspectRatioField() const double tmp[12]; for(mcIdType i=0;i ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); @@ -5638,7 +5616,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getWarpField() const double tmp[12]; for(mcIdType i=0;i ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); @@ -5705,7 +5683,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getSkewField() const double tmp[12]; for(mcIdType i=0;isetMesh(this); std::set types; ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index); - int const spaceDim(getSpaceDimension()); - mcIdType const nbCells(getNumberOfCells()); + int spaceDim(getSpaceDimension()); + mcIdType nbCells(getNumberOfCells()); MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); - for(auto type : types) + for(std::set::const_iterator it=types.begin();it!=types.end();it++) { - INTERP_KERNEL::AutoCppPtr dc(INTERP_KERNEL::CellModel::GetCellModel(type).buildInstanceOfDiameterCalulator(spaceDim)); - MCAuto cellIds(giveCellsWithType(type)); + INTERP_KERNEL::AutoCppPtr dc(INTERP_KERNEL::CellModel::GetCellModel(*it).buildInstanceOfDiameterCalulator(spaceDim)); + MCAuto cellIds(giveCellsWithType(*it)); dc->computeForListOfCellIdsUMeshFrmt(cellIds->begin(),cellIds->end(),_nodal_connec_index->begin(),_nodal_connec->begin(),getCoords()->begin(),arr->getPointer()); } ret->setArray(arr); @@ -5772,9 +5750,9 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree(double arcDetEps) con if((mDim==2 && sDim==2) || (mDim==1 && sDim==2)) { bool presenceOfQuadratic(false); - for(auto _type : _types) + for(std::set::const_iterator it=_types.begin();it!=_types.end();it++) { - const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_type)); + const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(*it)); if(cm.isQuadratic()) presenceOfQuadratic=true; } @@ -5800,7 +5778,7 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree(double arcDetEps) con DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const { checkFullyDefined(); - int const spaceDim(getSpaceDimension()); + int spaceDim(getSpaceDimension()); mcIdType nbOfCells(getNumberOfCells()), nbOfNodes(getNumberOfNodes()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); @@ -5813,11 +5791,11 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); for(mcIdType i=0;i=0 && nodeId ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); @@ -5866,12 +5844,12 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic(double arc for(mcIdType i=0;i nodes(sz); - INTERP_KERNEL::QuadraticPolygon *pol(nullptr); + INTERP_KERNEL::QuadraticPolygon *pol(0); for(mcIdType j=0;j ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); const double *coords(_coords->begin()); @@ -5912,12 +5890,12 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic(double arc for(mcIdType i=0;i nodes(sz); - INTERP_KERNEL::Edge *edge(nullptr); + INTERP_KERNEL::Edge *edge(0); for(mcIdType j=0;j MEDCouplingUMesh::getDistributionOfTypes() const const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); const mcIdType *work=connI; - mcIdType const nbOfCells=getNumberOfCells(); - std::size_t const n=getAllGeoTypes().size(); + mcIdType nbOfCells=getNumberOfCells(); + std::size_t n=getAllGeoTypes().size(); std::vector ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here std::set types; for(std::size_t i=0;work!=connI+nbOfCells;i++) { - auto const typ=(INTERP_KERNEL::NormalizedCellType)conn[*work]; + INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)conn[*work]; if(types.find(typ)!=types.end()) { std::ostringstream oss; oss << "MEDCouplingUMesh::getDistributionOfTypes : Type " << INTERP_KERNEL::CellModel::GetCellModel(typ).getRepr(); @@ -6014,8 +5992,8 @@ DataArrayIdType *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vect { if(code.empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code is empty, should not !"); - std::size_t const sz=code.size(); - std::size_t const n=sz/3; + std::size_t sz=code.size(); + std::size_t n=sz/3; if(sz%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code size is NOT %3 !"); std::vector types; @@ -6037,28 +6015,28 @@ DataArrayIdType *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vect if(!checkConsecutiveCellTypesAndOrder(&types[0],&types[0]+types.size())) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : non contiguous type !"); if(types.size()==_types.size()) - return nullptr; + return 0; } MCAuto ret=DataArrayIdType::New(); ret->alloc(nb,1); mcIdType *retPtr=ret->getPointer(); const mcIdType *connI=_nodal_connec_index->begin(); const mcIdType *conn=_nodal_connec->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *i=connI; int kk=0; for(std::vector::const_iterator it=types.begin();it!=types.end();it++,kk++) { i=std::find_if(i,connI+nbOfCells,MEDCouplingImpl::ConnReader2(conn,ToIdType((*it)))); - mcIdType const offset=ToIdType(std::distance(connI,i)); + mcIdType offset=ToIdType(std::distance(connI,i)); const mcIdType *j=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType((*it)))); - mcIdType const nbOfCellsOfCurType=ToIdType(std::distance(i,j)); + mcIdType nbOfCellsOfCurType=ToIdType(std::distance(i,j)); if(code[3*kk+2]==-1) for(mcIdType k=0;k=0 && idInIdsPerTypebegin(); const mcIdType *connI=_nodal_connec_index->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); std::vector types; std::vector typeRangeVals(1); for(const mcIdType *i=connI;i!=connI+nbOfCells;) { - auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; + INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; if(std::find(types.begin(),types.end(),curType)!=types.end()) { throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : current mesh is not sorted by type !"); @@ -6135,19 +6113,19 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayIdType *profile, std:: typeRangeVals.push_back(ToIdType(std::distance(connI,i))); } // - DataArrayIdType *castArr=nullptr,*rankInsideCast=nullptr,*castsPresent=nullptr; + DataArrayIdType *castArr=0,*rankInsideCast=0,*castsPresent=0; profile->splitByValueRange(&typeRangeVals[0],&typeRangeVals[0]+typeRangeVals.size(),castArr,rankInsideCast,castsPresent); - MCAuto const tmp0=castArr; - MCAuto const tmp1=rankInsideCast; - MCAuto const tmp2=castsPresent; + MCAuto tmp0=castArr; + MCAuto tmp1=rankInsideCast; + MCAuto tmp2=castsPresent; // - mcIdType const nbOfCastsFinal=castsPresent->getNumberOfTuples(); + mcIdType nbOfCastsFinal=castsPresent->getNumberOfTuples(); code.resize(3*nbOfCastsFinal); std::vector< MCAuto > idsInPflPerType2; std::vector< MCAuto > idsPerType2; for(mcIdType i=0;igetIJ(i,0); + mcIdType castId=castsPresent->getIJ(i,0); MCAuto tmp3=castArr->findIdsEqual(castId); idsInPflPerType2.push_back(tmp3); code[3*i]=ToIdType(types[castId]); @@ -6164,7 +6142,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayIdType *profile, std:: code[3*i+2]=-1; } } - std::size_t const sz2=idsInPflPerType2.size(); + std::size_t sz2=idsInPflPerType2.size(); idsInPflPerType.resize(sz2); for(std::size_t i=0;iincrRef(); idsInPflPerType[i]=locDa; } - std::size_t const sz=idsPerType2.size(); + std::size_t sz=idsPerType2.size(); idsPerType.resize(sz); for(std::size_t i=0;irenumberCells(ret0->begin(),false); revDesc=tmp->getNodalConnectivity(); revDescIndx=tmp->getNodalConnectivityIndex(); - DataArrayIdType *ret=nullptr; + DataArrayIdType *ret=0; if(!ret1->areCellsIncludedIn(nM1LevMesh,2,ret)) { mcIdType tmp2; @@ -6250,11 +6228,11 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypes() const checkFullyDefined(); const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); std::set types; for(const mcIdType *i=connI;i!=connI+nbOfCells;) { - auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; + INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; if(types.find(curType)!=types.end()) return false; types.insert(curType); @@ -6285,18 +6263,18 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::No checkFullyDefined(); const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(nbOfCells==0) return true; mcIdType lastPos=-1; std::set sg; for(const mcIdType *i=connI;i!=connI+nbOfCells;) { - auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; + INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; const INTERP_KERNEL::NormalizedCellType *isTypeExists=std::find(orderBg,orderEnd,curType); if(isTypeExists!=orderEnd) { - mcIdType const pos=ToIdType(std::distance(orderBg,isTypeExists)); + mcIdType pos=ToIdType(std::distance(orderBg,isTypeExists)); if(pos<=lastPos) return false; lastPos=pos; @@ -6324,7 +6302,7 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::No DataArrayIdType *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayIdType *&nbPerType) const { checkConnectivityFullyDefined(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); MCAuto tmpa=DataArrayIdType::New(); @@ -6339,7 +6317,7 @@ DataArrayIdType *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::No const INTERP_KERNEL::NormalizedCellType *where=std::find(orderBg,orderEnd,(INTERP_KERNEL::NormalizedCellType)conn[*i]); if(where!=orderEnd) { - mcIdType const pos=ToIdType(std::distance(orderBg,where)); + mcIdType pos=ToIdType(std::distance(orderBg,where)); tmp2[pos]++; tmp[std::distance(connI,i)]=pos; } @@ -6375,7 +6353,7 @@ DataArrayIdType *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const */ DataArrayIdType *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const { - DataArrayIdType *nbPerType=nullptr; + DataArrayIdType *nbPerType=0; MCAuto tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType); nbPerType->decrRef(); return tmpa->buildPermArrPerLevel(); @@ -6395,12 +6373,12 @@ DataArrayIdType *MEDCouplingUMesh::rearrange2ConsecutiveCellTypes() computeTypes(); const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); std::vector types; for(const mcIdType *i=connI;i!=connI+nbOfCells && (types.size()!=_types.size());) if(std::find(types.begin(),types.end(),(INTERP_KERNEL::NormalizedCellType)conn[*i])==types.end()) { - auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; + INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; types.push_back(curType); for(i++;i!=connI+nbOfCells && (INTERP_KERNEL::NormalizedCellType)conn[*i]==curType;i++); } @@ -6409,10 +6387,10 @@ DataArrayIdType *MEDCouplingUMesh::rearrange2ConsecutiveCellTypes() mcIdType *retPtr=ret->getPointer(); std::fill(retPtr,retPtr+nbOfCells,-1); mcIdType newCellId=0; - for(auto type : types) + for(std::vector::const_iterator iter=types.begin();iter!=types.end();iter++) { for(const mcIdType *i=connI;i!=connI+nbOfCells;i++) - if((INTERP_KERNEL::NormalizedCellType)conn[*i]==type) + if((INTERP_KERNEL::NormalizedCellType)conn[*i]==(*iter)) retPtr[std::distance(connI,i)]=newCellId++; } renumberCells(retPtr,false); @@ -6429,19 +6407,19 @@ std::vector MEDCouplingUMesh::splitByType() const checkConnectivityFullyDefined(); const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); std::vector ret; for(const mcIdType *i=connI;i!=connI+nbOfCells;) { - auto const curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; - mcIdType const beginCellId=ToIdType(std::distance(connI,i)); + INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; + mcIdType beginCellId=ToIdType(std::distance(connI,i)); i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType))); - mcIdType const endCellId=ToIdType(std::distance(connI,i)); - mcIdType const sz=endCellId-beginCellId; - auto *cells=new mcIdType[sz]; + mcIdType endCellId=ToIdType(std::distance(connI,i)); + mcIdType sz=endCellId-beginCellId; + mcIdType *cells=new mcIdType[sz]; for(mcIdType j=0;j ret=MEDCoupling1GTUMesh::New(getName(),typ); ret->setCoords(getCoords()); - auto *retC=dynamic_cast((MEDCoupling1GTUMesh*)ret); + MEDCoupling1SGTUMesh *retC=dynamic_cast((MEDCoupling1GTUMesh*)ret); if(retC) { MCAuto c=convertNodalConnectivityToStaticGeoTypeMesh(); @@ -6474,10 +6452,10 @@ MEDCoupling1GTUMesh *MEDCouplingUMesh::convertIntoSingleGeoTypeMesh() const } else { - auto *retD=dynamic_cast((MEDCoupling1GTUMesh*)ret); + MEDCoupling1DGTUMesh *retD=dynamic_cast((MEDCoupling1GTUMesh*)ret); if(!retD) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : Internal error !"); - DataArrayIdType *c=nullptr,*ci=nullptr; + DataArrayIdType *c=0,*ci=0; convertNodalConnectivityToDynamicGeoTypeMesh(c,ci); MCAuto cs(c),cis(ci); retD->setNodalConnectivity(cs,cis); @@ -6490,7 +6468,7 @@ DataArrayIdType *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() checkConnectivityFullyDefined(); if(_types.size()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh : current mesh does not contain exactly one geometric type !"); - INTERP_KERNEL::NormalizedCellType const typ=*_types.begin(); + INTERP_KERNEL::NormalizedCellType typ=*_types.begin(); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ); if(cm.isDynamic()) { @@ -6498,8 +6476,8 @@ DataArrayIdType *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() oss << "this type is dynamic ! Only static geometric type is possible for that type ! call convertNodalConnectivityToDynamicGeoTypeMesh instead !"; throw INTERP_KERNEL::Exception(oss.str()); } - mcIdType const nbCells=getNumberOfCells(); - mcIdType const typi=ToIdType(typ); + mcIdType nbCells=getNumberOfCells(); + mcIdType typi=ToIdType(typ); mcIdType nbNodesPerCell=ToIdType(cm.getNumberOfNodes()); MCAuto connOut=DataArrayIdType::New(); connOut->alloc(nbCells*nbNodesPerCell,1); mcIdType *outPtr=connOut->getPointer(); @@ -6543,7 +6521,7 @@ void MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayIdT for(mcIdType i=0;i=1) { if((strt>=0 && strt=0 && stop<=lgth)) @@ -6579,16 +6557,16 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons DataArrayIdType *&idInMsOfCellGrpOfSameType) { std::vector ms2; - for(auto m : ms) - if(m) + for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) + if(*it) { - m->checkConnectivityFullyDefined(); - ms2.push_back(m); + (*it)->checkConnectivityFullyDefined(); + ms2.push_back(*it); } if(ms2.empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords : input vector is empty !"); const DataArrayDouble *refCoo=ms2[0]->getCoords(); - int const meshDim=ms2[0]->getMeshDimension(); + int meshDim=ms2[0]->getMeshDimension(); std::vector m1ssm; std::vector< MCAuto > m1ssmAuto; // @@ -6606,12 +6584,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons std::vector sp=(*it)->splitByType(); std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector >(m1ssm)); std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector > >(m1ssmAuto)); - for(auto it2 : sp) + for(std::vector::const_iterator it2=sp.begin();it2!=sp.end();it2++) { - auto *singleCell=static_cast(it2->buildPartOfMySelf(&fake,&fake+1,true)); + MEDCouplingUMesh *singleCell=static_cast((*it2)->buildPartOfMySelf(&fake,&fake+1,true)); m1ssmSingleAuto.push_back(singleCell); m1ssmSingle.push_back(singleCell); - ret1->pushBackSilent(it2->getNumberOfCells()); ret2->pushBackSilent(rk); + ret1->pushBackSilent((*it2)->getNumberOfCells()); ret2->pushBackSilent(rk); } } MCAuto m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle); @@ -6650,14 +6628,14 @@ DataArrayIdType *MEDCouplingUMesh::convertCellArrayPerGeoType(const DataArrayIdT checkFullyDefined(); const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); - mcIdType const nbOfCells=getNumberOfCells(); - std::set const types(getAllGeoTypes()); - auto *tmp=new mcIdType[nbOfCells]; - for(auto type : types) + mcIdType nbOfCells=getNumberOfCells(); + std::set types(getAllGeoTypes()); + mcIdType *tmp=new mcIdType[nbOfCells]; + for(std::set::const_iterator iter=types.begin();iter!=types.end();iter++) { mcIdType j=0; for(const mcIdType *i=connI;i!=connI+nbOfCells;i++) - if((INTERP_KERNEL::NormalizedCellType)conn[*i]==type) + if((INTERP_KERNEL::NormalizedCellType)conn[*i]==(*iter)) tmp[std::distance(connI,i)]=j++; } DataArrayIdType *ret=DataArrayIdType::New(); @@ -6665,7 +6643,7 @@ DataArrayIdType *MEDCouplingUMesh::convertCellArrayPerGeoType(const DataArrayIdT ret->copyStringInfoFrom(*da); mcIdType *retPtr=ret->getPointer(); const mcIdType *daPtr=da->begin(); - mcIdType const nbOfElems=da->getNbOfElems(); + mcIdType nbOfElems=da->getNbOfElems(); for(mcIdType k=0;k code=getDistributionOfTypes(); - std::size_t const nOfTypesInThis=code.size()/3; + std::size_t nOfTypesInThis=code.size()/3; mcIdType sz=0,szOfType=0; for(std::size_t i=0;i MEDCouplingUMesh::getQuadraticStatus() const { - mcIdType const ncell=getNumberOfCells(); + mcIdType ncell=getNumberOfCells(); std::vector ret(ncell); const mcIdType *cI=getNodalConnectivityIndex()->begin(); const mcIdType *c=getNodalConnectivity()->begin(); for(mcIdType i=0;igetType()!=UNSTRUCTURED) throw INTERP_KERNEL::Exception("Merge of umesh only available with umesh each other !"); - const auto *otherC=static_cast(other); + const MEDCouplingUMesh *otherC=static_cast(other); return MergeUMeshes(this,otherC); } @@ -6762,8 +6740,8 @@ MEDCouplingMesh *MEDCouplingUMesh::mergeMyselfWith(const MEDCouplingMesh *other) DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMass() const { MCAuto ret=DataArrayDouble::New(); - int const spaceDim=getSpaceDimension(); - mcIdType const nbOfCells=getNumberOfCells(); + int spaceDim=getSpaceDimension(); + mcIdType nbOfCells=getNumberOfCells(); ret->alloc(nbOfCells,spaceDim); ret->copyStringInfoFrom(*getCoords()); double *ptToFill=ret->getPointer(); @@ -6772,7 +6750,7 @@ DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMass() const const double *coor=_coords->begin(); for(mcIdType i=0;i(type,nodal+nodalI[i]+1,nodalI[i+1]-nodalI[i]-1,coor,spaceDim,ptToFill); ptToFill+=spaceDim; } @@ -6794,7 +6772,7 @@ DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMass() const */ DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMassWithPrecision(double eps) const { - INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps); + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); MCAuto ret = computeCellCenterOfMass(); return ret.retn(); } @@ -6815,9 +6793,9 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const { checkFullyDefined(); MCAuto ret=DataArrayDouble::New(); - int const spaceDim=getSpaceDimension(); - mcIdType const nbOfCells=getNumberOfCells(); - mcIdType const nbOfNodes=getNumberOfNodes(); + int spaceDim=getSpaceDimension(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); const mcIdType *nodal=_nodal_connec->begin(); @@ -6825,7 +6803,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const const double *coor=_coords->begin(); for(mcIdType i=0;i0) std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind(std::multiplies(),std::placeholders::_1,1./(double)nbOfNodesInCell)); else @@ -6852,13 +6830,13 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const { std::set s(nodal+nodalI[i]+1,nodal+nodalI[i+1]); s.erase(-1); - for(long const it : s) + for(std::set::const_iterator it=s.begin();it!=s.end();it++) { - if(it>=0 && it()); + if(*it>=0 && *it()); else { - std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on cell polyhedron cell #" << i << " presence of nodeId #" << it << " should be in [0," << nbOfNodes << ") !"; + std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on cell polyhedron cell #" << i << " presence of nodeId #" << *it << " should be in [0," << nbOfNodes << ") !"; throw INTERP_KERNEL::Exception(oss.str()); } } @@ -6896,17 +6874,17 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const mcIdType *begin, const mcIdType *end) const { DataArrayDouble *ret=DataArrayDouble::New(); - int const spaceDim=getSpaceDimension(); - std::size_t const nbOfTuple=std::distance(begin,end); + int spaceDim=getSpaceDimension(); + std::size_t nbOfTuple=std::distance(begin,end); ret->alloc(nbOfTuple,spaceDim); double *ptToFill=ret->getPointer(); - auto *tmp=new double[spaceDim]; + double *tmp=new double[spaceDim]; const mcIdType *nodal=_nodal_connec->begin(); const mcIdType *nodalI=_nodal_connec_index->begin(); const double *coor=_coords->begin(); for(const mcIdType *w=begin;w!=end;w++) { - auto const type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[*w]]; + INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)nodal[nodalI[*w]]; INTERP_KERNEL::computeBarycenter2(type,nodal+nodalI[*w]+1,nodalI[*w+1]-nodalI[*w]-1,coor,spaceDim,ptToFill); ptToFill+=spaceDim; } @@ -6929,8 +6907,8 @@ DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const mcIdType *beg DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const { MCAuto ret(DataArrayDouble::New()); - mcIdType const nbOfCells=getNumberOfCells(); - mcIdType const nbOfNodes(getNumberOfNodes()); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbOfNodes(getNumberOfNodes()); if(getSpaceDimension()!=3 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computePlaneEquationOf3DFaces : This method must be applied on a mesh having meshDimension equal 2 and a spaceDimension equal to 3 !"); ret->alloc(nbOfCells,4); @@ -6948,11 +6926,11 @@ DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const ,bb[3]={coor[nodal[nodalI[0]+1+2]*3+0]-coor[nodal[nodalI[0]+1+0]*3+0], coor[nodal[nodalI[0]+1+2]*3+1]-coor[nodal[nodalI[0]+1+0]*3+1], coor[nodal[nodalI[0]+1+2]*3+2]-coor[nodal[nodalI[0]+1+0]*3+2]}; - double const cc[3]={aa[1]*bb[2]-aa[2]*bb[1],aa[2]*bb[0]-aa[0]*bb[2],aa[0]*bb[1]-aa[1]*bb[0]}; + double cc[3]={aa[1]*bb[2]-aa[2]*bb[1],aa[2]*bb[0]-aa[0]*bb[2],aa[0]*bb[1]-aa[1]*bb[0]}; double aa_norm(sqrt(aa[0]*aa[0]+aa[1]*aa[1]+aa[2]*aa[2])),bb_norm(sqrt(bb[0]*bb[0]+bb[1]*bb[1]+bb[2]*bb[2])); for(int j=0;j<3;j++) { - mcIdType const nodeId(nodal[nodalI[0]+1+j]); + mcIdType nodeId(nodal[nodalI[0]+1+j]); if(nodeId>=0 && nodeId()); - mcIdType const nbOfNodesInCell(nodalI[1]-nodalI[0]-1); + mcIdType nbOfNodesInCell(nodalI[1]-nodalI[0]-1); std::transform(dd,dd+3,dd,std::bind(std::multiplies(),std::placeholders::_1,1./(double)nbOfNodesInCell)); std::copy(dd,dd+3,matrix+4*2); INTERP_KERNEL::inverseMatrix(matrix,4,matrix2); @@ -7002,12 +6980,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::Build0DMeshFromCoords(DataArrayDouble *da) if(!da) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Build0DMeshFromCoords : instance of DataArrayDouble must be not null !"); da->checkAllocated(); - std::string const name(da->getName()); + std::string name(da->getName()); MCAuto ret(MEDCouplingUMesh::New(name,0)); if(name.empty()) ret->setName("Mesh"); ret->setCoords(da); - mcIdType const nbOfTuples(da->getNumberOfTuples()); + mcIdType nbOfTuples(da->getNumberOfTuples()); MCAuto c(DataArrayIdType::New()),cI(DataArrayIdType::New()); c->alloc(2*nbOfTuples,1); cI->alloc(nbOfTuples+1,1); @@ -7028,7 +7006,7 @@ MCAuto MEDCouplingUMesh::Build1DMeshFromCoords(DataArrayDouble if(!da) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Build01MeshFromCoords : instance of DataArrayDouble must be not null !"); da->checkAllocated(); - std::string const name(da->getName()); + std::string name(da->getName()); MCAuto ret; { MCAuto tmp(MEDCouplingCMesh::New()); @@ -7082,7 +7060,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(const MEDCouplingUMesh *mesh1, */ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(const std::vector& a) { - std::size_t const sz=a.size(); + std::size_t sz=a.size(); if(sz==0) return MergeUMeshesLL(a); for(std::size_t ii=0;iigetCoords(); - int const meshDim=meshes.front()->getMeshDimension(); - auto iter=meshes.begin(); + int meshDim=meshes.front()->getMeshDimension(); + std::vector::const_iterator iter=meshes.begin(); mcIdType meshLgth=0; mcIdType meshIndexLgth=0; for(;iter!=meshes.end();iter++) @@ -7183,8 +7161,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetNodalConnectivity()->begin(); const mcIdType *index=(*iter)->getNodalConnectivityIndex()->begin(); - mcIdType const nbOfCells=(*iter)->getNumberOfCells(); - mcIdType const meshLgth2=(*iter)->getNodalConnectivityArrayLen(); + mcIdType nbOfCells=(*iter)->getNumberOfCells(); + mcIdType meshLgth2=(*iter)->getNodalConnectivityArrayLen(); nodalPtr=std::copy(nod,nod+meshLgth2,nodalPtr); if(iter!=meshes.begin()) nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind(std::plus(),std::placeholders::_1,offset)); @@ -7230,13 +7208,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector ret=MergeUMeshesOnSameCoords(meshes); MCAuto o2n=ret->zipConnectivityTraducer(compType); corr.resize(meshes.size()); - std::size_t const nbOfMeshes=meshes.size(); + std::size_t nbOfMeshes=meshes.size(); mcIdType offset=0; const mcIdType *o2nPtr=o2n->begin(); for(std::size_t i=0;igetNumberOfCells(); + mcIdType curNbOfCells=meshes[i]->getNumberOfCells(); tmp->alloc(curNbOfCells,1); std::copy(o2nPtr+offset,o2nPtr+offset+curNbOfCells,tmp->getPointer()); offset+=curNbOfCells; @@ -7261,12 +7239,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector& meshes) { - std::size_t const sz=meshes.size(); + std::size_t sz=meshes.size(); if(sz==0 || sz==1) return; std::vector< const DataArrayDouble * > coords(meshes.size()); - auto it2=coords.begin(); - for(auto it=meshes.begin();it!=meshes.end();it++,it2++) + std::vector< const DataArrayDouble * >::iterator it2=coords.begin(); + for(std::vector::const_iterator it=meshes.begin();it!=meshes.end();it++,it2++) { if((*it)) { @@ -7289,12 +7267,12 @@ void MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(const std::vector res=DataArrayDouble::Aggregate(coords); - auto it=meshes.begin(); + std::vector::const_iterator it=meshes.begin(); mcIdType offset=(*it)->getNumberOfNodes(); (*it++)->setCoords(res); for(;it!=meshes.end();it++) { - mcIdType const oldNumberOfNodes=(*it)->getNumberOfNodes(); + mcIdType oldNumberOfNodes=(*it)->getNumberOfNodes(); (*it)->setCoords(res); (*it)->shiftNodeNumbersInConn(offset); offset+=oldNumberOfNodes; @@ -7318,7 +7296,7 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vector s; - for(auto it=meshes.begin();it!=meshes.end();it++) + for(std::vector::const_iterator it=meshes.begin();it!=meshes.end();it++) { if(*it) s.insert((*it)->getCoords()); @@ -7340,16 +7318,16 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vectorfindCommonTuples(eps,-1,comm,commI); MCAuto tmp1(comm),tmp2(commI); - mcIdType const oldNbOfNodes=coo->getNumberOfTuples(); + mcIdType oldNbOfNodes=coo->getNumberOfTuples(); mcIdType newNbOfNodes; MCAuto o2n=DataArrayIdType::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes); if(oldNbOfNodes==newNbOfNodes) return ; - MCAuto const newCoords=coo->renumberAndReduce(o2n->begin(),newNbOfNodes); - for(auto meshe : meshes) + MCAuto newCoords=coo->renumberAndReduce(o2n->begin(),newNbOfNodes); + for(std::vector::const_iterator it=meshes.begin();it!=meshes.end();it++) { - meshe->renumberNodesInConn(o2n->begin()); - meshe->setCoords(newCoords); + (*it)->renumberNodesInConn(o2n->begin()); + (*it)->setCoords(newCoords); } } @@ -7361,7 +7339,7 @@ bool MEDCouplingUMesh::IsPolygonWellOriented(bool isQuadratic, const double *vec { std::size_t i, ip1; double v[3]={0.,0.,0.}; - std::size_t const sz=std::distance(begin,end); + std::size_t sz=std::distance(begin,end); if(!isQuadratic) for(i=0;i0.); } @@ -7404,15 +7382,15 @@ bool MEDCouplingUMesh::IsPolygonWellOriented(bool isQuadratic, const double *vec bool MEDCouplingUMesh::IsPolyhedronWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords) { std::vector > edges; - std::size_t const nbOfFaces=std::count(begin,end,-1)+1; + std::size_t nbOfFaces=std::count(begin,end,-1)+1; const mcIdType *bgFace=begin; for(std::size_t i=0;i const p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); + std::pair p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); if(std::find(edges.begin(),edges.end(),p1)!=edges.end()) return false; edges.push_back(p1); @@ -7428,10 +7406,10 @@ bool MEDCouplingUMesh::IsPolyhedronWellOriented(const mcIdType *begin, const mcI bool MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords) { double vec0[3],vec1[3]; - std::size_t const sz=std::distance(begin,end); + std::size_t sz=std::distance(begin,end); if(sz%2!=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented : the length of nodal connectivity of extruded cell is not even !"); - mcIdType const nbOfNodes=ToIdType(sz/2); + mcIdType nbOfNodes=ToIdType(sz/2); INTERP_KERNEL::areaVectorOfPolygon(begin,nbOfNodes,coords,vec0); const double *pt0=coords+3*begin[0]; const double *pt1=coords+3*begin[nbOfNodes]; @@ -7441,9 +7419,9 @@ bool MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented(const mcIdType *begin, void MEDCouplingUMesh::CorrectExtrudedStaticCell(mcIdType *begin, mcIdType *end) { - std::size_t const sz=std::distance(begin,end); + std::size_t sz=std::distance(begin,end); INTERP_KERNEL::AutoPtr tmp=new mcIdType[sz]; - std::size_t const nbOfNodes(sz/2); + std::size_t nbOfNodes(sz/2); std::copy(begin,end,(mcIdType *)tmp); for(std::size_t j=1;jgetIJ(index + 1, 0) - E_Fi->getIJ(index, 0); + mcIdType nbFaces = E_Fi->getIJ(index + 1, 0) - E_Fi->getIJ(index, 0); MCAuto v=DataArrayDouble::New(); v->alloc(nbFaces,3); double *vPtr=v->getPointer(); MCAuto p=DataArrayDouble::New(); p->alloc(nbFaces,2); @@ -7496,7 +7474,7 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble const mcIdType *f_idx = faces->getNodalConnectivityIndex()->getPointer(), *f_cnn = faces->getNodalConnectivity()->getPointer(); for(mcIdType i=0;ibegin(), f_cnn + f_idx[face] + 1, f_cnn + f_idx[face + 1], vPtr, pPtr); // to differentiate faces going to different cells: pPtr++, *pPtr = 0; @@ -7504,7 +7482,7 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble *pPtr += FromIdType(f_e[j]); } pPtr=p->getPointer(); vPtr=v->getPointer(); - DataArrayIdType *comm1=nullptr,*commI1=nullptr; + DataArrayIdType *comm1=0,*commI1=0; v->findCommonTuples(eps,-1,comm1,commI1); for (mcIdType i = 0; i < nbFaces; i++) if (comm1->findIdFirstEqual(i) < 0) @@ -7515,14 +7493,14 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble MCAuto comm1Auto(comm1),commI1Auto(commI1); const mcIdType *comm1Ptr=comm1->begin(); const mcIdType *commI1Ptr=commI1->begin(); - mcIdType const nbOfGrps1=commI1Auto->getNumberOfTuples()-1; + mcIdType nbOfGrps1=commI1Auto->getNumberOfTuples()-1; res->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_POLYHED)); // for(mcIdType i=0;i tmpgrp2=p->selectByTupleId(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]); - DataArrayIdType *comm2=nullptr,*commI2=nullptr; + DataArrayIdType *comm2=0,*commI2=0; tmpgrp2->findCommonTuples(eps,-1,comm2,commI2); for (mcIdType j = 0; j < commI1Ptr[i+1] - commI1Ptr[i]; j++) if (comm2->findIdFirstEqual(j) < 0) @@ -7533,18 +7511,18 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble MCAuto comm2Auto(comm2),commI2Auto(commI2); const mcIdType *comm2Ptr=comm2->begin(); const mcIdType *commI2Ptr=commI2->begin(); - mcIdType const nbOfGrps2=commI2Auto->getNumberOfTuples()-1; + mcIdType nbOfGrps2=commI2Auto->getNumberOfTuples()-1; for(mcIdType j=0;jinsertAtTheEnd(f_cnn + f_idx[face] + 1, f_cnn + f_idx[face + 1]); res->pushBackSilent(-1); } else { - mcIdType const pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]]; + mcIdType pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]]; MCAuto ids2=comm2->selectByTupleIdSafeSlice(commI2Ptr[j],commI2Ptr[j+1],1); ids2->transformWithIndArr(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]); ids2->transformWithIndArr(e_f + e_fi[index], e_f + e_fi[index + 1]); @@ -7554,17 +7532,17 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble const mcIdType *idsNodePtr=idsNode->begin(); double center[3]; center[0]=pPtr[2*pointId]*vPtr[3*vecId]; center[1]=pPtr[2*pointId]*vPtr[3*vecId+1]; center[2]=pPtr[2*pointId]*vPtr[3*vecId+2]; double vec[3]; vec[0]=vPtr[3*vecId+1]; vec[1]=-vPtr[3*vecId]; vec[2]=0.; - double const norm=vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]; + double norm=vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]; if(std::abs(norm)>eps) { - double const angle=INTERP_KERNEL::EdgeArcCircle::SafeAsin(norm); + double angle=INTERP_KERNEL::EdgeArcCircle::SafeAsin(norm); mm3->rotate(center,vec,angle); } mm3->changeSpaceDimension(2); MCAuto mm4=mm3->buildSpreadZonesWithPoly(); const mcIdType *conn4=mm4->getNodalConnectivity()->begin(); const mcIdType *connI4=mm4->getNodalConnectivityIndex()->begin(); - mcIdType const nbOfCells=mm4->getNumberOfCells(); + mcIdType nbOfCells=mm4->getNumberOfCells(); for(mcIdType k=0;keps) { refFound=true; @@ -7638,12 +7616,12 @@ void MEDCouplingUMesh::ComputeVecAndPtOfFace(double eps, const double *coords, c void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(mcIdType *begin, mcIdType *end, const double *coords) { std::list< std::pair > edgesOK,edgesFinished; - std::size_t const nbOfFaces=std::count(begin,end,-1)+1; + std::size_t nbOfFaces=std::count(begin,end,-1)+1; std::vector isPerm(nbOfFaces,false);//field on faces False: I don't know, True : oriented isPerm[0]=true; mcIdType *bgFace=begin,*endFace=std::find(begin+1,end,-1); std::size_t nbOfEdgesInFace=std::distance(bgFace,endFace); - for(std::size_t l=0;l const p1(bgFace[l],bgFace[(l+1)%nbOfEdgesInFace]); edgesOK.push_back(p1); } + for(std::size_t l=0;l p1(bgFace[l],bgFace[(l+1)%nbOfEdgesInFace]); edgesOK.push_back(p1); } // while(std::find(isPerm.begin(),isPerm.end(),false)!=isPerm.end()) { @@ -7658,10 +7636,10 @@ void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(mcIdType *begin, mcIdTy bool b=false; for(std::size_t j=0;j const p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); - std::pair const p2(p1.second,p1.first); - bool const b1=std::find(edgesOK.begin(),edgesOK.end(),p1)!=edgesOK.end(); - bool const b2=std::find(edgesOK.begin(),edgesOK.end(),p2)!=edgesOK.end(); + std::pair p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); + std::pair p2(p1.second,p1.first); + bool b1=std::find(edgesOK.begin(),edgesOK.end(),p1)!=edgesOK.end(); + bool b2=std::find(edgesOK.begin(),edgesOK.end(),p2)!=edgesOK.end(); if(b1 || b2) { b=b2; isPerm[i]=true; smthChanged++; break; } } if(isPerm[i]) @@ -7670,13 +7648,13 @@ void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(mcIdType *begin, mcIdTy std::reverse(bgFace+1,endFace); for(std::size_t j=0;j const p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); - std::pair const p2(p1.second,p1.first); + std::pair p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); + std::pair p2(p1.second,p1.first); if(std::find(edgesOK.begin(),edgesOK.end(),p1)!=edgesOK.end()) { std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str()); } if(std::find(edgesFinished.begin(),edgesFinished.end(),p1)!=edgesFinished.end() || std::find(edgesFinished.begin(),edgesFinished.end(),p2)!=edgesFinished.end()) { std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str()); } - auto const it=std::find(edgesOK.begin(),edgesOK.end(),p2); + std::list< std::pair >::iterator it=std::find(edgesOK.begin(),edgesOK.end(),p2); if(it!=edgesOK.end()) { edgesOK.erase(it); @@ -7718,11 +7696,11 @@ DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMesh() const if(getMeshDimension()!=2 || getSpaceDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildUnionOf2DMesh : meshdimension, spacedimension must be equal to 2 !"); MCAuto skin(computeSkin()); - mcIdType const oldNbOfNodes(skin->getNumberOfNodes()); + mcIdType oldNbOfNodes(skin->getNumberOfNodes()); MCAuto o2n(skin->zipCoordsTraducer()); - mcIdType const nbOfNodesExpected(skin->getNumberOfNodes()); + mcIdType nbOfNodesExpected(skin->getNumberOfNodes()); MCAuto n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes)); - mcIdType const nbCells=skin->getNumberOfCells(); + mcIdType nbCells=skin->getNumberOfCells(); if(nbCells==nbOfNodesExpected) return buildUnionOf2DMeshLinear(skin,n2o); else if(2*nbCells==nbOfNodesExpected) @@ -7744,7 +7722,7 @@ DataArrayIdType *MEDCouplingUMesh::buildUnionOf3DMesh() const MCAuto m=computeSkin(); const mcIdType *conn=m->getNodalConnectivity()->begin(); const mcIdType *connI=m->getNodalConnectivityIndex()->begin(); - mcIdType const nbOfCells=m->getNumberOfCells(); + mcIdType nbOfCells=m->getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1); mcIdType *work=ret->getPointer(); *work++=INTERP_KERNEL::NORM_POLYHED; if(nbOfCells<1) @@ -7772,7 +7750,7 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const { checkConnectivityFullyDefined(); - int const meshDim = this->getMeshDimension(); + int meshDim = this->getMeshDimension(); MEDCoupling::DataArrayIdType* indexr=MEDCoupling::DataArrayIdType::New(); MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New(); this->getReverseNodalConnectivity(revConn,indexr); @@ -7783,7 +7761,7 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const const MEDCoupling::DataArrayIdType* conn; conn=this->getNodalConnectivity(); // it includes a type as the 1st element!!! index=this->getNodalConnectivityIndex(); - mcIdType const nbCells=this->getNumberOfCells(); + mcIdType nbCells=this->getNumberOfCells(); const mcIdType* index_ptr=index->begin(); const mcIdType* conn_ptr=conn->begin(); @@ -7806,11 +7784,11 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const std::map counter; for (mcIdType iconn=index_ptr[icell]+1; iconn::iterator iter=counter.find(icell2); if (iter!=counter.end()) (iter->second)++; else counter.insert(std::make_pair(icell2,1)); } @@ -7837,7 +7815,7 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(nbOfCells<=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::writeVTK : the unstructured mesh has no cells !"); ofs << " <" << getVTKDataSetType() << ">\n"; @@ -7875,19 +7853,19 @@ void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData } else { - mcIdType const deltaFaceOffset=cIPtr[i+1]-cIPtr[i]+1; + mcIdType deltaFaceOffset=cIPtr[i+1]-cIPtr[i]+1; *w1=szFaceOffsets+deltaFaceOffset; szFaceOffsets+=deltaFaceOffset; std::set c(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1]); c.erase(-1); *w3=szConn+ToIdType(c.size()); szConn+=ToIdType(c.size()); w4=std::copy(c.begin(),c.end(),w4); } } - std::unique_ptr const medcoupling2vtkTypeTraducer_mcIdType(new mcIdType[MEDCOUPLING2VTKTYPETRADUCER_LGTH]); + std::unique_ptr medcoupling2vtkTypeTraducer_mcIdType(new mcIdType[MEDCOUPLING2VTKTYPETRADUCER_LGTH]); for(auto ii = 0; iitransformWithIndArr(medcoupling2vtkTypeTraducer_mcIdType.get(),medcoupling2vtkTypeTraducer_mcIdType.get()+MEDCOUPLING2VTKTYPETRADUCER_LGTH); types->writeVTK(ofs,8,"UInt8","types",byteData); - std::string const vtkTypeName = Traits::VTKReprStr; + std::string vtkTypeName = Traits::VTKReprStr; offsets->writeVTK(ofs,8,vtkTypeName,"offsets",byteData); if(szFaceOffsets!=0) {//presence of Polyhedra @@ -7898,9 +7876,9 @@ void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData for(mcIdType i=0;iisAllocated()) { stream << std::endl << "Nodal connectivity set but not allocated !"; return ; } - mcIdType const lgth=_nodal_connec_index->getNumberOfTuples(); - std::size_t const cpt=_nodal_connec_index->getNumberOfComponents(); + mcIdType lgth=_nodal_connec_index->getNumberOfTuples(); + std::size_t cpt=_nodal_connec_index->getNumberOfComponents(); if(cpt!=1 || lgth<1) return ; stream << std::endl << "Number of cells : " << lgth-1 << "."; @@ -7981,11 +7959,11 @@ DataArrayIdType *MEDCouplingUMesh::orderConsecutiveCells1D() const MCAuto _dsi(_rDI->deltaShiftIndex()); const mcIdType * dsi(_dsi->begin()); MCAuto dsii = _dsi->findIdsNotInRange(0,3); - m_points=nullptr; + m_points=0; if (dsii->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D only work with a mesh being a (piecewise) connected line!"); - mcIdType const nc=getNumberOfCells(); + mcIdType nc=getNumberOfCells(); MCAuto result(DataArrayIdType::New()); result->alloc(nc,1); @@ -8027,7 +8005,7 @@ DataArrayIdType *MEDCouplingUMesh::orderConsecutiveCells1D() const activeSeg = (seg1 == activeSeg) ? seg2 : seg1; //for piecewise meshes made up of closed parts - bool const segmentAlreadyTreated = (std::find(linePiece.begin(), linePiece.end(), activeSeg) != linePiece.end()); + bool segmentAlreadyTreated = (std::find(linePiece.begin(), linePiece.end(), activeSeg) != linePiece.end()); if(segmentAlreadyTreated) break; } @@ -8070,12 +8048,12 @@ mcIdType MEDCouplingUMesh::split2DCells(const DataArrayIdType *desc, const DataA desc->checkAllocated(); descI->checkAllocated(); subNodesInSeg->checkAllocated(); subNodesInSegI->checkAllocated(); if(getSpaceDimension()!=2 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split2DCells : This method only works for meshes with spaceDim=2 and meshDim=2 !"); - if(midOpt==nullptr && midOptI==nullptr) + if(midOpt==0 && midOptI==0) { split2DCellsLinear(desc,descI,subNodesInSeg,subNodesInSegI); return 0; } - else if(midOpt!=nullptr && midOptI!=nullptr) + else if(midOpt!=0 && midOptI!=0) return split2DCellsQuadratic(desc,descI,subNodesInSeg,subNodesInSegI,midOpt,midOptI); else throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split2DCells : middle parameters must be set to null for all or not null for all."); @@ -8092,7 +8070,7 @@ mcIdType MEDCouplingUMesh::split2DCells(const DataArrayIdType *desc, const DataA */ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, DataArrayIdType *nodalConnecOut) { - std::size_t const sz=std::distance(nodalConnBg,nodalConnEnd); + std::size_t sz=std::distance(nodalConnBg,nodalConnEnd); if(sz>=4) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)*nodalConnBg); @@ -8128,7 +8106,7 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co if(*node!=tmpOut.back() && *node!=prevNode) { tmp2[0]=coords[2*(*node)]-coords[2*tmpOut.back()]; tmp2[1]=coords[2*(*node)+1]-coords[2*tmpOut.back()+1]; - double const angleM=INTERP_KERNEL::EdgeArcCircle::GetAbsoluteAngle(tmp2,tmp1); + double angleM=INTERP_KERNEL::EdgeArcCircle::GetAbsoluteAngle(tmp2,tmp1); double res; if(angleM<=angle0) res=angle0-angleM; @@ -8152,7 +8130,7 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co } } std::vector tmp3(2*(sz-1)); - auto const it=std::copy(nodalConnBg+1,nodalConnEnd,tmp3.begin()); + std::vector::iterator it=std::copy(nodalConnBg+1,nodalConnEnd,tmp3.begin()); std::copy(nodalConnBg+1,nodalConnEnd,it); if(std::search(tmp3.begin(),tmp3.end(),tmpOut.begin(),tmpOut.end())!=tmp3.end()) { @@ -8218,7 +8196,7 @@ DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(const mcId nbOfDepthPeelingPerformed=0; if(!arrIndxIn) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed : arrIndxIn input pointer is NULL !"); - mcIdType const nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; if(nbOfTuples<=0) { DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(0,1); @@ -8243,8 +8221,8 @@ DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(const mcId MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const { checkFullyDefined(); - int const mdim=getMeshDimension(); - int const spaceDim=getSpaceDimension(); + int mdim=getMeshDimension(); + int spaceDim=getSpaceDimension(); if(mdim!=spaceDim) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSpreadZonesWithPoly : meshdimension and spacedimension do not match !"); std::vector partition=partitionBySpreadZone(); @@ -8254,9 +8232,9 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const ret->setCoords(getCoords()); ret->allocateCells(ToIdType(partition.size())); // - for(auto it : partition) + for(std::vector::const_iterator it=partition.begin();it!=partition.end();it++) { - MCAuto tmp=static_cast(buildPartOfMySelf(it->begin(),it->end(),true)); + MCAuto tmp=static_cast(buildPartOfMySelf((*it)->begin(),(*it)->end(),true)); MCAuto cell; switch(mdim) { @@ -8284,7 +8262,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const */ std::vector MEDCouplingUMesh::partitionBySpreadZone() const { - DataArrayIdType *neigh=nullptr,*neighI=nullptr; + DataArrayIdType *neigh=0,*neighI=0; computeNeighborsOfCells(neigh,neighI); MCAuto neighAuto(neigh),neighIAuto(neighI); return PartitionBySpreadZone(neighAuto,neighIAuto); @@ -8295,10 +8273,10 @@ std::vector MEDCouplingUMesh::PartitionBySpreadZone(const Dat if(!arrIn || !arrIndxIn) throw INTERP_KERNEL::Exception("PartitionBySpreadZone : null input pointers !"); arrIn->checkAllocated(); arrIndxIn->checkAllocated(); - mcIdType const nbOfTuples(arrIndxIn->getNumberOfTuples()); + mcIdType nbOfTuples(arrIndxIn->getNumberOfTuples()); if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1 || nbOfTuples<1) throw INTERP_KERNEL::Exception("PartitionBySpreadZone : invalid arrays in input !"); - mcIdType const nbOfCellsCur(nbOfTuples-1); + mcIdType nbOfCellsCur(nbOfTuples-1); std::vector ret; if(nbOfCellsCur<=0) return ret; @@ -8311,8 +8289,8 @@ std::vector MEDCouplingUMesh::PartitionBySpreadZone(const Dat ret2.push_back(ComputeSpreadZoneGraduallyFromSeedAlg(fetchedCells,&seed,&seed+1,arrIn,arrIndxIn,-1,nbOfPeelPerformed)); seed=ToIdType(std::distance(fetchedCells.begin(),std::find(fetchedCells.begin()+seed,fetchedCells.end(),false))); } - for(auto & it : ret2) - ret.push_back(it.retn()); + for(std::vector< MCAuto >::iterator it=ret2.begin();it!=ret2.end();it++) + ret.push_back((*it).retn()); return ret; } @@ -8327,7 +8305,7 @@ std::vector MEDCouplingUMesh::PartitionBySpreadZone(const Dat DataArrayIdType *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vector& code) { MCAuto ret=DataArrayIdType::New(); - std::size_t const nb=code.size()/3; + std::size_t nb=code.size()/3; if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeRangesFromTypeDistribution : invalid input code !"); ret->alloc(nb,2); @@ -8366,11 +8344,11 @@ DataArrayIdType *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std:: */ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayIdType *& n2oCells, mcIdType& nbOfAdditionalPoints) const { - auto const pol((INTERP_KERNEL::SplittingPolicy)policy); + INTERP_KERNEL::SplittingPolicy pol((INTERP_KERNEL::SplittingPolicy)policy); checkConnectivityFullyDefined(); if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tetrahedrize : only available for mesh with meshdim == 3 and spacedim == 3 !"); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); mcIdType nbNodes(getNumberOfNodes()); MCAuto ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4)); MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfCells,1); @@ -8384,13 +8362,13 @@ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayIdType { std::vector a; std::vector b; INTERP_KERNEL::SplitIntoTetras(pol,(INTERP_KERNEL::NormalizedCellType)oldc[oldci[0]],oldc+oldci[0]+1,oldc+oldci[1],coords,a,b); - std::size_t const nbOfTet(a.size()/4); *retPt=ToIdType(nbOfTet); + std::size_t nbOfTet(a.size()/4); *retPt=ToIdType(nbOfTet); const mcIdType *aa(&a[0]); if(!b.empty()) { - for(long & it : a) - if(it<0) - it=(-it-1+nbNodes); + for(std::vector::iterator it=a.begin();it!=a.end();it++) + if(*it<0) + *it=(-(*(it))-1+nbNodes); addPts->insertAtTheEnd(b.begin(),b.end()); nbNodes+=ToIdType(b.size()/3); } @@ -8451,7 +8429,7 @@ MEDCouplingUMeshCell *MEDCouplingUMeshCellIterator::nextt() return _cell; } else - return nullptr; + return 0; } MEDCouplingUMeshCellByTypeEntry::MEDCouplingUMeshCellByTypeEntry(MEDCouplingUMesh *mesh):_mesh(mesh) @@ -8522,17 +8500,17 @@ MEDCouplingUMeshCellEntry *MEDCouplingUMeshCellByTypeIterator::nextt() const mcIdType *ci=_mesh->getNodalConnectivityIndex()->begin(); if(_cell_id<_nb_cell) { - auto const type=(INTERP_KERNEL::NormalizedCellType)c[ci[_cell_id]]; - mcIdType const nbOfElems=ToIdType(std::distance(ci+_cell_id,std::find_if(ci+_cell_id,ci+_nb_cell,MEDCouplingImpl::ConnReader(c,type)))); - mcIdType const startId=_cell_id; + INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[_cell_id]]; + mcIdType nbOfElems=ToIdType(std::distance(ci+_cell_id,std::find_if(ci+_cell_id,ci+_nb_cell,MEDCouplingImpl::ConnReader(c,type)))); + mcIdType startId=_cell_id; _cell_id+=nbOfElems; return new MEDCouplingUMeshCellEntry(_mesh,type,_cell,startId,_cell_id); } else - return nullptr; + return 0; } -MEDCouplingUMeshCell::MEDCouplingUMeshCell(MEDCouplingUMesh *mesh):_conn(nullptr),_conn_indx(nullptr),_conn_lgth(NOTICABLE_FIRST_VAL) +MEDCouplingUMeshCell::MEDCouplingUMeshCell(MEDCouplingUMesh *mesh):_conn(0),_conn_indx(0),_conn_lgth(NOTICABLE_FIRST_VAL) { if(mesh) { @@ -8578,7 +8556,7 @@ const mcIdType *MEDCouplingUMeshCell::getAllConn(mcIdType& lgth) const if(_conn_lgth!=NOTICABLE_FIRST_VAL) return _conn; else - return nullptr; + return 0; } /// @cond INTERNAL @@ -8647,8 +8625,8 @@ namespace MEDCouplingImpl const mcIdType * revInd = revNodalIndx[ iM ]->begin(); const mcIdType * rev = revNodal [ iM ]->begin(); - mcIdType const nbRevFaces0 = revInd[ n0 + 1 ] - revInd[ n0 ]; - mcIdType const nbRevFaces1 = revInd[ n1 + 1 ] - revInd[ n1 ]; + mcIdType nbRevFaces0 = revInd[ n0 + 1 ] - revInd[ n0 ]; + mcIdType nbRevFaces1 = revInd[ n1 + 1 ] - revInd[ n1 ]; prevNbF = facesByEdge.size(); facesByEdge.resize( prevNbF + std::max( nbRevFaces0, nbRevFaces1 )); @@ -8678,7 +8656,7 @@ namespace MEDCouplingImpl { if ( facesByEdge[ i0 ] == theUndefID ) continue; - mcIdType const objFaceID = MEDCouplingImpl::encodeID( facesByEdge[ i0 ], 0 ); + mcIdType objFaceID = MEDCouplingImpl::encodeID( facesByEdge[ i0 ], 0 ); bool isInputFace = ( objFaceID == inputFaceID ); for ( size_t i1 = prevNbF; i1 < facesByEdge.size(); ++i1 ) @@ -8686,10 +8664,10 @@ namespace MEDCouplingImpl if ( facesByEdge[ i1 ] == theUndefID ) continue; - mcIdType const f0 = facesByEdge[ i0 ]; - mcIdType const f1 = facesByEdge[ i1 ]; - size_t const nbNodes0 = connI[0][ f0 + 1 ] - connI[0][ f0 ] - 1; - size_t const nbNodes1 = connI[1][ f1 + 1 ] - connI[1][ f1 ] - 1; + mcIdType f0 = facesByEdge[ i0 ]; + mcIdType f1 = facesByEdge[ i1 ]; + size_t nbNodes0 = connI[0][ f0 + 1 ] - connI[0][ f0 ] - 1; + size_t nbNodes1 = connI[1][ f1 + 1 ] - connI[1][ f1 ] - 1; if ( nbNodes0 != nbNodes1 ) continue; @@ -8698,7 +8676,7 @@ namespace MEDCouplingImpl if ( std::equal( fConn0, fConn0 + nbNodes0, fConn1 )) { // equal faces; remove an object one - mcIdType const refFaceID = MEDCouplingImpl::encodeID( facesByEdge[ i1 ], 1 ); + mcIdType refFaceID = MEDCouplingImpl::encodeID( facesByEdge[ i1 ], 1 ); if ( refFaceID == inputFaceID ) isInputFace = true; @@ -8797,7 +8775,7 @@ namespace MEDCouplingImpl MEDCouplingUMesh* mesh[] ) { int iMesh; - mcIdType const iF = decodeID( iFEnc, iMesh ); + mcIdType iF = decodeID( iFEnc, iMesh ); const mcIdType *conn = mesh[ iMesh ]->getNodalConnectivity()->getConstPointer(); const mcIdType *connI = mesh[ iMesh ]->getNodalConnectivityIndex()->getConstPointer(); @@ -8808,10 +8786,10 @@ namespace MEDCouplingImpl auto it1 = std::find( conn + connI[ iF ] + 1, conn + connI[ iF + 1 ], n1 ); - long const i0 = it0 - conn; - long const i1 = it1 - conn; + long i0 = it0 - conn; + long i1 = it1 - conn; - bool const isRev = ( std::abs( i1 - i0 ) == 1 ) ? i1 < i0 : i0 < i1; + bool isRev = ( std::abs( i1 - i0 ) == 1 ) ? i1 < i0 : i0 < i1; return isRev; } @@ -8826,7 +8804,7 @@ namespace MEDCouplingImpl void reverseFace( mcIdType iFEnc, MEDCouplingUMesh* mesh[] ) { int iMesh; - mcIdType const face = decodeID( iFEnc, iMesh ); + mcIdType face = decodeID( iFEnc, iMesh ); mcIdType *conn = mesh[ iMesh ]->getNodalConnectivity()->getPointer(); mcIdType *connI = mesh[ iMesh ]->getNodalConnectivityIndex()->getPointer(); @@ -8922,11 +8900,11 @@ void MEDCouplingUMesh::orientCorrectly2DCells(const MEDCouplingUMesh* refFaces) break; } - mcIdType const fID = faceQueue.back(); + mcIdType fID = faceQueue.back(); faceQueue.pop_back(); int iMesh, iMesh2; - mcIdType const refFace = MEDCouplingImpl::decodeID( fID, iMesh ); + mcIdType refFace = MEDCouplingImpl::decodeID( fID, iMesh ); nbFacesToCheck[iMesh]--; @@ -8940,7 +8918,7 @@ void MEDCouplingUMesh::orientCorrectly2DCells(const MEDCouplingUMesh* refFaces) mcIdType n0 = faceNodes[ nbEdges - 1 ]; // 1st node of edge for ( int edge = 0; edge < nbEdges; ++edge ) { - mcIdType const n1 = faceNodes[ edge ]; // 2nd node of edge + mcIdType n1 = faceNodes[ edge ]; // 2nd node of edge // get faces sharing the edge MEDCouplingImpl::getFacesOfEdge( n0, n1, fID, mesh, revNodal, revNodalIndx, @@ -8960,7 +8938,7 @@ void MEDCouplingUMesh::orientCorrectly2DCells(const MEDCouplingUMesh* refFaces) MEDCouplingImpl::reverseFace( facesByEdge[0], mesh ); } - mcIdType const face2 = MEDCouplingImpl::decodeID( facesByEdge[0], iMesh2 ); + mcIdType face2 = MEDCouplingImpl::decodeID( facesByEdge[0], iMesh2 ); if ( !isFaceQueued[iMesh2][face2] ) { isFaceQueued[iMesh2][face2] = true; @@ -8972,12 +8950,12 @@ void MEDCouplingUMesh::orientCorrectly2DCells(const MEDCouplingUMesh* refFaces) // remove face and equalFaces from revNodal in order not to treat them again equalFaces.push_back( fID ); - for ( mcIdType const face : equalFaces ) + for ( mcIdType face : equalFaces ) { - mcIdType const f = MEDCouplingImpl::decodeID( face, iMesh2 ); + mcIdType f = MEDCouplingImpl::decodeID( face, iMesh2 ); const mcIdType *conn = mesh[iMesh2]->getNodalConnectivity()->getConstPointer(); const mcIdType *connI = mesh[iMesh2]->getNodalConnectivityIndex()->getConstPointer(); - mcIdType const nbNodes = connI[ f + 1 ] - connI[ f ] - 1; + mcIdType nbNodes = connI[ f + 1 ] - connI[ f ] - 1; for ( const mcIdType* n = conn + connI[ f ] + 1, *nEnd = n + nbNodes; n < nEnd; ++n ) MEDCouplingImpl::removeFromRevNodal( *n, f, // not to treat f again diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 804a9c99d..ca5612fa8 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -20,28 +20,13 @@ #pragma once -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "InterpKernelHashMap.hxx" #include "MEDCoupling.hxx" -#include "MEDCouplingMesh.hxx" #include "MEDCouplingPointSet.hxx" #include "MEDCouplingMemArray.hxx" #include "CellModel.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "NormalizedGeometricTypes" -#include -#include -#include -#include -#include #include -#include -#include -#include -#include namespace MEDCoupling { @@ -58,20 +43,20 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const std::string& meshName, int meshDim); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingUMesh"); } // Copy methods - MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopy() const override; - MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const override; - MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopyConnectivityOnly() const override; + MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopy() const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopyConnectivityOnly() const; - MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) override; - MEDCOUPLING_EXPORT void updateTime() const override; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const override { return UNSTRUCTURED; } - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const override; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const override; - MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const override; - MEDCOUPLING_EXPORT void checkConsistencyLight() const override; - MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const override; + MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other); + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED; } + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; + MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; MEDCOUPLING_EXPORT void checkGeomConsistency(double eps=1e-12) const; MEDCOUPLING_EXPORT void setMeshDimension(int meshDim); MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0); @@ -79,7 +64,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void finishInsertingCells(); MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator *cellIterator(); MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeEntry *cellsByType(); - MEDCOUPLING_EXPORT std::set getAllGeoTypes() const override; + MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; MEDCOUPLING_EXPORT std::vector getAllGeoTypesSorted() const; MEDCOUPLING_EXPORT std::set getTypesOfPart(const mcIdType *begin, const mcIdType *end) const; MEDCOUPLING_EXPORT void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true); @@ -87,30 +72,30 @@ namespace MEDCoupling MEDCOUPLING_EXPORT const DataArrayIdType *getNodalConnectivityIndex() const { return _nodal_connec_index; } MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() { return _nodal_connec; } MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivityIndex() { return _nodal_connec_index; } - MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const override; - MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const override; - MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const override; - MEDCOUPLING_EXPORT std::string simpleRepr() const override; - MEDCOUPLING_EXPORT std::string advancedRepr() const override; + MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const; + MEDCOUPLING_EXPORT std::string simpleRepr() const; + MEDCOUPLING_EXPORT std::string advancedRepr() const; MEDCOUPLING_EXPORT std::string cppRepr() const; MEDCOUPLING_EXPORT std::string reprConnectivityOfThis() const; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const; - MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const override; - MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const override; - MEDCOUPLING_EXPORT int getMeshDimension() const override; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const; + MEDCOUPLING_EXPORT int getMeshDimension() const; MEDCOUPLING_EXPORT mcIdType getNodalConnectivityArrayLen() const; MEDCOUPLING_EXPORT void computeTypes(); //! size of returned tinyInfo must be always the same. - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const override; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const override; - MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const override; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) override; - MEDCOUPLING_EXPORT std::string getVTKDataSetType() const override; - MEDCOUPLING_EXPORT std::string getVTKFileExtension() const override; - MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const override; - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const override; + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings); + MEDCOUPLING_EXPORT std::string getVTKDataSetType() const; + MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; + MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; //tools MEDCOUPLING_EXPORT static int AreCellsEqual(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2, int compType); MEDCOUPLING_EXPORT static int AreCellsEqualPolicy0(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2); @@ -126,17 +111,17 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void colinearizeEdges(double eps); MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSpreadZonesWithPoly() const; MEDCOUPLING_EXPORT std::vector partitionBySpreadZone() const; - MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const override; - MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const override; - MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector& nodeIdsInUse) const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const override; - MEDCOUPLING_EXPORT DataArrayIdType *zipCoordsTraducer() override; - MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const override; + MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const; + MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const; + MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector& nodeIdsInUse) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *zipCoordsTraducer(); + MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const; MEDCOUPLING_EXPORT bool areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayIdType *& arr) const; MEDCOUPLING_EXPORT bool areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayIdType *& arr) const; - MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const override; + MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const; MEDCOUPLING_EXPORT MCAuto explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& revDescIndx) const; MEDCOUPLING_EXPORT MCAuto explodeMeshTo(int targetDeltaLevel, MCAuto& desc, MCAuto& descIndx, MCAuto& revDesc, MCAuto& revDescIndx) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; @@ -149,15 +134,15 @@ namespace MEDCoupling DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx); MEDCOUPLING_EXPORT void computeNeighborsOfNodes(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx) const; MEDCOUPLING_EXPORT void computeEnlargedNeighborsOfNodes(MCAuto &neighbors, MCAuto& neighborsIdx) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const override; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords=true) const override; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords=true) const override; + MEDCOUPLING_EXPORT MEDCouplingUMesh *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords=true) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords=true) const; MEDCOUPLING_EXPORT void setPartOfMySelf(const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis); MEDCOUPLING_EXPORT void setPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, const MEDCouplingUMesh& otherOnSameCoordsThanThis); - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildFacePartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const override; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const override; - MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const override; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildBoundaryMesh(bool keepCoords) const override; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildFacePartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; + MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildBoundaryMesh(bool keepCoords) const; MEDCOUPLING_EXPORT DataArrayIdType *findCellIdsOnBoundary() const; MEDCOUPLING_EXPORT void findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *&cellIdsRk0, DataArrayIdType *&cellIdsRk1) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *computeSkin() const; @@ -165,19 +150,19 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnSameCoords, const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd, DataArrayIdType *& cellIdsNeededToBeRenum, DataArrayIdType *& cellIdsNotModified) const; MEDCOUPLING_EXPORT void duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd); - MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset) override; - MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) override; - MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N) override; + MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset); + MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N); + MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N); MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& newNodeNumbersO2N) override; MEDCOUPLING_EXPORT void shiftNodeNumbersInConn(mcIdType delta); MEDCOUPLING_EXPORT void duplicateNodesInConn(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd, mcIdType offset); - MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true) override; - MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const override; - MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const override; + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const; + MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps); + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; MEDCOUPLING_EXPORT DataArrayDouble *getPartMeasureField(bool isAbs, const mcIdType *begin, const mcIdType *end) const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const override; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const override; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildPartOrthogonalField(const mcIdType *begin, const mcIdType *end) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildDirectionVectorField() const; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3D(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const; @@ -188,15 +173,15 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void project1D(const double *pt, const double *v, double eps, double *res) const; MEDCOUPLING_EXPORT double distanceToPoint(const double *ptBg, const double *ptEnd, mcIdType& cellId) const; MEDCOUPLING_EXPORT DataArrayDouble *distanceToPoints(const DataArrayDouble *pts, DataArrayIdType *& cellIds) const; - MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const override; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const override; + MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const override; MEDCOUPLING_EXPORT void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const override; MEDCOUPLING_EXPORT void checkButterflyCells(std::vector& cells, double eps=1e-12) const; MEDCOUPLING_EXPORT DataArrayIdType *convexEnvelop2D(); MEDCOUPLING_EXPORT DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells(); MEDCOUPLING_EXPORT DataArrayIdType *findAndCorrectBadOriented3DCells(); - MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const override; + MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const; MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTreeFast() const; MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const; MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const; @@ -207,7 +192,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0); MEDCOUPLING_EXPORT void tessellate2D(double eps); MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *tetrahedrize(int policy, DataArrayIdType *& n2oCells, mcIdType& nbOfAdditionalPoints) const; - MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy) override; + MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy); MEDCOUPLING_EXPORT bool areOnlySimplexCells() const; MEDCOUPLING_EXPORT void convertDegeneratedCells(); MEDCOUPLING_EXPORT DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes(); @@ -218,7 +203,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void changeOrientationOfCells(); MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector& cells) const; MEDCOUPLING_EXPORT void orientCorrectlyPolyhedrons(); - MEDCOUPLING_EXPORT void invertOrientationOfAllCells() override; + MEDCOUPLING_EXPORT void invertOrientationOfAllCells(); MEDCOUPLING_EXPORT void getFastAveragePlaneOfThis(double *vec, double *pos) const; MEDCOUPLING_EXPORT void attractSeg3MidPtsAroundNodes(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd); //Mesh quality @@ -226,11 +211,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getAspectRatioField() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getWarpField() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getSkewField() const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const override; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const; //utilities for MED File RW - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const override; - MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const override; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const override; + MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; + MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *&revDesc, DataArrayIdType *&revDescIndx, DataArrayIdType *& nM1LevMeshIds, DataArrayIdType *&meshnM1Old2New) const; MEDCOUPLING_EXPORT DataArrayIdType *sortCellsInMEDFileFrmt(); MEDCOUPLING_EXPORT bool checkConsecutiveCellTypes() const; @@ -252,17 +237,17 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingUMesh *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const mcIdType *idsPerGeoTypeBg, const mcIdType *idsPerGeoTypeEnd) const; MEDCOUPLING_EXPORT std::vector getQuadraticStatus() const; // - MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const override; - MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const override; + MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps) const; - MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const override; + MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const mcIdType *begin, const mcIdType *end) const; MEDCOUPLING_EXPORT DataArrayDouble *computePlaneEquationOf3DFaces() const; MEDCOUPLING_EXPORT DataArrayIdType *conformize2D(double eps); MEDCOUPLING_EXPORT DataArrayIdType *colinearize2D(double eps); MEDCOUPLING_EXPORT DataArrayIdType *colinearizeKeepingConform2D(double eps); MEDCOUPLING_EXPORT DataArrayIdType *conformize3D(double eps); - MEDCOUPLING_EXPORT mcIdType split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=nullptr, const DataArrayIdType *midOptI=nullptr); + MEDCOUPLING_EXPORT mcIdType split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0); MEDCOUPLING_EXPORT static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da); MEDCOUPLING_EXPORT static MCAuto Build1DMeshFromCoords(DataArrayDouble *da); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2); @@ -299,8 +284,8 @@ namespace MEDCoupling MEDCouplingUMesh(); MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy); - ~MEDCouplingUMesh() override; - void checkFullyDefined() const override; + ~MEDCouplingUMesh(); + void checkFullyDefined() const; void checkConnectivityFullyDefined() const; void reprConnectivityOfThisLL(std::ostringstream& stream) const; //tools @@ -311,7 +296,7 @@ namespace MEDCoupling void tessellate2DInternal(double eps); void tessellate2DCurveInternal(double eps); void subDivide2DMesh(const mcIdType *nodeSubdived, const mcIdType *nodeIndxSubdived, const mcIdType *desc, const mcIdType *descIndex); - void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const override; + void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const; void split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector& cut3DCurve); MEDCouplingUMesh *buildExtrudedMeshFromThisLowLev(mcIdType nbOfNodesOf1Lev, bool isQuad) const; DataArrayDouble *fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const; @@ -319,8 +304,8 @@ namespace MEDCoupling DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation2D(const MEDCouplingUMesh *mesh1D, bool isQuad) const; DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation3D(const MEDCouplingUMesh *mesh1D, bool isQuad) const; static bool AreCellsEqualInPool(const std::vector& candidates, int compType, const mcIdType *conn, const mcIdType *connI, DataArrayIdType *result) ; - MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const override; - MEDCouplingUMesh *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const override; + MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const; + MEDCouplingUMesh *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const; DataArrayIdType *convertLinearCellsToQuadratic1D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; DataArrayIdType *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayIdType *desc, const DataArrayIdType *descI, DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; DataArrayIdType *convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; @@ -338,7 +323,7 @@ namespace MEDCoupling /// @cond INTERNAL static void DeleteCellTypeInIndexedArray(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, MCAuto& arrOut, MCAuto& arrIndxOut); static MEDCouplingUMesh *MergeUMeshesLL(const std::vector& a); - using DimM1DescNbrer = mcIdType (*)(mcIdType, mcIdType, const INTERP_KERNEL::CellModel &, bool, const mcIdType *, const mcIdType *); + typedef mcIdType (*DimM1DescNbrer)(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2); template MEDCouplingUMesh *buildDescendingConnectivityGen(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx, DimM1DescNbrer nbrer) const; static void DistanceToPoint3DSurfAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId); diff --git a/src/MEDCoupling/MEDCouplingUMesh.txx b/src/MEDCoupling/MEDCouplingUMesh.txx index 4ba20b4b5..438db20d7 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.txx +++ b/src/MEDCoupling/MEDCouplingUMesh.txx @@ -19,8 +19,6 @@ // Author : Anthony Geay (EDF R&D) #pragma once -#include "MCType.hxx" -#include "MCIdType.hxx" #include "MEDCouplingUMesh.hxx" #include @@ -31,7 +29,7 @@ void MEDCoupling::MEDCouplingUMesh::renumberNodesInConnT(const MAPCLS& newNodeNu checkConnectivityFullyDefined(); mcIdType *conn(getNodalConnectivity()->getPointer()); const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer()); - mcIdType const nbOfCells=ToIdType(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); for(mcIdType i=0;i -#include -#include -#include -#include -#include -#include #include +#include +#include #include #include -#include -#include +#include using namespace MEDCoupling; @@ -72,9 +72,9 @@ void MEDCouplingUMesh::checkConnectivityFullyDefined() const void MEDCouplingUMesh::reprConnectivityOfThisLL(std::ostringstream& stream) const { - if(_nodal_connec!=nullptr && _nodal_connec_index!=nullptr) + if(_nodal_connec!=0 && _nodal_connec_index!=0) { - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *c=_nodal_connec->getConstPointer(); const mcIdType *ci=_nodal_connec_index->getConstPointer(); for(mcIdType i=0;i ret=DataArrayIdType::New(); - mcIdType const nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); + mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); ret->alloc(nbOfCells+nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } mcIdType *retPt=ret->getPointer(); @@ -151,9 +151,9 @@ DataArrayIdType *MEDCouplingUMesh::simplexizePol1() checkConnectivityFullyDefined(); if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !"); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); - mcIdType const nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); + mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); ret->alloc(nbOfCells+nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } mcIdType *retPt=ret->getPointer(); @@ -204,9 +204,9 @@ DataArrayIdType *MEDCouplingUMesh::simplexizePlanarFace5() checkConnectivityFullyDefined(); if(getMeshDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace5 : this policy is only available for mesh with meshdim == 3 !"); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); - mcIdType const nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); + mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); ret->alloc(nbOfCells+4*nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } mcIdType *retPt=ret->getPointer(); @@ -256,9 +256,9 @@ DataArrayIdType *MEDCouplingUMesh::simplexizePlanarFace6() checkConnectivityFullyDefined(); if(getMeshDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace6 : this policy is only available for mesh with meshdim == 3 !"); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto ret=DataArrayIdType::New(); - mcIdType const nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); + mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); ret->alloc(nbOfCells+5*nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } mcIdType *retPt=ret->getPointer(); @@ -319,12 +319,12 @@ void MEDCouplingUMesh::tessellate2DInternal(double eps) checkFullyDefined(); if(getMeshDimension()!=2 || getSpaceDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DInternal works on umeshes with meshdim equal to 2 and spaceDim equal to 2 too!"); - double const epsa=fabs(eps); + double epsa=fabs(eps); if(epsa::min()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !"); MCAuto desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()); MCAuto mDesc(buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1)); - revDesc1=nullptr; revDescIndx1=nullptr; + revDesc1=0; revDescIndx1=0; mDesc->tessellate2D(eps); subDivide2DMesh(mDesc->_nodal_connec->begin(),mDesc->_nodal_connec_index->begin(),desc1->begin(),descIndx1->begin()); setCoords(mDesc->getCoords()); @@ -345,12 +345,12 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) checkFullyDefined(); if(getMeshDimension()!=1 || getSpaceDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DCurveInternal works on umeshes with meshdim equal to 1 and spaceDim equal to 2 too!"); - double const epsa=fabs(eps); + double epsa=fabs(eps); if(epsa::min()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DCurveInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !"); - INTERP_KERNEL::QuadraticPlanarPrecision const arcPrec(1.e-10); // RAII - mcIdType const nbCells=getNumberOfCells(); - mcIdType const nbNodes=getNumberOfNodes(); + INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(1.e-10); // RAII + mcIdType nbCells=getNumberOfCells(); + mcIdType nbNodes=getNumberOfNodes(); const mcIdType *conn=_nodal_connec->begin(); const mcIdType *connI=_nodal_connec_index->begin(); const double *coords=_coords->begin(); @@ -425,29 +425,29 @@ void MEDCouplingUMesh::subDivide2DMesh(const mcIdType *nodeSubdived, const mcIdT checkFullyDefined(); if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::subDivide2DMesh : works only on umesh with meshdim==2 !"); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); mcIdType *connI=_nodal_connec_index->getPointer(); mcIdType newConnLgth=0; for(mcIdType i=0;i0; - mcIdType const eedgeId=std::abs(desc[offset+nbOfEdges-1])-1; + bool ddirect=desc[offset+nbOfEdges-1]>0; + mcIdType eedgeId=std::abs(desc[offset+nbOfEdges-1])-1; mcIdType ref=ddirect?nodeSubdived[nodeIndxSubdived[eedgeId+1]-1]:nodeSubdived[nodeIndxSubdived[eedgeId]+1]; for(mcIdType j=0;j0; - mcIdType const edgeId=std::abs(desc[offset+j])-1; + bool direct=desc[offset+j]>0; + mcIdType edgeId=std::abs(desc[offset+j])-1; if(!INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodeSubdived[nodeIndxSubdived[edgeId]]).isQuadratic()) { - mcIdType const id1=nodeSubdived[nodeIndxSubdived[edgeId]+1]; - mcIdType const id2=nodeSubdived[nodeIndxSubdived[edgeId+1]-1]; - mcIdType const ref2=direct?id1:id2; + mcIdType id1=nodeSubdived[nodeIndxSubdived[edgeId]+1]; + mcIdType id2=nodeSubdived[nodeIndxSubdived[edgeId+1]-1]; + mcIdType ref2=direct?id1:id2; if(ref==ref2) { - mcIdType const nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1; + mcIdType nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1; newConnLgth+=nbOfSubNodes-1; ref=direct?id2:id1; } @@ -472,18 +472,18 @@ void MEDCouplingUMesh::subDivide2DMesh(const mcIdType *nodeSubdived, const mcIdT for(mcIdType i=0;i0; - mcIdType const edgeId=std::abs(desc[offset+j])-1; + bool direct=desc[offset+j]>0; + mcIdType edgeId=std::abs(desc[offset+j])-1; if(direct) work=std::copy(nodeSubdived+nodeIndxSubdived[edgeId]+1,nodeSubdived+nodeIndxSubdived[edgeId+1]-1,work); else { - mcIdType const nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1; - std::reverse_iterator const it(nodeSubdived+nodeIndxSubdived[edgeId+1]); + mcIdType nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1; + std::reverse_iterator it(nodeSubdived+nodeIndxSubdived[edgeId+1]); work=std::copy(it,it+nbOfSubNodes-1,work); } } @@ -520,7 +520,7 @@ void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const for(const mcIdType *work=begin;work!=end;work++) if(*work>=0 && *workgetConstPointer(); const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); for(mcIdType i=0;ieps)//if colin<=eps -> current SEG2 is colinear to the input plane { const double *st2=coo+3*st; vec4[0]=st2[0]-origin[0]; vec4[1]=st2[1]-origin[1]; vec4[2]=st2[2]-origin[2]; - double const pos=-(vec4[0]*vec2[0]+vec4[1]*vec2[1]+vec4[2]*vec2[2])/((vec3[0]*vec2[0]+vec3[1]*vec2[1]+vec3[2]*vec2[2])); + double pos=-(vec4[0]*vec2[0]+vec4[1]*vec2[1]+vec4[2]*vec2[2])/((vec3[0]*vec2[0]+vec3[1]*vec2[1]+vec3[2]*vec2[2])); if(pos>eps && pos<1-eps) { - mcIdType const nNode=ToIdType(addCoo.size())/3; + mcIdType nNode=ToIdType(addCoo.size())/3; vec4[0]=st2[0]+pos*vec3[0]; vec4[1]=st2[1]+pos*vec3[1]; vec4[2]=st2[2]+pos*vec3[2]; addCoo.insert(addCoo.end(),vec4,vec4+3); cut3DCurve[i]=nnodes+nNode; @@ -596,7 +596,7 @@ void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double } if(!addCoo.empty()) { - mcIdType const newNbOfNodes=nnodes+ToIdType(addCoo.size())/3; + mcIdType newNbOfNodes=nnodes+ToIdType(addCoo.size())/3; MCAuto coo2=DataArrayDouble::New(); coo2->alloc(newNbOfNodes,3); double *tmp=coo2->getPointer(); @@ -613,12 +613,12 @@ void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double */ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const { - mcIdType const oldNbOfNodes=getNumberOfNodes(); - mcIdType const nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); - std::size_t const spaceDim=getSpaceDimension(); + mcIdType oldNbOfNodes=getNumberOfNodes(); + mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); + std::size_t spaceDim=getSpaceDimension(); DataArrayDouble *ret=DataArrayDouble::New(); - std::vector const isQuads; - mcIdType const nbOfLevsInVec=isQuad?2*nbOf1DCells+1:nbOf1DCells+1; + std::vector isQuads; + mcIdType nbOfLevsInVec=isQuad?2*nbOf1DCells+1:nbOf1DCells+1; ret->alloc(oldNbOfNodes*nbOfLevsInVec,spaceDim); double *retPtr=ret->getPointer(); const double *coords=getCoords()->getConstPointer(); @@ -675,12 +675,12 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con { if(isQuad) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : not implemented for quadratic cells !"); - mcIdType const oldNbOfNodes=getNumberOfNodes(); - mcIdType const nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); + mcIdType oldNbOfNodes=getNumberOfNodes(); + mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); if(nbOf1DCells<2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !"); MCAuto ret=DataArrayDouble::New(); - mcIdType const nbOfLevsInVec=nbOf1DCells+1; + mcIdType nbOfLevsInVec=nbOf1DCells+1; ret->alloc(oldNbOfNodes*nbOfLevsInVec,2); double *retPtr=ret->getPointer(); retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr); @@ -702,9 +702,9 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con const double *p1=i+1rotate(end,nullptr,angle); + double cosangle=i+1rotate(end,0,angle); retPtr=std::copy(tmp2->getConstPointer(),tmp2->getConstPointer()+tmp2->getNbOfElems(),retPtr); } return ret.retn(); @@ -719,12 +719,12 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con { if(isQuad) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : not implemented for quadratic cells !"); - mcIdType const oldNbOfNodes=getNumberOfNodes(); - mcIdType const nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); + mcIdType oldNbOfNodes=getNumberOfNodes(); + mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); if(nbOf1DCells<2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !"); MCAuto ret=DataArrayDouble::New(); - mcIdType const nbOfLevsInVec=nbOf1DCells+1; + mcIdType nbOfLevsInVec=nbOf1DCells+1; ret->alloc(oldNbOfNodes*nbOfLevsInVec,3); double *retPtr=ret->getPointer(); retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr); @@ -750,15 +750,15 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con (p1[2]-p0[2])*(p2[0]-p1[0])-(p1[0]-p0[0])*(p2[2]-p1[2]), (p1[0]-p0[0])*(p2[1]-p1[1])-(p1[1]-p0[1])*(p2[0]-p1[0]), }; - double const norm=sqrt(vecPlane[0]*vecPlane[0]+vecPlane[1]*vecPlane[1]+vecPlane[2]*vecPlane[2]); + double norm=sqrt(vecPlane[0]*vecPlane[0]+vecPlane[1]*vecPlane[1]+vecPlane[2]*vecPlane[2]); if(norm>1.e-7) { vecPlane[0]/=norm; vecPlane[1]/=norm; vecPlane[2]/=norm; - double const norm2=sqrt(vecPlane[0]*vecPlane[0]+vecPlane[1]*vecPlane[1]); - double const vec2[2]={vecPlane[1]/norm2,-vecPlane[0]/norm2}; - double const s2=norm2; + double norm2=sqrt(vecPlane[0]*vecPlane[0]+vecPlane[1]*vecPlane[1]); + double vec2[2]={vecPlane[1]/norm2,-vecPlane[0]/norm2}; + double s2=norm2; double c2=cos(asin(s2)); - double const m[3][3]={ + double m[3][3]={ {vec2[0]*vec2[0]*(1-c2)+c2, vec2[0]*vec2[1]*(1-c2), vec2[1]*s2}, {vec2[0]*vec2[1]*(1-c2), vec2[1]*vec2[1]*(1-c2)+c2, -vec2[0]*s2}, {-vec2[1]*s2, vec2[0]*s2, c2} @@ -767,8 +767,8 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con double p1r[3]={m[0][0]*p1[0]+m[0][1]*p1[1]+m[0][2]*p1[2], m[1][0]*p1[0]+m[1][1]*p1[1]+m[1][2]*p1[2], m[2][0]*p1[0]+m[2][1]*p1[1]+m[2][2]*p1[2]}; double p2r[3]={m[0][0]*p2[0]+m[0][1]*p2[1]+m[0][2]*p2[2], m[1][0]*p2[0]+m[1][1]*p2[1]+m[1][2]*p2[2], m[2][0]*p2[0]+m[2][1]*p2[1]+m[2][2]*p2[2]}; INTERP_KERNEL::EdgeArcCircle::GetArcOfCirclePassingThru(p0r,p1r,p2r,tmp3,radius,alpha,alpha0); - double const cosangle=i+1rotate(end,vecPlane,angle); } retPtr=std::copy(tmp2->getConstPointer(),tmp2->getConstPointer()+tmp2->getNbOfElems(),retPtr); @@ -784,9 +784,9 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con */ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(mcIdType nbOfNodesOf1Lev, bool isQuad) const { - mcIdType const nbOf1DCells(getNumberOfNodes()/nbOfNodesOf1Lev-1); - mcIdType const nbOf2DCells=getNumberOfCells(); - mcIdType const nbOf3DCells(nbOf2DCells*nbOf1DCells); + mcIdType nbOf1DCells(getNumberOfNodes()/nbOfNodesOf1Lev-1); + mcIdType nbOf2DCells=getNumberOfCells(); + mcIdType nbOf3DCells(nbOf2DCells*nbOf1DCells); MEDCouplingUMesh *ret(MEDCouplingUMesh::New("Extruded",getMeshDimension()+1)); const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); MCAuto newConn(DataArrayIdType::New()),newConnI(DataArrayIdType::New()); @@ -801,7 +801,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(mcIdType nbO } newConn->alloc(newc.size()*nbOf1DCells,1); mcIdType *newConnPtr(newConn->getPointer()); - mcIdType const deltaPerLev(isQuad?2*nbOfNodesOf1Lev:nbOfNodesOf1Lev); + mcIdType deltaPerLev(isQuad?2*nbOfNodesOf1Lev:nbOfNodesOf1Lev); newConnIPtr=newConnI->getPointer(); for(mcIdType iz=0;iz::const_iterator iter=newc.begin();iter!=newc.end();iter++,newConnPtr++) { - mcIdType const icell(ToIdType(iter-newc.begin()));//std::distance unfortunately cannot been called here in C++98 + mcIdType icell(ToIdType(iter-newc.begin()));//std::distance unfortunately cannot been called here in C++98 if(icell!=*posOfTypeOfCell) { if(*iter!=-1) @@ -844,11 +844,11 @@ bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector& candidat if(candidates.size()<1) return false; bool ret=false; - auto iter=candidates.begin(); - mcIdType const start=(*iter++); + std::vector::const_iterator iter=candidates.begin(); + mcIdType start=(*iter++); for(;iter!=candidates.end();iter++) { - int const status=AreCellsEqual(conn,connI,start,*iter,compType); + int status=AreCellsEqual(conn,connI,start,*iter,compType); if(status!=0) { if(!ret) @@ -873,12 +873,12 @@ bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector& candidat MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const { checkConnectivityFullyDefined(); - mcIdType const ncell=getNumberOfCells(); + mcIdType ncell=getNumberOfCells(); MCAuto ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); - std::size_t const nbOfElemsRet=std::distance(begin,end); - auto *connIndexRet=(mcIdType *)malloc((nbOfElemsRet+1)*sizeof(mcIdType)); + std::size_t nbOfElemsRet=std::distance(begin,end); + mcIdType *connIndexRet=(mcIdType *)malloc((nbOfElemsRet+1)*sizeof(mcIdType)); connIndexRet[0]=0; const mcIdType *conn=_nodal_connec->getConstPointer(); const mcIdType *connIndex=_nodal_connec_index->getConstPointer(); @@ -894,7 +894,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const mcIdType * throw INTERP_KERNEL::Exception(oss.str()); } } - auto *connRet=(mcIdType *)malloc(connIndexRet[nbOfElemsRet]*sizeof(mcIdType)); + mcIdType *connRet=(mcIdType *)malloc(connIndexRet[nbOfElemsRet]*sizeof(mcIdType)); mcIdType *connRetWork=connRet; std::set types; for(const mcIdType *work=begin;work!=end;work++) @@ -919,11 +919,11 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const mcIdType * MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const { checkFullyDefined(); - mcIdType const ncell=getNumberOfCells(); + mcIdType ncell=getNumberOfCells(); MCAuto ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); - mcIdType const newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : "); + mcIdType newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : "); MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(newNbOfCells+1,1); mcIdType *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0; mcIdType work=start; @@ -957,7 +957,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType st } -mcIdType MEDCouplingFastNbrer(mcIdType id, mcIdType /*nb*/, const INTERP_KERNEL::CellModel& /*cm*/, bool /*compute*/, const mcIdType * /*conn1*/, const mcIdType * /*conn2*/) +mcIdType MEDCouplingFastNbrer(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2) { return id; } @@ -987,14 +987,14 @@ DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayIdT MCAuto newConn=DataArrayIdType::New(); newConn->alloc(0,1); MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); MCAuto ret=DataArrayIdType::New(); ret->alloc(0,1); - mcIdType const nbOfCells=getNumberOfCells(); - mcIdType const nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbOfNodes=getNumberOfNodes(); const mcIdType *cPtr=_nodal_connec->begin(); const mcIdType *icPtr=_nodal_connec_index->begin(); mcIdType lastVal=0,offset=nbOfNodes; for(mcIdType i=0;i ret=DataArrayIdType::New(); ret->alloc(0,1); // const mcIdType *descPtr(desc->begin()),*descIPtr(descI->begin()); - DataArrayIdType *conn1D=nullptr,*conn1DI=nullptr; + DataArrayIdType *conn1D=0,*conn1DI=0; std::set types1D; - DataArrayDouble *coordsTmp=nullptr; - MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=nullptr; + DataArrayDouble *coordsTmp=0; + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; MCAuto coordsTmpSafe(coordsTmp); MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); const mcIdType *c1DPtr=conn1D->begin(); const mcIdType *c1DIPtr=conn1DI->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *cPtr=_nodal_connec->begin(); const mcIdType *icPtr=_nodal_connec_index->begin(); mcIdType lastVal=0; for(mcIdType i=0;ipushBackSilent(typ2); newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]); for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++) @@ -1072,14 +1072,14 @@ DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const M DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); - MCAuto m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=nullptr; tmp3=nullptr; + MCAuto m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types); } DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); - MCAuto m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=nullptr; tmp3=nullptr; + MCAuto m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; // MCAuto newConn=DataArrayIdType::New(); newConn->alloc(0,1); MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); @@ -1087,26 +1087,26 @@ DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayIdT // MCAuto bary=computeCellCenterOfMass(); const mcIdType *descPtr(desc->begin()),*descIPtr(descI->begin()); - DataArrayIdType *conn1D=nullptr,*conn1DI=nullptr; + DataArrayIdType *conn1D=0,*conn1DI=0; std::set types1D; - DataArrayDouble *coordsTmp=nullptr; - MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=nullptr; + DataArrayDouble *coordsTmp=0; + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; MCAuto coordsTmpSafe(coordsTmp); MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); const mcIdType *c1DPtr=conn1D->begin(); const mcIdType *c1DIPtr=conn1DI->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *cPtr=_nodal_connec->begin(); const mcIdType *icPtr=_nodal_connec_index->begin(); mcIdType lastVal=0; - mcIdType const offset=coordsTmpSafe->getNumberOfTuples(); + mcIdType offset=coordsTmpSafe->getNumberOfTuples(); for(mcIdType i=0;ipushBackSilent(typ2); newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]); for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++) @@ -1137,16 +1137,16 @@ DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayIdT DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); - MCAuto m1D=explode3DMeshTo1D(desc,descI,tmp2,tmp3); tmp2=nullptr; tmp3=nullptr; + MCAuto m1D=explode3DMeshTo1D(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types); } DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { MCAuto desc2(DataArrayIdType::New()),desc2I(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); - MCAuto m2D=buildDescendingConnectivityGen(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=nullptr; tmp3=nullptr; + MCAuto m2D=buildDescendingConnectivityGen(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=0; tmp3=0; MCAuto desc1(DataArrayIdType::New()),desc1I(DataArrayIdType::New()),tmp4(DataArrayIdType::New()),tmp5(DataArrayIdType::New()); - MCAuto m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=nullptr; tmp5=nullptr; + MCAuto m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=0; tmp5=0; // MCAuto newConn=DataArrayIdType::New(); newConn->alloc(0,1); MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); @@ -1154,9 +1154,9 @@ DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayIdT // MCAuto bary=computeCellCenterOfMass(); const mcIdType *descPtr(desc1->begin()),*descIPtr(desc1I->begin()),*desc2Ptr(desc2->begin()),*desc2IPtr(desc2I->begin()); - DataArrayIdType *conn1D=nullptr,*conn1DI=nullptr,*conn2D=nullptr,*conn2DI=nullptr; + DataArrayIdType *conn1D=0,*conn1DI=0,*conn2D=0,*conn2DI=0; std::set types1D,types2D; - DataArrayDouble *coordsTmp=nullptr,*coordsTmp2=nullptr; + DataArrayDouble *coordsTmp=0,*coordsTmp2=0; MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayIdType::New(); ret1D->alloc(0,1); MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); MCAuto coordsTmpSafe(coordsTmp); @@ -1164,18 +1164,18 @@ DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayIdT MCAuto coordsTmp2Safe(coordsTmp2); MCAuto conn2DSafe(conn2D),conn2DISafe(conn2DI); const mcIdType *c1DPtr=conn1D->begin(),*c1DIPtr=conn1DI->begin(),*c2DPtr=conn2D->begin(),*c2DIPtr=conn2DI->begin(); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); const mcIdType *cPtr=_nodal_connec->begin(); const mcIdType *icPtr=_nodal_connec_index->begin(); mcIdType lastVal=0; mcIdType offset=coordsTmpSafe->getNumberOfTuples(); for(mcIdType i=0;ipushBackSilent(c1DPtr[c1DIPtr[*d]+3]); for(const mcIdType *d=desc2Ptr+desc2IPtr[0];d!=desc2Ptr+desc2IPtr[1];d++) { - mcIdType const nodeId2=c2DPtr[c2DIPtr[(*d)+1]-1]; - mcIdType const tmpPos=newConn->getNumberOfTuples(); + mcIdType nodeId2=c2DPtr[c2DIPtr[(*d)+1]-1]; + mcIdType tmpPos=newConn->getNumberOfTuples(); newConn->pushBackSilent(nodeId2); ret2D->pushBackSilent(nodeId2); ret1D->pushBackSilent(tmpPos); } @@ -1215,15 +1215,15 @@ DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayIdT for(const mcIdType *elt=ret1D->begin();elt!=ret1D->end();elt++) c[*elt]=o2nRet2D->getIJ(c[*elt],0)+offset; offset=coordsTmp2Safe->getNumberOfTuples(); - for(long const elt : *ret) - c[cI[elt+1]-1]+=offset; + for(const mcIdType *elt=ret->begin();elt!=ret->end();elt++) + c[cI[(*elt)+1]-1]+=offset; coords=DataArrayDouble::Aggregate(v); conn=newConn.retn(); connI=newConnI.retn(); return ret.retn(); } DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const { - mcIdType const nbOfNodesExpected(skin->getNumberOfNodes()); + mcIdType nbOfNodesExpected(skin->getNumberOfNodes()); const mcIdType *n2oPtr(n2o->begin()); MCAuto revNodal(DataArrayIdType::New()),revNodalI(DataArrayIdType::New()); skin->getReverseNodalConnectivity(revNodal,revNodalI); @@ -1244,7 +1244,7 @@ DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMe conn.erase(prevNode); if(conn.size()==1) { - mcIdType const curNode(*(conn.begin())); + mcIdType curNode(*(conn.begin())); *work++=n2oPtr[curNode]; std::set shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]); shar.erase(prevCell); @@ -1267,8 +1267,8 @@ DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMe DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const { - mcIdType const nbOfNodesExpected(skin->getNumberOfNodes()); - mcIdType const nbOfTurn(nbOfNodesExpected/2); + mcIdType nbOfNodesExpected(skin->getNumberOfNodes()); + mcIdType nbOfTurn(nbOfNodesExpected/2); const mcIdType *n2oPtr(n2o->begin()); MCAuto revNodal(DataArrayIdType::New()),revNodalI(DataArrayIdType::New()); skin->getReverseNodalConnectivity(revNodal,revNodalI); @@ -1289,13 +1289,13 @@ DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshQuadratic(const MEDCoupling conn.erase(prevNode); if(conn.size()==1) { - mcIdType const curNode(*(conn.begin())); + mcIdType curNode(*(conn.begin())); *work=n2oPtr[curNode]; std::set shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]); shar.erase(prevCell); if(shar.size()==1) { - mcIdType const curCell(*(shar.begin())); + mcIdType curCell(*(shar.begin())); work[nbOfTurn]=n2oPtr[nodalPtr[nodalIPtr[curCell]+3]]; prevCell=curCell; prevNode=curNode; @@ -1342,8 +1342,8 @@ void MEDCouplingUMesh::DeleteCellTypeInIndexedArray(const DataArrayIdType *arrIn *outArrIndxPtr++ = 0; for( mcIdType i = 0 ; i < arrIndxNbTuples - 1 ; ++i ) { - mcIdType const startPos(*inArrIndxPtr++); - mcIdType const endPos(*inArrIndxPtr); + mcIdType startPos(*inArrIndxPtr++); + mcIdType endPos(*inArrIndxPtr); if(inArrPtr[startPos] == INTERP_KERNEL::NORM_POLYHED) { presenceOfPolyh = true; @@ -1363,8 +1363,8 @@ void MEDCouplingUMesh::DeleteCellTypeInIndexedArray(const DataArrayIdType *arrIn *outArrIndxPtr++ = 0; for( mcIdType i = 0 ; i < arrIndxNbTuples - 1 ; ++i,++outArrIndxPtr ) { - mcIdType const startPos(*inArrIndxPtr++); - mcIdType const endPos(*inArrIndxPtr); + mcIdType startPos(*inArrIndxPtr++); + mcIdType endPos(*inArrIndxPtr); if(inArrPtr[startPos] != INTERP_KERNEL::NORM_POLYHED) { arrOut->insertAtTheEnd(inArrPtr+startPos+1,inArrPtr+endPos); @@ -1385,8 +1385,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vectorgetMeshDimension(); + std::vector::const_iterator it=a.begin(); + int meshDim=(*it)->getMeshDimension(); mcIdType nbOfCells=ToIdType((*it)->getNumberOfCells()); mcIdType meshLgth=(*it++)->getNodalConnectivityArrayLen(); for(;it!=a.end();it++) @@ -1412,7 +1412,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vectorgetNumberOfCells()); + mcIdType curNbOfCell=ToIdType((*it)->getNumberOfCells()); const mcIdType *curCI=(*it)->_nodal_connec_index->begin(); const mcIdType *curC=(*it)->_nodal_connec->begin(); cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind(std::plus(),std::placeholders::_1,offset)); @@ -1457,7 +1457,7 @@ void MEDCouplingUMesh::DistanceToPoint3DSurfAlg(const double *pt, const mcIdType { case INTERP_KERNEL::NORM_TRI3: { - double const tmp=INTERP_KERNEL::DistanceFromPtToTriInSpaceDim3(pt,coords+3*nc[ncI[*zeCell]+1],coords+3*nc[ncI[*zeCell]+2],coords+3*nc[ncI[*zeCell]+3]); + double tmp=INTERP_KERNEL::DistanceFromPtToTriInSpaceDim3(pt,coords+3*nc[ncI[*zeCell]+1],coords+3*nc[ncI[*zeCell]+2],coords+3*nc[ncI[*zeCell]+3]); if(tmpgetNumberOfTuples()-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; std::vector fetched2(nbOfTuples,false); int i=0; for(const mcIdType *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++) @@ -1525,22 +1525,22 @@ DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::ve } const mcIdType *arrInPtr=arrIn->begin(); const mcIdType *arrIndxPtr=arrIndxIn->begin(); - mcIdType const targetNbOfDepthPeeling=nbOfDepthPeeling!=-1?nbOfDepthPeeling:std::numeric_limits::max(); + mcIdType targetNbOfDepthPeeling=nbOfDepthPeeling!=-1?nbOfDepthPeeling:std::numeric_limits::max(); std::vector idsToFetch1(seedBg,seedEnd); std::vector idsToFetch2; std::vector *idsToFetch=&idsToFetch1; std::vector *idsToFetchOther=&idsToFetch2; while(!idsToFetch->empty() && nbOfDepthPeelingPerformed::const_iterator it=idsToFetch->begin();it!=idsToFetch->end();it++) + for(const mcIdType *it2=arrInPtr+arrIndxPtr[*it];it2!=arrInPtr+arrIndxPtr[*it+1];it2++) if(!fetched[*it2]) { fetched[*it2]=true; fetched2[*it2]=true; idsToFetchOther->push_back(*it2); } std::swap(idsToFetch,idsToFetchOther); idsToFetchOther->clear(); nbOfDepthPeelingPerformed++; } - mcIdType const lgth=ToIdType(std::count(fetched2.begin(),fetched2.end(),true)); + mcIdType lgth=ToIdType(std::count(fetched2.begin(),fetched2.end(),true)); i=0; MCAuto ret=DataArrayIdType::New(); ret->alloc(lgth,1); mcIdType *retPtr=ret->getPointer(); @@ -1580,10 +1580,10 @@ void MEDCouplingUMesh::FillInCompact3DMode(int spaceDim, mcIdType nbOfNodesInCel */ void MEDCouplingUMesh::AppendExtrudedCell(const mcIdType *connBg, const mcIdType *connEnd, mcIdType nbOfNodesPerLev, bool isQuad, std::vector& ret) { - auto const flatType=(INTERP_KERNEL::NormalizedCellType)connBg[0]; + INTERP_KERNEL::NormalizedCellType flatType=(INTERP_KERNEL::NormalizedCellType)connBg[0]; const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(flatType); ret.push_back(cm.getExtrudedType()); - mcIdType const deltaz=isQuad?2*nbOfNodesPerLev:nbOfNodesPerLev; + mcIdType deltaz=isQuad?2*nbOfNodesPerLev:nbOfNodesPerLev; switch(flatType) { case INTERP_KERNEL::NORM_POINT1: @@ -1638,10 +1638,10 @@ void MEDCouplingUMesh::AppendExtrudedCell(const mcIdType *connBg, const mcIdType std::back_insert_iterator< std::vector > ii(ret); std::copy(connBg+1,connEnd,ii); *ii++=-1; - std::reverse_iterator const rConnBg(connEnd); - std::reverse_iterator const rConnEnd(connBg+1); + std::reverse_iterator rConnBg(connEnd); + std::reverse_iterator rConnEnd(connBg+1); std::transform(rConnBg,rConnEnd,ii,std::bind(std::plus(),std::placeholders::_1,deltaz)); - std::size_t const nbOfRadFaces=std::distance(connBg+1,connEnd); + std::size_t nbOfRadFaces=std::distance(connBg+1,connEnd); for(std::size_t i=0;i& const mcIdType *desc, const mcIdType *descIndx, std::vector< std::pair >& cut3DSurf) { - std::set const nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end()); - mcIdType const nbOf3DSurfCell=ToIdType(cut3DSurf.size()); + std::set nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end()); + mcIdType nbOf3DSurfCell=ToIdType(cut3DSurf.size()); for(mcIdType i=0;i res; - mcIdType const offset=descIndx[i]; - mcIdType const nbOfSeg=descIndx[i+1]-offset; + mcIdType offset=descIndx[i]; + mcIdType nbOfSeg=descIndx[i+1]-offset; for(mcIdType j=0;j-1) @@ -1716,7 +1716,7 @@ void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& case 1: case 0: { - std::set const s1(nodal3DSurf+nodalIndx3DSurf[i]+1,nodal3DSurf+nodalIndx3DSurf[i+1]); + std::set s1(nodal3DSurf+nodalIndx3DSurf[i]+1,nodal3DSurf+nodalIndx3DSurf[i+1]); std::set_intersection(nodesOnP.begin(),nodesOnP.end(),s1.begin(),s1.end(),std::back_insert_iterator< std::vector >(res)); if(res.size()==2) { @@ -1759,12 +1759,12 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pairbegin()),*nodalIndx3D(_nodal_connec_index->begin()); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); for(mcIdType i=0;i > m; - mcIdType const offset=descIndx[i]; - mcIdType const nbOfFaces=descIndx[i+1]-offset; + mcIdType offset=descIndx[i]; + mcIdType nbOfFaces=descIndx[i+1]-offset; mcIdType start=-1; mcIdType end=-1; for(int j=0;j tmp=new mcIdType[sz]; INTERP_KERNEL::NormalizedCellType cmsId; - unsigned const nbOfNodesSon=cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId); + unsigned nbOfNodesSon=cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId); start=tmp[0]; end=tmp[nbOfNodesSon-1]; for(unsigned k=0;k >::const_iterator const it=m.find(start); + std::map >::const_iterator it=m.find(start); const std::set& s=(*it).second; std::set s2; s2.insert(prev); std::set s3; std::set_difference(s.begin(),s.end(),s2.begin(),s2.end(),inserter(s3,s3.begin())); if(s3.size()==1) { - mcIdType const val=*s3.begin(); + mcIdType val=*s3.begin(); conn.push_back(start); prev=start; start=val; @@ -1832,7 +1832,7 @@ void MEDCouplingUMesh::ComputeAllTypesInternal(std::setbegin()),*connIndex(nodalConnecIndex->begin()); - mcIdType const nbOfElem=ToIdType(nodalConnecIndex->getNbOfElems())-1; + mcIdType nbOfElem=ToIdType(nodalConnecIndex->getNbOfElems())-1; if(nbOfElem>0) for(const mcIdType *pt=connIndex;pt!=connIndex+nbOfElem;pt++) types.insert((INTERP_KERNEL::NormalizedCellType)conn[*pt]); @@ -1855,7 +1855,7 @@ void MEDCouplingUMesh::ComputeAllTypesInternal(std::set edges; @@ -1875,15 +1875,15 @@ void MEDCouplingUMesh::attractSeg3MidPtsAroundNodes(double ratio, const mcIdType */ void MEDCouplingUMesh::attractSeg3MidPtsAroundNodesUnderground(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd) { - int const spaceDim(getSpaceDimension()); + int spaceDim(getSpaceDimension()); double *coords(getCoords()->getPointer()); auto nbNodes(getNumberOfNodes()); - std::size_t const nbCells(getNumberOfCells()); + std::size_t nbCells(getNumberOfCells()); std::vector fastFinder(nbNodes,false); for(auto work=nodeIdsBg;work!=nodeIdsEnd;work++) if(*work>=0 && *work const cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false)); + MCAuto cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false)); const mcIdType *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin()); for(std::size_t cellId=0;cellId -#include -#include -#include -#include -#include -#include #include +#include +#include #include #include +#include #include -#include -#include using namespace MEDCoupling; @@ -68,7 +56,7 @@ mcIdType InternalAddPoint(const INTERP_KERNEL::Edge *e, mcIdType id, const doubl return id; else { - mcIdType const ret(nodesCnter++); + mcIdType ret(nodesCnter++); double newPt[2]; e->getMiddleOfPoints(coo+2*startId,coo+2*endId,newPt); addCoo.insertAtTheEnd(newPt,newPt+2); @@ -82,7 +70,7 @@ mcIdType InternalAddPointOriented(const INTERP_KERNEL::Edge *e, mcIdType id, con return id; else { - mcIdType const ret(nodesCnter++); + mcIdType ret(nodesCnter++); double newPt[2]; e->getMiddleOfPointsOriented(coo+2*startId,coo+2*endId,newPt); addCoo.insertAtTheEnd(newPt,newPt+2); @@ -94,7 +82,7 @@ mcIdType InternalAddPointOriented(const INTERP_KERNEL::Edge *e, mcIdType id, con void EnterTheResultOf2DCellFirst(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const mcIdType *connBg, mcIdType offset, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords, std::vector& middles) { mcIdType tmp[3]; - int const trueStart(start>=0?start:nbOfEdges+start); + int trueStart(start>=0?start:nbOfEdges+start); tmp[0]=ToIdType(linOrArc?INTERP_KERNEL::NORM_QPOLYG:INTERP_KERNEL::NORM_POLYGON); tmp[1]=connBg[trueStart]; tmp[2]=connBg[stp]; newConnOfCell->insertAtTheEnd(tmp,tmp+3); if(linOrArc) @@ -127,7 +115,7 @@ void EnterTheResultOf2DCellMiddle(const INTERP_KERNEL::Edge *e, int start, int s } } -void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const mcIdType *connBg, mcIdType offset, DataArrayIdType * /*newConnOfCell*/, DataArrayDouble *appendedCoords, std::vector& middles) +void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const mcIdType *connBg, mcIdType offset, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords, std::vector& middles) { // only the quadratic point to deal with: if(linOrArc) @@ -147,10 +135,10 @@ void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector& isect) { MCAuto nTmp(n); nTmp->incrRef(); - auto const it(m.find(nTmp)); + std::map,mcIdType>::const_iterator it(m.find(nTmp)); if(it==m.end()) throw INTERP_KERNEL::Exception("Internal error in remapping !"); - mcIdType const v((*it).second); + mcIdType v((*it).second); if(v==forbVal0 || v==forbVal1) return ; if(std::find(isect.begin(),isect.end(),v)==isect.end()) @@ -159,10 +147,10 @@ void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector& isect) { - int const sz(c.size()); + int sz(c.size()); if(sz<=1) return false; - bool const presenceOfOn(false); + bool presenceOfOn(false); for(int i=0;i,mcIdType>& m) { - INTERP_KERNEL::Edge *ret(nullptr); + INTERP_KERNEL::Edge *ret(0); MCAuto n0(new INTERP_KERNEL::Node(coords2D[2*bg[0]],coords2D[2*bg[0]+1])),n1(new INTERP_KERNEL::Node(coords2D[2*bg[1]],coords2D[2*bg[1]+1])); m[n0]=bg[0]; m[n1]=bg[1]; switch(typ) @@ -192,11 +180,11 @@ namespace MEDCoupling } case INTERP_KERNEL::NORM_SEG3: { - auto *n2(new INTERP_KERNEL::Node(coords2D[2*bg[2]],coords2D[2*bg[2]+1])); m[n2]=bg[2]; - auto *e1(new INTERP_KERNEL::EdgeLin(n0,n2)),*e2(new INTERP_KERNEL::EdgeLin(n2,n1)); - INTERP_KERNEL::SegSegIntersector const inters(*e1,*e2); + INTERP_KERNEL::Node *n2(new INTERP_KERNEL::Node(coords2D[2*bg[2]],coords2D[2*bg[2]+1])); m[n2]=bg[2]; + INTERP_KERNEL::EdgeLin *e1(new INTERP_KERNEL::EdgeLin(n0,n2)),*e2(new INTERP_KERNEL::EdgeLin(n2,n1)); + INTERP_KERNEL::SegSegIntersector inters(*e1,*e2); // is the SEG3 degenerated, and thus can be reduced to a SEG2? - bool const colinearity(inters.areColinears()); + bool colinearity(inters.areColinears()); delete e1; delete e2; if(colinearity) { ret=new INTERP_KERNEL::EdgeLin(n0,n1); } @@ -212,7 +200,7 @@ namespace MEDCoupling INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge(INTERP_KERNEL::NormalizedCellType typ, std::map& mapp2, const mcIdType *bg) { - INTERP_KERNEL::Edge *ret=nullptr; + INTERP_KERNEL::Edge *ret=0; mapp2[bg[0]].second = INTERP_KERNEL::USAGE_LINEAR; mapp2[bg[1]].second = INTERP_KERNEL::USAGE_LINEAR; @@ -226,11 +214,11 @@ namespace MEDCoupling } case INTERP_KERNEL::NORM_SEG3: { - auto *e1=new INTERP_KERNEL::EdgeLin(mapp2[bg[0]].first,mapp2[bg[2]].first); - auto *e2=new INTERP_KERNEL::EdgeLin(mapp2[bg[2]].first,mapp2[bg[1]].first); - INTERP_KERNEL::SegSegIntersector const inters(*e1,*e2); + INTERP_KERNEL::EdgeLin *e1=new INTERP_KERNEL::EdgeLin(mapp2[bg[0]].first,mapp2[bg[2]].first); + INTERP_KERNEL::EdgeLin *e2=new INTERP_KERNEL::EdgeLin(mapp2[bg[2]].first,mapp2[bg[1]].first); + INTERP_KERNEL::SegSegIntersector inters(*e1,*e2); // is the SEG3 degenerated, and thus can be reduced to a SEG2? - bool const colinearity=inters.areColinears(); + bool colinearity=inters.areColinears(); delete e1; delete e2; if(colinearity) ret=new INTERP_KERNEL::EdgeLin(mapp2[bg[0]].first,mapp2[bg[1]].first); @@ -261,18 +249,18 @@ namespace MEDCoupling const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer(); const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer(); std::set s; - for(long const candidate : candidates) - s.insert(c+cI[candidate]+1,c+cI[candidate+1]); - for(long const it2 : s) + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + s.insert(c+cI[*it]+1,c+cI[(*it)+1]); + for(std::set::const_iterator it2=s.begin();it2!=s.end();it2++) { - auto *n=new INTERP_KERNEL::Node(coo[2*it2],coo[2*it2+1]); - mapp2[it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN); + INTERP_KERNEL::Node *n=new INTERP_KERNEL::Node(coo[2*(*it2)],coo[2*(*it2)+1]); + mapp2[*it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN); } - auto *ret=new INTERP_KERNEL::QuadraticPolygon; - for(long const candidate : candidates) + INTERP_KERNEL::QuadraticPolygon *ret=new INTERP_KERNEL::QuadraticPolygon; + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) { - auto const typ=(INTERP_KERNEL::NormalizedCellType)c[cI[candidate]]; - ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[candidate]+1)); + INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)c[cI[*it]]; + ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[*it]+1)); } for(std::map::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++) { @@ -294,14 +282,14 @@ namespace MEDCoupling const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer(); const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer(); std::set s; - for(long const candidate : candidates) - s.insert(c+cI[candidate]+1,c+cI[candidate+1]); - for(long const it2 : s) + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + s.insert(c+cI[*it]+1,c+cI[(*it)+1]); + for(std::set::const_iterator it2=s.begin();it2!=s.end();it2++) { INTERP_KERNEL::Node *n; // Look for a potential node to merge std::vector candNode; - nodeTree.getElementsAroundPoint(coo+2*it2, candNode); + nodeTree.getElementsAroundPoint(coo+2*(*it2), candNode); if (candNode.size() > 2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MEDCouplingUMeshBuildQPFromMeshWithTree(): some nodes are not properly merged (within eps) in input mesh!"); bool node_created=false; @@ -316,14 +304,14 @@ namespace MEDCoupling } } if(!node_created) - n = new INTERP_KERNEL::Node(coo[2*it2],coo[2*it2+1]); - mapp2[it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN); + n = new INTERP_KERNEL::Node(coo[2*(*it2)],coo[2*(*it2)+1]); + mapp2[*it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN); } - auto *ret=new INTERP_KERNEL::QuadraticPolygon; - for(long const candidate : candidates) + INTERP_KERNEL::QuadraticPolygon *ret=new INTERP_KERNEL::QuadraticPolygon; + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) { - auto const typ=(INTERP_KERNEL::NormalizedCellType)c[cI[candidate]]; - ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[candidate]+1)); // this call will set quad points to false in the map + INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)c[cI[*it]]; + ret->pushBack(MEDCouplingUMeshBuildQPFromEdge(typ,mapp2,c+cI[*it]+1)); // this call will set quad points to false in the map } for(std::map::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++) { @@ -338,12 +326,12 @@ namespace MEDCoupling { if(nodeId>=offset2) { - mcIdType const locId=nodeId-offset2; + mcIdType locId=nodeId-offset2; return new INTERP_KERNEL::Node(addCoo[2*locId],addCoo[2*locId+1]); } if(nodeId>=offset1) { - mcIdType const locId=nodeId-offset1; + mcIdType locId=nodeId-offset1; return new INTERP_KERNEL::Node(coo2[2*locId],coo2[2*locId+1]); } return new INTERP_KERNEL::Node(coo1[2*nodeId],coo1[2*nodeId+1]); @@ -358,15 +346,15 @@ namespace MEDCoupling { for(const mcIdType *desc1=desc1Bg;desc1!=desc1End;desc1++) { - mcIdType const eltId1=std::abs(*desc1)-1; - for(long const it1 : intesctEdges1[eltId1]) + mcIdType eltId1=std::abs(*desc1)-1; + for(std::vector::const_iterator it1=intesctEdges1[eltId1].begin();it1!=intesctEdges1[eltId1].end();it1++) { - std::map::const_iterator const it=mappRev.find(it1); + std::map::const_iterator it=mappRev.find(*it1); if(it==mappRev.end()) { - INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(it1,coo1,offset1,coo2,offset2,addCoo); - mapp[node]=it1; - mappRev[it1]=node; + INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(*it1,coo1,offset1,coo2,offset2,addCoo); + mapp[node]=*it1; + mappRev[*it1]=node; } } } @@ -391,7 +379,7 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const mcIdType *c INTERP_KERNEL::AutoPtr tmpConn(new mcIdType[sz]); INTERP_KERNEL::AutoPtr tmpConn2(new mcIdType[sz]); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)connBg[0])); - unsigned const nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz))); + unsigned nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz))); unsigned nbOfHit(0); // number of fusions operated int posBaseElt(0),posEndElt(0),nbOfTurn(0); const std::size_t maxNbOfHit = cm.isQuadratic() ? nbs-2 : nbs-3; // a quad cell is authorized to end up with only two edges, a linear one has to keep 3 at least @@ -413,13 +401,13 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const mcIdType *c { cm.fillSonCellNodalConnectivity2(nbs-i,connBg+1,ToIdType(sz),tmpConn2,typeOfSon); // Identify common point: - mcIdType const commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1]; + mcIdType commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1]; auto itE(forbiddenPoints.end()); if (forbiddenPoints.find(commPoint) != itE) // is the junction point in the list of points we can not remove? break; INTERP_KERNEL::Edge *eCand(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn2,coords,m)); INTERP_KERNEL::EdgeIntersector *eint(INTERP_KERNEL::Edge::BuildIntersectorWith(e,eCand)); - bool const isColinear=eint->areColinears(); + bool isColinear=eint->areColinears(); if(isColinear) { nbOfHit++; @@ -440,13 +428,13 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const mcIdType *c { cm.fillSonCellNodalConnectivity2(j,connBg+1,ToIdType(sz),tmpConn2,typeOfSon); // get edge #j's connectivity // Identify common point: - mcIdType const commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1]; + mcIdType commPoint = std::find((mcIdType *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1]; auto itE(forbiddenPoints.end()); if (forbiddenPoints.find(commPoint) != itE) // is the junction point in the list of points we can not remove? break; INTERP_KERNEL::Edge *eCand(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn2,coords,m)); INTERP_KERNEL::EdgeIntersector *eint(INTERP_KERNEL::Edge::BuildIntersectorWith(e,eCand)); - bool const isColinear(eint->areColinears()); + bool isColinear(eint->areColinears()); if(isColinear) { nbOfHit++; @@ -485,19 +473,19 @@ bool IsColinearOfACellOf(const std::vector< std::vector >& intersectEd { if(candidates.empty()) return false; - for(long const candidate : candidates) + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) { - const std::vector& pool(intersectEdge1[candidate]); + const std::vector& pool(intersectEdge1[*it]); mcIdType tmp[2]; tmp[0]=start; tmp[1]=stop; if(std::search(pool.begin(),pool.end(),tmp,tmp+2)!=pool.end()) { - retVal=candidate+1; + retVal=*it+1; return true; } tmp[0]=stop; tmp[1]=start; if(std::search(pool.begin(),pool.end(),tmp,tmp+2)!=pool.end()) { - retVal=-candidate-1; + retVal=-*it-1; return true; } } @@ -522,24 +510,24 @@ void MEDCouplingUMesh::BuildIntersectEdges(const MEDCouplingUMesh *m1, const MED const std::vector& addCoo, const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge) { - mcIdType const offset1=m1->getNumberOfNodes(); - mcIdType const ncell2=m2->getNumberOfCells(); + mcIdType offset1=m1->getNumberOfNodes(); + mcIdType ncell2=m2->getNumberOfCells(); const mcIdType *c=m2->getNodalConnectivity()->begin(); const mcIdType *cI=m2->getNodalConnectivityIndex()->begin(); const double *coo=m2->getCoords()->begin(); const double *cooBis=m1->getCoords()->begin(); - mcIdType const offset2=offset1+m2->getNumberOfNodes(); + mcIdType offset2=offset1+m2->getNumberOfNodes(); intersectEdge.resize(ncell2); for(mcIdType i=0;i& divs=subDiv[i]; - mcIdType const nnode=cI[1]-cI[0]-1; + mcIdType nnode=cI[1]-cI[0]-1; std::map mapp2; std::map mapp22; for(mcIdType j=0;j mapp3; for(std::size_t j=0;jsortIdsAbs(addNodes,mapp22,mapp3,intersectEdge[i]); - for(auto addNode : addNodes) - addNode->decrRef(); + for(std::vector::const_iterator it=addNodes.begin();it!=addNodes.end();it++) + (*it)->decrRef(); e->decrRef(); } } @@ -581,15 +569,15 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: { idsInRetColinear=DataArrayIdType::New(); idsInRetColinear->alloc(0,1); idsInMesh1DForIdsInRetColinear=DataArrayIdType::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1); - mcIdType const nCells=mesh1D->getNumberOfCells(); + mcIdType nCells=mesh1D->getNumberOfCells(); if(nCells!=ToIdType(intersectEdge2.size())) throw INTERP_KERNEL::Exception("BuildMesh1DCutFrom : internal error # 1 !"); const DataArrayDouble *coo2(mesh1D->getCoords()); const mcIdType *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin()); const double *coo2Ptr(coo2->begin()); - mcIdType const offset1(coords1->getNumberOfTuples()); - mcIdType const offset2(offset1+coo2->getNumberOfTuples()); - mcIdType const offset3(offset2+ToIdType(addCoo.size())/2); + mcIdType offset1(coords1->getNumberOfTuples()); + mcIdType offset2(offset1+coo2->getNumberOfTuples()); + mcIdType offset3(offset2+ToIdType(addCoo.size())/2); std::vector addCooQuad; MCAuto cOut(DataArrayIdType::New()),ciOut(DataArrayIdType::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0); mcIdType tmp[4],cicnt(0),kk(0); @@ -598,7 +586,7 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: std::map,mcIdType> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coo2Ptr,m)); const std::vector& subEdges(intersectEdge2[i]); - mcIdType const nbSubEdge=ToIdType(subEdges.size()/2); + mcIdType nbSubEdge=ToIdType(subEdges.size()/2); for(mcIdType j=0;j n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)), @@ -664,10 +652,10 @@ MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const else allEdges.insert(allEdges.end(),edge1.rbegin(),edge1.rend()); } - std::size_t const nb(allEdges.size()); + std::size_t nb(allEdges.size()); if(nb%2!=0) throw INTERP_KERNEL::Exception("BuildRefined2DCellLinear : internal error 1 !"); - std::size_t const nbOfEdgesOf2DCellSplit(nb/2); + std::size_t nbOfEdgesOf2DCellSplit(nb/2); MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(coords); ret->allocateCells(1); @@ -683,14 +671,14 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con const mcIdType *c(mesh2D->getNodalConnectivity()->begin()),*ci(mesh2D->getNodalConnectivityIndex()->begin()); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[cellIdInMesh2D]])); int ii(0); - unsigned const sz(cm.getNumberOfSons2(c+ci[cellIdInMesh2D]+1,ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]-1)); + unsigned sz(cm.getNumberOfSons2(c+ci[cellIdInMesh2D]+1,ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]-1)); if(sz!=std::distance(descBg,descEnd)) throw INTERP_KERNEL::Exception("BuildRefined2DCellQuadratic : internal error 1 !"); INTERP_KERNEL::AutoPtr tmpPtr(new mcIdType[ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]]); std::vector allEdges,centers; const double *coordsPtr(coords->begin()); MCAuto addCoo(DataArrayDouble::New()); addCoo->alloc(0,1); - mcIdType const offset(coords->getNumberOfTuples()); + mcIdType offset(coords->getNumberOfTuples()); for(const mcIdType *it2(descBg);it2!=descEnd;it2++,ii++) { INTERP_KERNEL::NormalizedCellType typeOfSon; @@ -704,7 +692,7 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con centers.push_back(tmpPtr[2]);//special case where no subsplit of edge -> reuse the original center. else {//the current edge has been subsplit -> create corresponding centers. - mcIdType const nbOfCentersToAppend=ToIdType(edge1.size()/2); + mcIdType nbOfCentersToAppend=ToIdType(edge1.size()/2); std::map< MCAuto,mcIdType> m; MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m)); std::vector::const_iterator it3(allEdges.end()-edge1.size()); @@ -719,10 +707,10 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con } } } - std::size_t const nb(allEdges.size()); + std::size_t nb(allEdges.size()); if(nb%2!=0) throw INTERP_KERNEL::Exception("BuildRefined2DCellQuadratic : internal error 2 !"); - std::size_t const nbOfEdgesOf2DCellSplit(nb/2); + std::size_t nbOfEdgesOf2DCellSplit(nb/2); MCAuto ret(MEDCouplingUMesh::New("",2)); if(addCoo->empty()) ret->setCoords(coords); @@ -759,9 +747,9 @@ MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCou void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, const std::vector< MCAuto >& edges) { bool isQuad(false); - for(const auto & edge : edges) + for(std::vector< MCAuto >::const_iterator it=edges.begin();it!=edges.end();it++) { - const INTERP_KERNEL::Edge *ee(edge); + const INTERP_KERNEL::Edge *ee(*it); if(dynamic_cast(ee)) isQuad=true; } @@ -770,10 +758,10 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn else { const double *coo(mesh2D->getCoords()->begin()); - std::size_t const sz(conn.size()); + std::size_t sz(conn.size()); std::vector addCoo; std::vector conn2(conn); - mcIdType const offset(mesh2D->getNumberOfNodes()); + mcIdType offset(mesh2D->getNumberOfNodes()); for(std::size_t i=0;i& conn void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vector& edge1Bis, const std::vector< MCAuto >& edge1BisPtr, std::vector< std::vector >& out0, std::vector< std::vector< MCAuto > >& out1) { - std::size_t const nb(edge1Bis.size()/2); - std::size_t const nbOfEdgesOf2DCellSplit(nb/2); - mcIdType const iEnd=splitMesh1D->getNumberOfCells(); + std::size_t nb(edge1Bis.size()/2); + std::size_t nbOfEdgesOf2DCellSplit(nb/2); + mcIdType iEnd=splitMesh1D->getNumberOfCells(); if(iEnd==0) throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal2 : internal error ! input 1D mesh must have at least one cell !"); std::size_t ii,jj; @@ -834,7 +822,7 @@ void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vec for(mcIdType ik=0;ik,mcIdType> m; - MCAuto const ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m)); + MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m)); ees[ik]=ee; } for(mcIdType ik=iEnd-1;ik>=0;ik--) @@ -851,7 +839,7 @@ void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vec struct CellInfo { public: - CellInfo() = default; + CellInfo() { } CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr); public: std::vector _edges; @@ -860,7 +848,7 @@ public: CellInfo::CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr) { - std::size_t const nbe(edges.size()); + std::size_t nbe(edges.size()); std::vector edges2(2*nbe); std::vector< MCAuto > edgesPtr2(2*nbe); for(std::size_t i=0;i barys(mesh->computeCellCenterOfMass()); - mcIdType const cellId(mesh2D->getCellContainingPoint(barys->begin(),eps)); + mcIdType cellId(mesh2D->getCellContainingPoint(barys->begin(),eps)); if(cellId==-1) throw INTERP_KERNEL::Exception("EdgeInfo::feedEdgeInfoAt : internal error !"); neighbors[0]=offset+cellId; neighbors[1]=offset+cellId; @@ -1006,8 +994,8 @@ void VectorOfCellInfo::setMeshAt(mcIdType pos, const MCAuto& m const std::vector< std::vector< MCAuto > >& edgePtrs) { get(pos);//to check pos - bool const isFast(pos==0 && _pool.size()==1); - std::size_t const sz(edges.size()); + bool isFast(pos==0 && _pool.size()==1); + std::size_t sz(edges.size()); // dealing with edges if(sz==1) _edge_info.push_back(EdgeInfo(istart,iend,mesh1DInCase)); @@ -1035,13 +1023,13 @@ void VectorOfCellInfo::setMeshAt(mcIdType pos, const MCAuto& m std::vector< MCAuto > ms; if(pos>0) { - MCAuto const elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(0,pos,true))); + MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(0,pos,true))); ms.push_back(elt); } ms.push_back(mesh); if(pos<_ze_mesh->getNumberOfCells()-1) { - MCAuto const elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true))); + MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true))); ms.push_back(elt); } std::vector< const MEDCouplingUMesh *> ms2(ms.size()); @@ -1060,7 +1048,7 @@ mcIdType VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId(mcIdType pos) const if(pos<0) throw INTERP_KERNEL::Exception("VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId : invalid id ! Must be >=0 !"); mcIdType ret(0); - for(auto it=_edge_info.begin();it!=_edge_info.end();it++,ret++) + for(std::vector::const_iterator it=_edge_info.begin();it!=_edge_info.end();it++,ret++) { if((*it).isInMyRange(pos)) return ret; @@ -1073,7 +1061,7 @@ void VectorOfCellInfo::updateEdgeInfo(mcIdType pos, const std::vector< MCAuto& allEdges, const std::vector< MCAuto >& allEdgesPtr, mcIdType offset, MCAuto& idsLeftRight) { - mcIdType const nbCellsInSplitMesh1D=splitMesh1D->getNumberOfCells(); + mcIdType nbCellsInSplitMesh1D=splitMesh1D->getNumberOfCells(); if(nbCellsInSplitMesh1D==0) throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal : internal error ! input 1D mesh must have at least one cell !"); const mcIdType *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin()); @@ -1169,7 +1157,7 @@ MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh iEnd++; MCAuto partOfSplitMesh1D(static_cast(splitMesh1D->buildPartOfMySelfSlice(iStart,iEnd,1,true))); - mcIdType const pos(pool.getPositionOf(eps,partOfSplitMesh1D)); + mcIdType pos(pool.getPositionOf(eps,partOfSplitMesh1D)); // MCAutoretTmp(MEDCouplingUMesh::New("",2)); retTmp->setCoords(splitMesh1D->getCoords()); @@ -1194,7 +1182,7 @@ MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh /* * splitMesh1D is an input parameter but might have its cells renumbered. */ -MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, mcIdType /*cellIdInMesh2D*/, const MEDCouplingUMesh *mesh2DDesc, MEDCouplingUMesh *splitMesh1D, +MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, mcIdType cellIdInMesh2D, const MEDCouplingUMesh *mesh2DDesc, MEDCouplingUMesh *splitMesh1D, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector >& intersectEdge1, mcIdType offset, MCAuto& idsLeftRight) { @@ -1204,15 +1192,15 @@ MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, mcIdType /*cellIdInMesh2D*/, c std::vector< MCAuto > allEdgesPtr; // for each sub edge in splitMesh2D the uncut Edge object of the original mesh2D for(const mcIdType *it(descBg);it!=descEnd;it++) // for all edges in the descending connectivity of the 2D mesh in relative Fortran mode { - mcIdType const edgeId(std::abs(*it)-1); + mcIdType edgeId(std::abs(*it)-1); std::map< MCAuto,mcIdType> m; - MCAuto const ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m)); + MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m)); const std::vector& edge1(intersectEdge1[edgeId]); if(*it>0) allEdges.insert(allEdges.end(),edge1.begin(),edge1.end()); else allEdges.insert(allEdges.end(),edge1.rbegin(),edge1.rend()); - std::size_t const sz(edge1.size()); + std::size_t sz(edge1.size()); for(std::size_t cnt=0;cnt cur2D(static_cast(mesh2DSplit->buildPartOfMySelf(it,it+1,true))); const mcIdType *c(cur2D->getNodalConnectivity()->begin()),*ci(cur2D->getNodalConnectivityIndex()->begin()); const INTERP_KERNEL::CellModel &cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[0]])); - unsigned const sz(cm.getNumberOfSons2(c+ci[0]+1,ci[1]-ci[0]-1)); + unsigned sz(cm.getNumberOfSons2(c+ci[0]+1,ci[1]-ci[0]-1)); INTERP_KERNEL::AutoPtr tmpPtr(new mcIdType[ci[1]-ci[0]]); for(unsigned it2=0;it2 >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, std::vector& addCoo, std::map& mergedNodes) { static const int SPACEDIM=2; - INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps); + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); const mcIdType *c1(m1Desc->getNodalConnectivity()->begin()),*ci1(m1Desc->getNodalConnectivityIndex()->begin()); // Build BB tree of all edges in the tool mesh (second mesh) MCAuto bbox1Arr(m1Desc->getBoundingBoxForBBTree(eps)),bbox2Arr(m2Desc->getBoundingBoxForBBTree(eps)); @@ -1317,12 +1305,12 @@ void MEDCouplingUMesh::Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const M intersectEdge1.resize(nDescCell1); colinear2.resize(nDescCell2); subDiv2.resize(nDescCell2); - BBTree const myTree(bbox2,nullptr,0,m2Desc->getNumberOfCells(),-eps); - BBTreePts const treeNodes2(m2Desc->getCoords()->begin(),nullptr,0,m2Desc->getCoords()->getNumberOfTuples(),eps); + BBTree myTree(bbox2,0,0,m2Desc->getNumberOfCells(),-eps); + BBTreePts treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps); std::vector candidates1(1); - mcIdType const offset1(m1Desc->getNumberOfNodes()); - mcIdType const offset2(offset1+m2Desc->getNumberOfNodes()); + mcIdType offset1(m1Desc->getNumberOfNodes()); + mcIdType offset2(offset1+m2Desc->getNumberOfNodes()); for(mcIdType i=0;i candidates2; // edges of mesh2 candidate for intersection @@ -1343,9 +1331,9 @@ void MEDCouplingUMesh::Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const M // This trick guarantees that Node * are discriminant (i.e. form a unique identifier) std::set nodes; pol1->getAllNodes(nodes); pol2->getAllNodes(nodes); - std::size_t const szz(nodes.size()); + std::size_t szz(nodes.size()); std::vector< MCAuto > nodesSafe(szz); - auto itt(nodes.begin()); + std::set::const_iterator itt(nodes.begin()); for(std::size_t iii=0;iiiincrRef(); nodesSafe[iii]=*itt; } // end of protection @@ -1409,16 +1397,16 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo static const int SPACEDIM=2; const double *coo1(m1->getCoords()->begin()); const mcIdType *conn1(m1->getNodalConnectivity()->begin()),*connI1(m1->getNodalConnectivityIndex()->begin()); - mcIdType const offset1(m1->getNumberOfNodes()); + mcIdType offset1(m1->getNumberOfNodes()); const double *coo2(m2->getCoords()->begin()); const mcIdType *conn2(m2->getNodalConnectivity()->begin()),*connI2(m2->getNodalConnectivityIndex()->begin()); - mcIdType const offset2(offset1+m2->getNumberOfNodes()); - mcIdType const offset3(offset2+ToIdType(addCoords.size())/2); + mcIdType offset2(offset1+m2->getNumberOfNodes()); + mcIdType offset3(offset2+ToIdType(addCoords.size())/2); MCAuto bbox1Arr(m1->getBoundingBoxForBBTree(eps)),bbox2Arr(m2->getBoundingBoxForBBTree(eps)); const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin()); // Here a BBTree on 2D-cells, not on segments: - BBTree const myTree(bbox2,nullptr,0,m2->getNumberOfCells(),eps); - mcIdType const ncell1=m1->getNumberOfCells(); + BBTree myTree(bbox2,0,0,m2->getNumberOfCells(),eps); + mcIdType ncell1=m1->getNumberOfCells(); crI.push_back(0); for(mcIdType i=0;i mapp; std::map mappRev; INTERP_KERNEL::QuadraticPolygon pol1; - auto const typ=(INTERP_KERNEL::NormalizedCellType)conn1[connI1[i]]; + INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)conn1[connI1[i]]; const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ); // Populate mapp and mappRev with nodes from the current cell (i) from mesh1 - this also builds the Node* objects: MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,/* output */mapp,mappRev); @@ -1448,7 +1436,7 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo // Again all the additional intersecting nodes are there. for(std::vector::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++) { - auto const typ2=(INTERP_KERNEL::NormalizedCellType)conn2[connI2[*it2]]; + INTERP_KERNEL::NormalizedCellType typ2=(INTERP_KERNEL::NormalizedCellType)conn2[connI2[*it2]]; const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(typ2); // Complete mapping with elements coming from the current cell it2 in mesh2: MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,/* output */mapp,mappRev); @@ -1491,16 +1479,16 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo void InsertNodeInConnIfNecessary(mcIdType nodeIdToInsert, std::vector& conn, const double *coords, double eps) { - auto const it(std::find(conn.begin(),conn.end(),nodeIdToInsert)); + std::vector::iterator it(std::find(conn.begin(),conn.end(),nodeIdToInsert)); if(it!=conn.end()) return ; - std::size_t const sz(conn.size()); + std::size_t sz(conn.size()); std::size_t found(std::numeric_limits::max()); for(std::size_t i=0;i(),std::placeholders::_1,1./normm)); std::transform(v2,v2+3,v2,std::bind(std::multiplies(),std::placeholders::_1,1./normm)); double v3[3]; @@ -1520,11 +1508,11 @@ void InsertNodeInConnIfNecessary(mcIdType nodeIdToInsert, std::vector& void SplitIntoToPart(const std::vector& conn, mcIdType pt0, mcIdType pt1, std::vector& part0, std::vector& part1) { - std::size_t const sz(conn.size()); + std::size_t sz(conn.size()); std::vector *curPart(&part0); for(std::size_t i=0;ibegin()),*nodalIndx3D(_nodal_connec_index->begin()); - mcIdType const nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(nbOfCells!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works only with single cell presently !"); for(mcIdType i=0;i& p=cut3DSurf[desc[offset+j]]; const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodal3D[nodalIndx3D[i]])); - mcIdType const sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1; + mcIdType sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1; INTERP_KERNEL::AutoPtr tmp(new mcIdType[sz]); INTERP_KERNEL::NormalizedCellType cmsId; - unsigned const nbOfNodesSon(cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId)); + unsigned nbOfNodesSon(cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId)); std::vector elt((mcIdType *)tmp,(mcIdType *)tmp+nbOfNodesSon); if(p.first!=-1 && p.second!=-1) { @@ -1591,8 +1579,8 @@ void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pairgetNumberOfTuples()); + mcIdType ncells=getNumberOfCells(); + mcIdType lgthToReach(getNodalConnectivityArrayLen()+subNodesInSeg->getNumberOfTuples()); MCAuto c(DataArrayIdType::New()); c->alloc((std::size_t)lgthToReach); const mcIdType *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin()); mcIdType *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer()); @@ -1629,8 +1617,8 @@ void MEDCouplingUMesh::split2DCellsLinear(const DataArrayIdType *desc, const Dat mcIdType MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *mid, const DataArrayIdType *midI) { checkConsistencyLight(); - mcIdType const ncells=getNumberOfCells(); - mcIdType const lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples()); + mcIdType ncells=getNumberOfCells(); + mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples()); mcIdType nodesCnt(getNumberOfNodes()); MCAuto c(DataArrayIdType::New()); c->alloc((std::size_t)lgthToReach); MCAuto addCoo(DataArrayDouble::New()); addCoo->alloc(0,1); @@ -1643,7 +1631,7 @@ mcIdType MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayIdType *desc, co { mcIdType offset(descIPtr[0]),sz(descIPtr[1]-descIPtr[0]),deltaSz(sz); for(mcIdType j=0;jcheckFullyDefined(); m2->checkFullyDefined(); - INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps); + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); if(m1->getMeshDimension()!=2 || m1->getSpaceDimension()!=2 || m2->getMeshDimension()!=2 || m2->getSpaceDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes works on umeshes m1 AND m2 with meshdim equal to 2 and spaceDim equal to 2 too!"); // Step 1: compute all edge intersections (new nodes) std::vector< std::vector > intersectEdge1, colinear2, subDiv2; - MEDCouplingUMesh *m1Desc=nullptr,*m2Desc=nullptr; // descending connec. meshes - DataArrayIdType *desc1=nullptr,*descIndx1=nullptr,*revDesc1=nullptr,*revDescIndx1=nullptr,*desc2=nullptr,*descIndx2=nullptr,*revDesc2=nullptr,*revDescIndx2=nullptr; + MEDCouplingUMesh *m1Desc=0,*m2Desc=0; // descending connec. meshes + DataArrayIdType *desc1=0,*descIndx1=0,*revDesc1=0,*revDescIndx1=0,*desc2=0,*descIndx2=0,*revDesc2=0,*revDescIndx2=0; std::vector addCoo,addCoordsQuadratic; // coordinates of newly created nodes IntersectDescending2DMeshes(m1,m2,eps,intersectEdge1,colinear2, subDiv2, m1Desc,desc1,descIndx1,revDesc1,revDescIndx1, @@ -1745,7 +1733,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 // Step 2: re-order newly created nodes according to the ordering found in m2 std::vector< std::vector > intersectEdge2; BuildIntersectEdges(m1Desc,m2Desc,addCoo,subDiv2,intersectEdge2); - subDiv2.clear(); dd5=nullptr; dd6=nullptr; + subDiv2.clear(); dd5=0; dd6=0; // Step 3: std::vector cr,crI; //no DataArrayIdType because interface with Geometric2D @@ -1825,7 +1813,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, // Step 1: compute all edge intersections (new nodes) std::vector< std::vector > intersectEdge1, colinear2, subDiv2; std::vector addCoo,addCoordsQuadratic; // coordinates of newly created nodes - INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps); + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); // // Build desc connectivity DataArrayIdType *desc1(DataArrayIdType::New()),*descIndx1(DataArrayIdType::New()),*revDesc1(DataArrayIdType::New()),*revDescIndx1(DataArrayIdType::New()); @@ -1834,17 +1822,17 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, std::map mergedNodes; Intersect1DMeshes(m1Desc,mesh1D,eps,intersectEdge1,colinear2,subDiv2,addCoo,mergedNodes); // use mergeNodes to fix intersectEdge1 - for(auto & it0 : intersectEdge1) + for(std::vector< std::vector >::iterator it0=intersectEdge1.begin();it0!=intersectEdge1.end();it0++) { - std::size_t const n(it0.size()/2); - mcIdType eltStart(it0[0]),eltEnd(it0[2*n-1]); + std::size_t n((*it0).size()/2); + mcIdType eltStart((*it0)[0]),eltEnd((*it0)[2*n-1]); std::map::const_iterator it1; it1=mergedNodes.find(eltStart); if(it1!=mergedNodes.end()) - it0[0]=(*it1).second; + (*it0)[0]=(*it1).second; it1=mergedNodes.find(eltEnd); if(it1!=mergedNodes.end()) - it0[2*n-1]=(*it1).second; + (*it0)[2*n-1]=(*it1).second; } // MCAuto addCooDa(DataArrayDouble::New()); @@ -1883,8 +1871,8 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const mcIdType* cellId1 = cells->begin() + cellsIndex->begin()[*it]; const mcIdType* cellId2 = cells->begin() + cellsIndex->begin()[*it]+1; - std::set const s1(realIdsInDesc2D->begin()+dd2->begin()[*cellId1], realIdsInDesc2D->begin()+dd2->begin()[*cellId1+1]); - std::set const s2(realIdsInDesc2D->begin()+dd2->begin()[*cellId2], realIdsInDesc2D->begin()+dd2->begin()[*cellId2+1]); + std::set s1(realIdsInDesc2D->begin()+dd2->begin()[*cellId1], realIdsInDesc2D->begin()+dd2->begin()[*cellId1+1]); + std::set s2(realIdsInDesc2D->begin()+dd2->begin()[*cellId2], realIdsInDesc2D->begin()+dd2->begin()[*cellId2+1]); std::vector commonEdgeId; std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(), std::back_inserter(commonEdgeId)); @@ -1911,17 +1899,17 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, MCAuto out0s;//ids in mesh2D that are impacted by the fact that some edges of \a mesh1D are part of the edges of those cells if(!idsInDesc2DToBeRefined->empty()) { - DataArrayIdType *out0(nullptr),*outi0(nullptr); + DataArrayIdType *out0(0),*outi0(0); DataArrayIdType::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0); - MCAuto const outi0s(outi0); + MCAuto outi0s(outi0); out0s=out0; out0s=out0s->buildUnique(); out0s->sort(true); } // MCAuto ret1NonCol(static_cast(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end()))); - MCAuto const baryRet1(centerOfMassRet1->selectByTupleId(idsInRet1NotColinear->begin(), idsInRet1NotColinear->end())); - DataArrayIdType *out(nullptr),*outi(nullptr); + MCAuto baryRet1(centerOfMassRet1->selectByTupleId(idsInRet1NotColinear->begin(), idsInRet1NotColinear->end())); + DataArrayIdType *out(0),*outi(0); DataArrayIdType::ExtractFromIndexedArrays(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end(),cells,cellsIndex,out,outi); MCAuto elts(out),eltsIndex(outi); @@ -1947,22 +1935,22 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, {// here dealing with cells in out0s but not in cellsToBeModified MCAuto fewModifiedCells(out0s->buildSubstraction(cellsToBeModified)); const mcIdType *rdptr(dd3->begin()),*rdiptr(dd4->begin()),*dptr(dd1->begin()),*diptr(dd2->begin()); - for(long const it : *fewModifiedCells) + for(const mcIdType *it=fewModifiedCells->begin();it!=fewModifiedCells->end();it++) { - outMesh2DSplit.push_back(BuildRefined2DCell(ret1->getCoords(),mesh2D,it,dptr+diptr[it],dptr+diptr[it+1],intersectEdge1)); + outMesh2DSplit.push_back(BuildRefined2DCell(ret1->getCoords(),mesh2D,*it,dptr+diptr[*it],dptr+diptr[*it+1],intersectEdge1)); ret1->setCoords(outMesh2DSplit.back()->getCoords()); } - mcIdType const offset(ret2->getNumberOfTuples()); + mcIdType offset(ret2->getNumberOfTuples()); ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end()); MCAuto partOfRet3(DataArrayIdType::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1); partOfRet3->fillWithValue(std::numeric_limits::max()); partOfRet3->rearrange(2); mcIdType kk(0),*ret3ptr(partOfRet3->getPointer()); for(const mcIdType *it=idsInDescMesh2DForIdsInRetColinear->begin();it!=idsInDescMesh2DForIdsInRetColinear->end();it++,kk++) { - mcIdType const faceId(std::abs(*it)-1); + mcIdType faceId(std::abs(*it)-1); for(const mcIdType *it2=rdptr+rdiptr[faceId];it2!=rdptr+rdiptr[faceId+1];it2++) { - mcIdType const tmp(fewModifiedCells->findIdFirstEqual(*it2)); + mcIdType tmp(fewModifiedCells->findIdFirstEqual(*it2)); if(tmp!=-1) { if(std::find(dptr+diptr[*it2],dptr+diptr[*it2+1],-(*it))!=dptr+diptr[*it2+1]) @@ -1985,8 +1973,8 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, if(!outMesh2DSplit.empty()) { DataArrayDouble *da(outMesh2DSplit.back()->getCoords()); - for(auto & itt : outMesh2DSplit) - itt->setCoords(da); + for(std::vector< MCAuto >::iterator itt=outMesh2DSplit.begin();itt!=outMesh2DSplit.end();itt++) + (*itt)->setCoords(da); } } cellsToBeModified=cellsToBeModified->buildUniqueNotSorted(); @@ -2004,7 +1992,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, ret2->pushBackSilent(*it); } // - std::size_t const nbOfMeshes(outMesh2DSplit.size()); + std::size_t nbOfMeshes(outMesh2DSplit.size()); std::vector tmp(nbOfMeshes); for(std::size_t i=0;i edgesToDealWith(ret3->findIdsStrictlyNegative()); for(const mcIdType *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++) { - mcIdType const old2DCellId(-ret3->getIJ(*it,0)-1); + mcIdType old2DCellId(-ret3->getIJ(*it,0)-1); MCAuto candidates(ret2->findIdsEqual(old2DCellId)); ret3->setIJ(*it,0,FindRightCandidateAmong(ret2D,candidates->begin(),candidates->end(),ret1,*it%2==0?-((*it)/2+1):(*it)/2+1,eps));// div by 2 because 2 components natively in ret3 } @@ -2065,27 +2053,27 @@ DataArrayIdType *MEDCouplingUMesh::conformize2D(double eps) const double *bbox(bboxArr->begin()),*coords(getCoords()->begin()); mcIdType nCell=getNumberOfCells(),nDescCell=mDesc->getNumberOfCells(); std::vector< std::vector > intersectEdge(nDescCell),overlapEdge(nDescCell); - std::vector const addCoo; - BBTree const myTree(bbox,nullptr,0,nDescCell,-eps); - INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps); + std::vector addCoo; + BBTree myTree(bbox,0,0,nDescCell,-eps); + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); for(mcIdType i=0;i candidates; myTree.getIntersectingElems(bbox+i*2*SPACEDIM,candidates); - for(long const candidate : candidates) - if(candidate>i) // we're dealing with pair of edges, no need to treat the same pair twice + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + if(*it>i) // we're dealing with pair of edges, no need to treat the same pair twice { std::map,mcIdType> m; INTERP_KERNEL::Edge *e1(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coords,m)), - *e2(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[candidate]],c+ci[candidate]+1,coords,m)); + *e2(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[*it]],c+ci[*it]+1,coords,m)); INTERP_KERNEL::MergePoints merge; INTERP_KERNEL::QuadraticPolygon c1,c2; e1->intersectWith(e2,merge,c1,c2); e1->decrRef(); e2->decrRef(); if(IKGeo2DInternalMapper(c1,m,c[ci[i]+1],c[ci[i]+2],intersectEdge[i])) - overlapEdge[i].push_back(candidate); - if(IKGeo2DInternalMapper(c2,m,c[ci[candidate]+1],c[ci[candidate]+2],intersectEdge[candidate])) - overlapEdge[candidate].push_back(i); + overlapEdge[i].push_back(*it); + if(IKGeo2DInternalMapper(c2,m,c[ci[*it]+1],c[ci[*it]+2],intersectEdge[*it])) + overlapEdge[*it].push_back(i); } } // splitting done. sort intersect point in intersectEdge. @@ -2096,7 +2084,7 @@ DataArrayIdType *MEDCouplingUMesh::conformize2D(double eps) for(mcIdType i=0;i& isect(intersectEdge[i]); - std::size_t const sz(isect.size()); + std::size_t sz(isect.size()); if(sz>1) { std::map,mcIdType> m; @@ -2122,17 +2110,17 @@ DataArrayIdType *MEDCouplingUMesh::conformize2D(double eps) middleNeedsToBeUsed=true; const std::vector& candidates(overlapEdge[i]); std::vector trueCandidates; - for(long const candidate : candidates) - if((INTERP_KERNEL::NormalizedCellType)c[ci[candidate]]==INTERP_KERNEL::NORM_SEG3) - trueCandidates.push_back(candidate); + for(std::vector::const_iterator itc=candidates.begin();itc!=candidates.end();itc++) + if((INTERP_KERNEL::NormalizedCellType)c[ci[*itc]]==INTERP_KERNEL::NORM_SEG3) + trueCandidates.push_back(*itc); mcIdType stNode(c[ci[i]+1]),endNode(isect[0]); for(std::size_t j=0;j::const_iterator itc=trueCandidates.begin();itc!=trueCandidates.end();itc++) { - mcIdType tmpSt(c[ci[trueCandidate]+1]),tmpEnd(c[ci[trueCandidate]+2]); + mcIdType tmpSt(c[ci[*itc]+1]),tmpEnd(c[ci[*itc]+2]); if((tmpSt==stNode && tmpEnd==endNode) || (tmpSt==endNode && tmpEnd==stNode)) - { mid[j]=trueCandidate; break; } + { mid[j]=*itc; break; } } stNode=endNode; endNode=j mSafe,nSafe,oSafe,pSafe,qSafe,rSafe; - DataArrayIdType *m(nullptr),*n(nullptr),*o(nullptr),*p(nullptr),*q(nullptr),*r(nullptr); + DataArrayIdType *m(0),*n(0),*o(0),*p(0),*q(0),*r(0); DataArrayIdType::ExtractFromIndexedArrays(ret->begin(),ret->end(),desc1,descIndx1,m,n); mSafe=m; nSafe=n; DataArrayIdType::PutIntoToSkylineFrmt(intersectEdge,o,p); oSafe=o; pSafe=p; if(middleNeedsToBeUsed) { DataArrayIdType::PutIntoToSkylineFrmt(middle,q,r); qSafe=q; rSafe=r; } MCAuto modif(static_cast(buildPartOfMySelf(ret->begin(),ret->end(),true))); - mcIdType const nbOfNodesCreated(modif->split2DCells(mSafe,nSafe,oSafe,pSafe,qSafe,rSafe)); + mcIdType nbOfNodesCreated(modif->split2DCells(mSafe,nSafe,oSafe,pSafe,qSafe,rSafe)); setCoords(modif->getCoords());//if nbOfNodesCreated==0 modif and this have the same coordinates pointer so this line has no effect. But for quadratic cases this line is important. setPartOfMySelf(ret->begin(),ret->end(),*modif); { bool areNodesMerged; mcIdType newNbOfNodes; if(nbOfNodesCreated!=0) - MCAuto const tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes)); + MCAuto tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes)); } return ret.retn(); } @@ -2215,7 +2203,7 @@ DataArrayIdType *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayCo checkConsistencyLight(); if(getSpaceDimension()!=2 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !"); - INTERP_KERNEL::QuadraticPlanarPrecision const prec(eps); + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); mcIdType nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); const mcIdType *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin()); MCAuto newc(DataArrayIdType::New()),newci(DataArrayIdType::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0); @@ -2230,8 +2218,8 @@ DataArrayIdType *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayCo MCAuto dsi(revDescI2->deltaShiftIndex()); MCAuto ids(dsi->findIdsGreaterThan(2)); const mcIdType * cPtr(mDesc0D->getNodalConnectivity()->begin()); - for(long const it : *ids) - forbiddenPoints[cPtr[2*it+1]] = true; // we know that a 0D mesh has a connectivity of the form [NORM_POINT1, i1, NORM_POINT1, i2, ...] + for(auto it = ids->begin(); it != ids->end(); it++) + forbiddenPoints[cPtr[2*(*it)+1]] = true; // we know that a 0D mesh has a connectivity of the form [NORM_POINT1, i1, NORM_POINT1, i2, ...] } MCAuto appendedCoords(DataArrayDouble::New()); appendedCoords->alloc(0,1);//1 not 2 it is not a bug. @@ -2287,9 +2275,9 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, mcIdType startNo // Keep what is inside [startNode, endNode]: mcIdType go = 0; - for (const auto & it : xx) + for (vector::const_iterator it=xx.begin(); it != xx.end(); ++it) { - const mcIdType idx = it.second; + const mcIdType idx = (*it).second; if (!go) { if (idx == startNode) go = 1; @@ -2314,9 +2302,9 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, mcIdType startNo for (const mcIdType * it = idsBg; it != endBg; ++it) { mcIdType start = c[cI[*it]+1], end = c[cI[*it]+2]; - vector::const_iterator const itStart = find(pointIds.begin(), pointIds.end(), start); + vector::const_iterator itStart = find(pointIds.begin(), pointIds.end(), start); if (itStart == pointIds.end()) continue; - vector::const_iterator const itEnd = find(pointIds.begin(), pointIds.end(), end); + vector::const_iterator itEnd = find(pointIds.begin(), pointIds.end(), end); if (itEnd == pointIds.end()) continue; if (abs(distance(itEnd, itStart)) != 1) continue; hitSegs.push_back(*it); // segment is undivided. @@ -2329,19 +2317,19 @@ void MEDCouplingUMesh::ReplaceEdgeInFace(const mcIdType * sIdxConn, const mcIdTy const std::vector& insidePoints, std::vector& modifiedFace) { using namespace std; - size_t const dst = distance(sIdxConn, sIdxConnE); + size_t dst = distance(sIdxConn, sIdxConnE); modifiedFace.reserve(dst + insidePoints.size()-2); modifiedFace.resize(dst); copy(sIdxConn, sIdxConnE, modifiedFace.data()); - auto const shortEnd = modifiedFace.begin()+dst; - auto startPos = find(modifiedFace.begin(), shortEnd , startNode); + vector::iterator shortEnd = modifiedFace.begin()+dst; + vector::iterator startPos = find(modifiedFace.begin(), shortEnd , startNode); if (startPos == shortEnd) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ReplaceEdgeInFace: internal error, should never happen!"); - auto endPos = find(modifiedFace.begin(),shortEnd, endNode); + vector::iterator endPos = find(modifiedFace.begin(),shortEnd, endNode); if (endPos == shortEnd) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ReplaceEdgeInFace: internal error, should never happen!"); - size_t const d = distance(startPos, endPos); + size_t d = distance(startPos, endPos); if (d == 1 || d == (1-dst)) // don't use modulo, for neg numbers, result is implementation defined ... modifiedFace.insert(++startPos, ++insidePoints.begin(), --insidePoints.end()); // insidePoints also contains start and end node. Those don't need to be inserted. else @@ -2404,8 +2392,8 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) // Build BBTree MCAuto bboxArr(mDesc->getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()); getCoords()->begin(); - mcIdType const nDescCell=mDesc->getNumberOfCells(); - BBTree const myTree(bbox,nullptr,0,nDescCell,-eps); + mcIdType nDescCell=mDesc->getNumberOfCells(); + BBTree myTree(bbox,0,0,nDescCell,-eps); // Surfaces - handle biggest first MCAuto surfF = mDesc->getMeasureField(true); DataArrayDouble * surfs = surfF->getArray(); @@ -2418,27 +2406,27 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) vector< pair > S; for(mcIdType i=0;i < surfs->getNumberOfTuples();i++) { - pair const p = make_pair(surfs->begin()[i], i); + pair p = make_pair(surfs->begin()[i], i); S.push_back(p); } sort(S.rbegin(),S.rend()); // reverse sort vector hit(nDescCell); fill(hit.begin(), hit.end(), false); - vector const hitPoly; // the final result: which 3D cells have been modified. + vector hitPoly; // the final result: which 3D cells have been modified. - for(const auto & it : S) + for( vector >::const_iterator it = S.begin(); it != S.end(); it++) { - mcIdType const faceIdx = it.second; + mcIdType faceIdx = (*it).second; if (hit[faceIdx]) continue; vector candidates, cands2; myTree.getIntersectingElems(bbox+faceIdx*2*SPACEDIM,candidates); // Keep only candidates whose normal matches the normal of current face - for(long const candidate : candidates) + for(vector::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) { - bool const col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + candidate*SPACEDIM, eps/carMeshSz); // using rough relative epsilon - if (candidate != faceIdx && col) - cands2.push_back(candidate); + bool col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + *(it2)*SPACEDIM, eps/carMeshSz); // using rough relative epsilon + if (*it2 != faceIdx && col) + cands2.push_back(*it2); } if (!cands2.size()) continue; @@ -2495,9 +2483,9 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) double checkSurf=0.0; const mcIdType * idsGoodPlaneP(idsGoodPlane->begin()); - for (long const ii : *ids) + for (const mcIdType * ii = ids->begin(); ii != ids->end(); ii++) { - mcIdType const faceIdx2 = cands2[idsGoodPlaneP[ii]]; + mcIdType faceIdx2 = cands2[idsGoodPlaneP[*ii]]; hit[faceIdx2] = true; checkSurf += surfs->begin()[faceIdx2]; } @@ -2534,12 +2522,12 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) for (const mcIdType * ii = ids->begin(); ii != ids->end(); ii++) { // Build pack from the face to insert: - mcIdType const faceIdx2 = cands2[idsGoodPlane->getIJ(*ii,0)]; + mcIdType faceIdx2 = cands2[idsGoodPlane->getIJ(*ii,0)]; mcIdType facePack2Sz; const mcIdType * facePack2 = connSlaDesc->getSimplePackSafePtr(faceIdx2, facePack2Sz); // contains the type! // Insert it in all hit polyhedrons: - for (long const polyIndice : polyIndices) - connSla->pushBackPack(polyIndice, facePack2+1, facePack2+facePack2Sz); // without the type + for (vector::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2) + connSla->pushBackPack(*it2, facePack2+1, facePack2+facePack2Sz); // without the type } } } // end step1 @@ -2574,8 +2562,8 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) const mcIdType *cDesc2(mDesc2->getNodalConnectivity()->begin()),*cIDesc2(mDesc2->getNodalConnectivityIndex()->begin()); MCAuto bboxArr(mDesc2->getBoundingBoxForBBTree(eps)); const double *bbox2(bboxArr->begin()); - mcIdType const nDesc2Cell=mDesc2->getNumberOfCells(); - BBTree const myTree2(bbox2,nullptr,0,nDesc2Cell,-eps); + mcIdType nDesc2Cell=mDesc2->getNumberOfCells(); + BBTree myTree2(bbox2,0,0,nDesc2Cell,-eps); // Edges - handle longest first MCAuto lenF = mDesc2->getMeasureField(true); @@ -2585,7 +2573,7 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) vector > S; for(mcIdType i=0;i < lens->getNumberOfTuples();i++) { - pair const p = make_pair(lens->getIJ(i, 0), i); + pair p = make_pair(lens->getIJ(i, 0), i); S.push_back(p); } sort(S.rbegin(),S.rend()); // reverse sort @@ -2593,9 +2581,9 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) vector hit(nDesc2Cell); fill(hit.begin(), hit.end(), false); - for(const auto & it : S) + for( vector >::const_iterator it = S.begin(); it != S.end(); it++) { - mcIdType const eIdx = it.second; + mcIdType eIdx = (*it).second; if (hit[eIdx]) continue; @@ -2607,27 +2595,27 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) for (mcIdType i3=0; i3 < 3; i3++) // TODO: use fillSonCellNodalConnectivity2 or similar? vCurr[i3] = coo[start*SPACEDIM+i3] - coo[end*SPACEDIM+i3]; double carSz = INTERP_KERNEL::caracteristicDimVector(vCurr), eps2 = eps*carSz*carSz*carSz; - for(long const candidate : candidates) + for(vector::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) { double vOther[3]; - mcIdType start2 = cDesc2[cIDesc2[candidate]+1], end2 = cDesc2[cIDesc2[candidate]+2]; + mcIdType start2 = cDesc2[cIDesc2[*it2]+1], end2 = cDesc2[cIDesc2[*it2]+2]; for (mcIdType i3=0; i3 < 3; i3++) vOther[i3] = coo[start2*SPACEDIM+i3] - coo[end2*SPACEDIM+i3]; // isColinear() expect unit vecotr, and relative (non geometrical) precision. // relative prec means going from eps -> eps/curSz // normalizing vCurr and vOther means multiplying by v^4, knowing that inside isColinear3D() the square (^2) of a dot product (^2) is computed - bool const col = INTERP_KERNEL::isColinear3D(vCurr, vOther, eps2); + bool col = INTERP_KERNEL::isColinear3D(vCurr, vOther, eps2); // Warning: different from faces: we need to keep eIdx in the final list of candidates because we need // to have its nodes inside the sub mesh mPartCand below (needed in OrderPointsAlongLine()) if (col) - cands2.push_back(candidate); + cands2.push_back(*it2); } if (cands2.size() == 1 && cands2[0] == eIdx) // see warning above continue; // Now rotate edges to bring them on Ox - mcIdType const startNode = cDesc2[cIDesc2[eIdx]+1]; - mcIdType const endNode = cDesc2[cIDesc2[eIdx]+2]; + mcIdType startNode = cDesc2[cIDesc2[eIdx]+1]; + mcIdType endNode = cDesc2[cIDesc2[eIdx]+2]; INTERP_KERNEL::TranslationRotationMatrix rotation; INTERP_KERNEL::TranslationRotationMatrix::Rotate3DBipoint(coo+SPACEDIM*startNode, coo+SPACEDIM*endNode, rotation); MCAuto mPartRef(mDesc2->buildPartOfMySelfSlice(eIdx, eIdx+1,1,false)); // false=zipCoords is called @@ -2660,26 +2648,26 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) // Now the ordering along the Ox axis: std::vector insidePoints, hitSegs; - bool const isSplit = OrderPointsAlongLine(mPartCand->_coords->getConstPointer(), nodeMap->begin()[startNode], nodeMap->begin()[endNode], + bool isSplit = OrderPointsAlongLine(mPartCand->_coords->getConstPointer(), nodeMap->begin()[startNode], nodeMap->begin()[endNode], mPartCand->getNodalConnectivity()->begin(), mPartCand->getNodalConnectivityIndex()->begin(), idsGoodLine->begin(), idsGoodLine->end(), /*out*/insidePoints, hitSegs); // Optim: smaller segments completely included in eIdx and not split won't need any further treatment: - for (long const hitSeg : hitSegs) - hit[cands2[hitSeg]] = true; + for (vector::const_iterator its=hitSegs.begin(); its != hitSegs.end(); ++its) + hit[cands2[*its]] = true; if (!isSplit) // current segment remains in one piece continue; // Get original node IDs in global coords array - for (long & insidePoint : insidePoints) - insidePoint = nodeMapInv->begin()[insidePoint]; + for (std::vector::iterator iit = insidePoints.begin(); iit!=insidePoints.end(); ++iit) + *iit = nodeMapInv->begin()[*iit]; vector polyIndices, packsIds, facePack; // For each face implying this edge for (mcIdType ii=revDescIP2[eIdx]; ii < revDescIP2[eIdx+1]; ii++) { - mcIdType const faceIdx = revDescP2[ii]; + mcIdType faceIdx = revDescP2[ii]; // each cell where this face is involved connectivity will be modified: ret->pushBackValsSilent(revDescP + revDescIP[faceIdx], revDescP + revDescIP[faceIdx+1]); @@ -2700,12 +2688,12 @@ DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) MCAuto idx(DataArrayIdType::New()); idx->alloc(1); idx->fillWithValue(0); MCAuto vals(DataArrayIdType::New()); vals->alloc(0); newConn->set3(superIdx, idx, vals); - mcIdType const nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); for(mcIdType ii = 0; ii < nbCells; ii++) for (mcIdType jj=descIP[ii]; jj < descIP[ii+1]; jj++) { mcIdType sz, faceIdx = abs(descP[jj])-1; - bool const orient = descP[jj]>0; + bool orient = descP[jj]>0; const mcIdType * p = connSlaDesc->getSimplePackSafePtr(faceIdx, sz); if (orient) newConn->pushBackPack(ii, p+1, p+sz); // +1 to skip type diff --git a/src/MEDCoupling/MEDCouplingVoronoi.cxx b/src/MEDCoupling/MEDCouplingVoronoi.cxx old mode 100644 new mode 100755 index 27df94b77..d5a439002 --- a/src/MEDCoupling/MEDCouplingVoronoi.cxx +++ b/src/MEDCoupling/MEDCouplingVoronoi.cxx @@ -19,29 +19,20 @@ // Author : Anthony Geay (EDF R&D) #include "MEDCouplingVoronoi.hxx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MCAuto.txx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingUMesh.hxx" -#include -#include -#include -#include -#include "NormalizedGeometricTypes" -#include -#include -#include +#include "MEDCouplingNormalizedUnstructuredMesh.txx" +#include "Interpolation2D.txx" +#include "Interpolation3DSurf.hxx" using namespace MEDCoupling; Voronizer::~Voronizer() -= default; +{ +} int Voronizer1D::getDimension() const { @@ -68,13 +59,13 @@ MCAuto ComputeBigCellFrom(const double pt1[2], const double pt static const double PT[2]={0.,0.}; m->scale(PT,FACT); MCAuto mu(m->buildUnstructured()); - double const l(std::max(bbox[1]-bbox[0],bbox[3]-bbox[2])); + double l(std::max(bbox[1]-bbox[0],bbox[3]-bbox[2])); double middle[2]={(pt1[0]+pt2[0])/2.,(pt1[1]+pt2[1])/2.}; double v[2]={pt1[0],pt1[1]}; DataArrayDouble::Rotate2DAlg(middle,M_PI/2,1,v,v); v[0]=middle[0]-v[0]; v[1]=middle[1]-v[1]; { - double const nor(sqrt(v[0]*v[0]+v[1]*v[1])); + double nor(sqrt(v[0]*v[0]+v[1]*v[1])); v[0]/=nor; v[1]/=nor; } MCAuto line(MEDCouplingUMesh::New("line",1)); @@ -88,8 +79,8 @@ MCAuto ComputeBigCellFrom(const double pt1[2], const double pt line->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,CONN); MCAuto sp2,sp1; { - DataArrayIdType *cellNb1(nullptr),*cellNb2(nullptr); - MEDCouplingUMesh *sp2Pt(nullptr),*sp1Pt(nullptr); + DataArrayIdType *cellNb1(0),*cellNb2(0); + MEDCouplingUMesh *sp2Pt(0),*sp1Pt(0); MEDCouplingUMesh::Intersect2DMeshWith1DLine(mu,line,eps,sp2Pt,sp1Pt,cellNb1,cellNb2); sp1=sp1Pt; sp2=sp2Pt; MCAuto cellNb10(cellNb1),cellNb20(cellNb2); @@ -109,7 +100,7 @@ MCAuto ComputeBigCellFrom(const double pt1[2], const double pt } -MCAuto MergeVorCells2D(MEDCouplingUMesh *p, double /*eps*/, bool isZip) +MCAuto MergeVorCells2D(MEDCouplingUMesh *p, double eps, bool isZip) { MCAuto edgeToKeep; MCAuto p0; @@ -147,7 +138,7 @@ MCAuto MergeVorCells2D(MEDCouplingUMesh *p, double /*eps*/, b MCAuto MergeVorCells(const std::vector< MCAuto >& vcs, double eps) { - std::size_t const sz(vcs.size()); + std::size_t sz(vcs.size()); if(sz<1) throw INTERP_KERNEL::Exception("MergeVorCells : len of input vec expected to be >= 1 !"); if(sz==1) @@ -160,7 +151,7 @@ MCAuto MergeVorCells(const std::vector< MCAutozipCoords(); { bool dummy; mcIdType dummy2; - MCAuto const dummy3(p->mergeNodes(eps,dummy,dummy2)); + MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); } return MergeVorCells2D(p,eps,true); } @@ -173,7 +164,7 @@ MCAuto SimplifyPolygon(const MEDCouplingUMesh *m, double eps) if(m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("SimplifyPolygon : internal error !"); const mcIdType *conn(m->getNodalConnectivity()->begin()),*conni(m->getNodalConnectivityIndex()->begin()); - mcIdType const nbPtsInPolygon(conni[1]-conni[0]-1); + mcIdType nbPtsInPolygon(conni[1]-conni[0]-1); const double *coo(m->getCoords()->begin()); std::vector resConn; for(mcIdType i=0;i SimplifyPolygon(const MEDCouplingUMesh *m, double eps) coo[3*current+1]-coo[3*zeNext+1], coo[3*current+2]-coo[3*zeNext+2], }; - double const c[3]={a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2], a[0]*b[1]-a[1]*b[0]}; + double c[3]={a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2], a[0]*b[1]-a[1]*b[0]}; if(sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2])>eps) resConn.push_back(current); } @@ -201,7 +192,7 @@ MCAuto SimplifyPolygon(const MEDCouplingUMesh *m, double eps) MCAuto MergeVorCells3D(const std::vector< MCAuto >& vcs, double eps) { - std::size_t const sz(vcs.size()); + std::size_t sz(vcs.size()); if(sz<1) throw INTERP_KERNEL::Exception("MergeVorCells : len of input vec expected to be >= 1 !"); if(sz==1) @@ -214,7 +205,7 @@ MCAuto MergeVorCells3D(const std::vector< MCAutozipCoords(); { bool dummy; mcIdType dummy2; - MCAuto const dummy3(p->mergeNodes(eps,dummy,dummy2)); + MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); } MCAuto edgeToKeep; MCAuto p0; @@ -228,7 +219,7 @@ MCAuto MergeVorCells3D(const std::vector< MCAuto eqn(skinOfRes->computePlaneEquationOf3DFaces()); MCAuto comm,commI; { - DataArrayIdType *a(nullptr),*b(nullptr); + DataArrayIdType *a(0),*b(0); eqn->findCommonTuples(eps,0,a,b); comm=a; commI=b; //comm=DataArrayIdType::New(); comm->alloc(0,1); commI=DataArrayIdType::New(); commI->alloc(1,1); commI->setIJ(0,0,0); @@ -307,7 +298,7 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * throw INTERP_KERNEL::Exception("Voronoize1D : spacedim must be equal to 1 and meshdim also equal to 1 !"); if(m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("Voronoize1D : mesh is expected to have only one cell !"); - mcIdType const nbPts(points->getNumberOfTuples()); + mcIdType nbPts(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize1D : at least one point expected !"); std::vector bbox(4); @@ -324,7 +315,7 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * { bool dummy; mcIdType newNbNodes; - MCAuto const dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); + MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); } std::vector polygsToIterOn; const double *pt(pts+i); @@ -334,11 +325,12 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * if(polygsToIterOn.size()>2) throw INTERP_KERNEL::Exception("Voronoize1D : overlap of points !"); std::vector< MCAuto > newVorCells; - for(long const poly : polygsToIterOn) + for(std::vector::const_iterator it=polygsToIterOn.begin();it!=polygsToIterOn.end();it++) { + mcIdType poly(*it); // double seed(pts[poly]),zept(*pt); - double const mid((seed+zept)/2.); + double mid((seed+zept)/2.); // MCAuto tile(l0[poly]); tile->zipCoords(); @@ -372,7 +364,7 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis)); { bool dummy; mcIdType dummy2; - MCAuto const dummy3(ret->mergeNodes(eps,dummy,dummy2)); + MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); } return ret; } @@ -387,7 +379,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * throw INTERP_KERNEL::Exception("Voronoize2D : spacedim must be equal to 2 and meshdim also equal to 2 !"); if(m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("Voronoize2D : mesh is expected to have only one cell !"); - mcIdType const nbPts(points->getNumberOfTuples()); + mcIdType nbPts(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize2D : at least one point expected !"); std::vector bbox(4); @@ -404,7 +396,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * { bool dummy; mcIdType newNbNodes; - MCAuto const dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); + MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); } std::vector polygsToIterOn; const double *pt(pts+i*2); @@ -415,7 +407,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * std::vector< MCAuto > newVorCells; while(!elemsToDo.empty()) { - mcIdType const poly(*elemsToDo.begin()); elemsToDo.erase(elemsToDo.begin()); elemsDone.insert(poly); + mcIdType poly(*elemsToDo.begin()); elemsToDo.erase(elemsToDo.begin()); elemsDone.insert(poly); const double *seed(pts+2*poly); MCAuto cell(ComputeBigCellFrom(pt,seed,bbox,eps)); MCAuto tile(l0[poly]); @@ -423,7 +415,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * MCAuto a; MCAuto b,c; { - DataArrayIdType *bPtr(nullptr),*cPtr(nullptr); + DataArrayIdType *bPtr(0),*cPtr(0); a=MEDCouplingUMesh::Intersect2DMeshes(tile,cell,eps,bPtr,cPtr); b=bPtr; c=cPtr; } @@ -447,8 +439,8 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * // MCAuto ids; { - DataArrayIdType *tmp(nullptr); - bool const sta(a->getCoords()->areIncludedInMe(cell->getCoords(),eps,tmp)); + DataArrayIdType *tmp(0); + bool sta(a->getCoords()->areIncludedInMe(cell->getCoords(),eps,tmp)); ids=tmp; if(!sta) throw INTERP_KERNEL::Exception("Voronoize2D : internal error 2 !"); @@ -486,18 +478,18 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis)); { bool dummy; mcIdType dummy2; - MCAuto const dummy3(ret->mergeNodes(eps,dummy,dummy2)); + MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); } return ret; } -MCAuto Split3DCellInParts(const MEDCouplingUMesh *m, const double pt[3], const double seed[3], double eps, mcIdType /*tmp*/[2]) +MCAuto Split3DCellInParts(const MEDCouplingUMesh *m, const double pt[3], const double seed[3], double eps, mcIdType tmp[2]) { if(m->getMeshDimension()!=3 || m->getSpaceDimension()!=3 || m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("Split3DCellInParts : expecting a 3D with exactly one cell !"); - double const middle[3]={(pt[0]+seed[0])/2.,(pt[1]+seed[1])/2.,(pt[2]+seed[2])/2.}; - double const vec[3]={pt[0]-seed[0],pt[1]-seed[1],pt[2]-seed[2]}; - MCAuto const res(m->clipSingle3DCellByPlane(middle,vec,eps)); + double middle[3]={(pt[0]+seed[0])/2.,(pt[1]+seed[1])/2.,(pt[2]+seed[2])/2.}; + double vec[3]={pt[0]-seed[0],pt[1]-seed[1],pt[2]-seed[2]}; + MCAuto res(m->clipSingle3DCellByPlane(middle,vec,eps)); return res; } @@ -512,7 +504,7 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * throw INTERP_KERNEL::Exception("Voronoize3D : spacedim must be equal to 3 and meshdim also equal to 3 !"); if(m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("Voronoize3D : mesh is expected to have only one cell !"); - mcIdType const nbPts(points->getNumberOfTuples()); + mcIdType nbPts(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize3D : at least one point expected !"); std::vector< MCAuto > l0(1,MCAuto(m->deepCopy())); @@ -527,7 +519,7 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * { bool dummy; mcIdType newNbNodes; - MCAuto const dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); + MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); } std::vector polygsToIterOn; const double *pt(pts+i*3); @@ -563,7 +555,7 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis)); { bool dummy; mcIdType dummy2; - MCAuto const dummy3(ret->mergeNodes(eps,dummy,dummy2)); + MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); } return ret; } diff --git a/src/MEDCoupling/MEDCouplingVoronoi.hxx b/src/MEDCoupling/MEDCouplingVoronoi.hxx index 63f4eeb3e..bb1c51e32 100644 --- a/src/MEDCoupling/MEDCouplingVoronoi.hxx +++ b/src/MEDCoupling/MEDCouplingVoronoi.hxx @@ -21,9 +21,8 @@ #ifndef __MEDCOUPLINGVORONOI_HXX__ #define __MEDCOUPLINGVORONOI_HXX__ -#include "MCAuto.hxx" +#include "MEDCoupling.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDCouplingUMesh.hxx" namespace MEDCoupling @@ -39,22 +38,22 @@ namespace MEDCoupling class Voronizer1D : public Voronizer { public: - MCAuto doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const override; - int getDimension() const override; + MCAuto doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const; + int getDimension() const; }; class Voronizer2D : public Voronizer { public: - MCAuto doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const override; - int getDimension() const override; + MCAuto doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const; + int getDimension() const; }; class Voronizer3D : public Voronizer { public: - MCAuto doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const override; - int getDimension() const override; + MCAuto doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const; + int getDimension() const; }; } diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx index ece6a2d0b..ac66d2da5 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx @@ -21,7 +21,7 @@ #ifndef __MEDCOUPLINGBASICSTEST_HXX__ #define __MEDCOUPLINGBASICSTEST_HXX__ -#include +#include #include "MCType.hxx" #include diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx index e20fd2fd6..52b38d9bf 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx @@ -18,15 +18,7 @@ // // Author : Anthony Geay (CEA/DEN) -#include "MCType.hxx" -#include "Interpolation.txx" -#include "Interpolation2D1D.txx" -#include "InterpolationOptions.hxx" -#include "Log.hxx" -#include "Interpolation2D3D.txx" #include "MEDCouplingBasicsTest.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingNormalizedUnstructuredMesh.txx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" @@ -35,14 +27,11 @@ #include "MEDCouplingBasicsTestData1.hxx" +#include "Interpolation2D.txx" +#include "Interpolation2D3D.txx" +#include "Interpolation2D1D.txx" +#include "MEDCouplingNormalizedUnstructuredMesh.txx" #include "MEDCouplingNormalizedCartesianMesh.txx" -#include "NormalizedGeometricTypes" -#include "VectorUtils.hxx" -#include -#include -#include -#include -#include using namespace MEDCoupling; @@ -860,7 +849,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_4() MEDCouplingUMesh *MEDCouplingBasicsTest::build3DTargetMesh_3() { - return nullptr; + return 0; } MEDCouplingMultiFields *MEDCouplingBasicsTest::buildMultiFields_1() @@ -1188,9 +1177,9 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::buildPointe_1(MEDCouplingUMesh *& m1) double MEDCouplingBasicsTest::sumAll(const std::vector< std::map >& matrix) { double ret=0.; - for(const auto & iter : matrix) - for(auto iter2 : iter) - ret+=iter2.second; + for(std::vector< std::map >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++) + for(std::map::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++) + ret+=(*iter2).second; return ret; } @@ -1641,9 +1630,9 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DTetraTargetMesh(const double i int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map >& matrix) { int ret=0; - for(const auto & iter : matrix) - for(auto iter2 : iter) - if (!INTERP_KERNEL::epsilonEqual(iter2.second, 0.)) ret +=1; + for(std::vector< std::map >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++) + for(std::map::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++) + if (!INTERP_KERNEL::epsilonEqual((*iter2).second, 0.)) ret +=1; return ret; } @@ -1653,8 +1642,8 @@ void MEDCouplingBasicsTest::test2D1DMeshesIntersection(MEDCouplingUMesh *sourceM const int correctDuplicateFacesNbr, const int correctTotalIntersectFacesNbr) { - MEDCouplingNormalizedUnstructuredMesh<2,2> const sourceWrapper(sourceMesh); - MEDCouplingNormalizedUnstructuredMesh<2,2> const targetWrapper(targetMesh); + MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); + MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D1D myInterpolator; myInterpolator.setPrecision(1e-12); const double prec = 1.0e-5; @@ -1668,8 +1657,8 @@ void MEDCouplingBasicsTest::test2D1DMeshesIntersection(MEDCouplingUMesh *sourceM LOG(1, "length = " << length <<" correctLength = " << correctLength ); CPPUNIT_ASSERT_DOUBLES_EQUAL(correctLength, length, prec * std::max(correctLength, length)); - INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces = myInterpolator.retrieveDuplicateFaces(); - int const duplicateFacesNbr = (int)duplicateFaces.size(); + INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces(); + int duplicateFacesNbr = (int)duplicateFaces.size(); LOG(1, "duplicateFacesNbr = " << duplicateFacesNbr <<" correctDuplicateFacesNbr = " << correctDuplicateFacesNbr); CPPUNIT_ASSERT_EQUAL(correctDuplicateFacesNbr, duplicateFacesNbr); @@ -1690,16 +1679,16 @@ void MEDCouplingBasicsTest::test3D2DMeshesIntersection(MEDCouplingUMesh *sourceM const int correctDuplicateFacesNbr, const int correctTotalIntersectFacesNbr) { - MEDCouplingNormalizedUnstructuredMesh<3,3> const sourceWrapper(sourceMesh); - MEDCouplingNormalizedUnstructuredMesh<3,3> const targetWrapper(targetMesh); + MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); + MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D3D myInterpolator; myInterpolator.setPrecision(1e-12); const double prec = 1.0e-5; IntersectionMatrix matrix; INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( size_t i = 0; i < sizeof(sp)/sizeof(sp[0]); ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); matrix.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0"); @@ -1709,8 +1698,8 @@ void MEDCouplingBasicsTest::test3D2DMeshesIntersection(MEDCouplingUMesh *sourceM LOG(1, "surf = " << surf <<" correctSurf = " << correctSurf ); CPPUNIT_ASSERT_DOUBLES_EQUAL(correctSurf, surf, prec * std::max(correctSurf, surf)); - INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces = myInterpolator.retrieveDuplicateFaces(); - int const duplicateFacesNbr = (int)duplicateFaces.size(); + INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces(); + int duplicateFacesNbr = (int)duplicateFaces.size(); LOG(1, "duplicateFacesNbr = " << duplicateFacesNbr <<" correctDuplicateFacesNbr = " << correctDuplicateFacesNbr); CPPUNIT_ASSERT_EQUAL(correctDuplicateFacesNbr, duplicateFacesNbr); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 14b4eea82..573412698 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -19,28 +19,15 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingBasicsTest1.hxx" -#include "MEDCouplingMemArray.txx" -#include "MEDCouplingRefCountObject.hxx" -#include "InterpKernelException.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingPointSet.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingMesh.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" -#include -#include "NormalizedGeometricTypes" -#include -#include -#include +#include "MEDCouplingMemArray.txx" +#include #include #include #include -#include using namespace MEDCoupling; @@ -183,7 +170,7 @@ void MEDCouplingBasicsTest1::testMesh() mesh->checkConsistencyLight(); //test 1 - no copy ownership C++ myCoords=DataArrayDouble::New(); - auto *tmp=new double[3*nbOfNodes]; + double *tmp=new double[3*nbOfNodes]; std::copy(coords,coords+3*nbOfNodes,tmp); myCoords->useArray(tmp,true,DeallocType::CPP_DEALLOC,nbOfNodes,3); mesh->setCoords(myCoords); @@ -598,7 +585,7 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelf() const mcIdType tab2[3]={0,2,3}; // MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelf(tab1,tab1+2,true); - auto *subMesh=dynamic_cast(subMeshSimple); + MEDCouplingUMesh *subMesh=dynamic_cast(subMeshSimple); CPPUNIT_ASSERT(subMesh); std::string name(subMesh->getName()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); @@ -648,7 +635,7 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelfNode() MEDCouplingUMesh *mesh=build2DTargetMesh_1(); const mcIdType tab1[4]={5,7,8,4}; MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelfNode(tab1,tab1+4,true); - auto *subMesh=dynamic_cast(subMeshSimple); + MEDCouplingUMesh *subMesh=dynamic_cast(subMeshSimple); CPPUNIT_ASSERT(subMesh); CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllGeoTypes().size()); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin()); @@ -717,7 +704,7 @@ void MEDCouplingBasicsTest1::testZipCoords() // const mcIdType tab1[2]={0,4}; MEDCouplingPointSet *subMeshPtSet=mesh->buildPartOfMySelf(tab1,tab1+2,true); - auto *subMesh=dynamic_cast(subMeshPtSet); + MEDCouplingUMesh *subMesh=dynamic_cast(subMeshPtSet); CPPUNIT_ASSERT(subMesh); DataArrayIdType *traducer=subMesh->zipCoordsTraducer(); const mcIdType expectedTraducer[9]={0,1,-1,2,3,4,-1,5,6}; @@ -755,7 +742,7 @@ void MEDCouplingBasicsTest1::testZipConnectivity() MEDCouplingUMesh *m2=build2DTargetMesh_1(); mcIdType cells1[3]={2,3,4}; MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true); - auto *m3=dynamic_cast(m3_1); + MEDCouplingUMesh *m3=dynamic_cast(m3_1); CPPUNIT_ASSERT(m3); m2->decrRef(); MEDCouplingUMesh *m4=build2DSourceMesh_1(); @@ -800,7 +787,7 @@ void MEDCouplingBasicsTest1::testEqualMesh() CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(mesh2->isEqual(mesh1,1e-12)); double *pt=mesh2->getCoords()->getPointer(); - double const tmp=pt[1]; + double tmp=pt[1]; pt[1]=5.999; CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(!mesh2->isEqual(mesh1,1e-12)); @@ -964,7 +951,7 @@ void MEDCouplingBasicsTest1::testBuildSubMeshData() CPPUNIT_ASSERT_EQUAL(1,(int)di->getNumberOfComponents()); const mcIdType *toCheck=di->getConstPointer(); CPPUNIT_ASSERT(std::equal(elts,elts+3,toCheck)); - auto *ret1DC=dynamic_cast(ret1); + MEDCouplingUMesh *ret1DC=dynamic_cast(ret1); CPPUNIT_ASSERT(ret1DC); ret1->decrRef(); di->decrRef(); @@ -973,7 +960,7 @@ void MEDCouplingBasicsTest1::testBuildSubMeshData() MEDCouplingFieldDouble *fieldNodes=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME); fieldNodes->setMesh(targetMesh); MEDCouplingMesh *ret2=fieldNodes->buildSubMeshData(elts,elts+3,di); - auto *ret2DC=dynamic_cast(ret2); + MEDCouplingUMesh *ret2DC=dynamic_cast(ret2); CPPUNIT_ASSERT(ret2DC); CPPUNIT_ASSERT_EQUAL(3,(int)ret2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(6,(int)ret2->getNumberOfNodes()); @@ -990,7 +977,7 @@ void MEDCouplingBasicsTest1::testBuildSubMeshData() void MEDCouplingBasicsTest1::testExtrudedMesh1() { - MEDCouplingUMesh *mesh2D=nullptr; + MEDCouplingUMesh *mesh2D=0; MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); MEDCouplingMappedExtrudedMesh *ext=MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,1); CPPUNIT_ASSERT_EQUAL(18,(int)ext->getNumberOfCells()); @@ -1033,7 +1020,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh2() double v[3]={0.,0.,2.}; mTT->findNodesOnPlane(pt,v,1e-12,n); CPPUNIT_ASSERT_EQUAL(43,(int)n.size()); - auto *mTT3dSurf=(MEDCouplingUMesh *)mTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); + MEDCouplingUMesh *mTT3dSurf=(MEDCouplingUMesh *)mTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); MEDCouplingMappedExtrudedMesh *meTT=MEDCouplingMappedExtrudedMesh::New(mTT,mTT3dSurf,0); CPPUNIT_ASSERT_EQUAL(200,(int)meTT->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(10,(int)meTT->getMesh2D()->getNumberOfCells()); @@ -1047,7 +1034,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh2() n.clear(); mN->findNodesOnPlane(pt,v,1e-12,n); CPPUNIT_ASSERT_EQUAL(30,(int)n.size()); - auto *mN3dSurf=(MEDCouplingUMesh *)mN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); + MEDCouplingUMesh *mN3dSurf=(MEDCouplingUMesh *)mN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); MEDCouplingMappedExtrudedMesh *meN=MEDCouplingMappedExtrudedMesh::New(mN,mN3dSurf,0); CPPUNIT_ASSERT_EQUAL(40,(int)meN->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(20,(int)meN->getMesh2D()->getNumberOfCells()); @@ -1061,7 +1048,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh2() n.clear(); mTF->findNodesOnPlane(pt,v,1e-12,n); CPPUNIT_ASSERT_EQUAL(27,(int)n.size()); - auto *mTF3dSurf=(MEDCouplingUMesh *)mTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); + MEDCouplingUMesh *mTF3dSurf=(MEDCouplingUMesh *)mTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); MEDCouplingMappedExtrudedMesh *meTF=MEDCouplingMappedExtrudedMesh::New(mTF,mTF3dSurf,0); CPPUNIT_ASSERT_EQUAL(340,(int)meTF->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(17,(int)meTF->getMesh2D()->getNumberOfCells()); @@ -1321,7 +1308,7 @@ void MEDCouplingBasicsTest1::testMergeMesh1() const double vec[2]={1.,0.}; m2->translate(vec); MEDCouplingMesh *m3=m1->mergeMyselfWith(m2); - auto *m3C=dynamic_cast(m3); + MEDCouplingUMesh *m3C=dynamic_cast(m3); CPPUNIT_ASSERT(m3C); m3->checkConsistencyLight(); MEDCouplingUMesh *m4=build2DTargetMeshMerged_1(); @@ -1389,7 +1376,7 @@ void MEDCouplingBasicsTest1::testMergeField1() MEDCouplingUMesh *m4=build2DTargetMeshMerged_1(); m4->setName(f1->getMesh()->getName()); CPPUNIT_ASSERT(f3->getMesh()->isEqual(m4,1.e-12)); - std::string const name=f3->getName(); + std::string name=f3->getName(); CPPUNIT_ASSERT(name=="MeasureOfMesh_"); CPPUNIT_ASSERT(f3->getTypeOfField()==ON_CELLS); CPPUNIT_ASSERT(f3->getTimeDiscretization()==ONE_TIME); @@ -1399,7 +1386,7 @@ void MEDCouplingBasicsTest1::testMergeField1() const double *tmp=f3->getArray()->getConstPointer(); std::transform(tmp,tmp+7,values,values,std::minus()); std::transform(values,values+7,values,[](double c){return fabs(c);}); - double const max=*std::max_element(values,values+7); + double max=*std::max_element(values,values+7); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); m4->decrRef(); f3->decrRef(); @@ -1586,7 +1573,7 @@ void MEDCouplingBasicsTest1::testApplyFunc() const double *tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+9,values1,values1,std::minus()); std::transform(values1,values1+9,values1,[](double c){return fabs(c);}); - double const max=*std::max_element(values1,values1+9); + double max=*std::max_element(values1,values1+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); m->decrRef(); @@ -1832,7 +1819,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields3() void MEDCouplingBasicsTest1::testOperationsOnFields4() { MEDCouplingUMesh *m=build2DTargetMesh_1(); - std::size_t const nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,CONST_ON_TIME_INTERVAL); f1->setMesh(m); DataArrayDouble *array=DataArrayDouble::New(); @@ -2024,12 +2011,12 @@ void MEDCouplingBasicsTest1::testSplitByType() MEDCouplingUMesh *m1=build3DSurfTargetMesh_1(); std::vector v=m1->splitByType(); CPPUNIT_ASSERT_EQUAL(3,(int)v.size()); - std::vector const v2(v.begin(),v.end()); + std::vector v2(v.begin(),v.end()); MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(v2); m2->setName(m1->getName().c_str()); CPPUNIT_ASSERT(m1->isEqual(m2,1.e-12)); - for(auto iter : v) - iter->decrRef(); + for(std::vector::const_iterator iter=v.begin();iter!=v.end();iter++) + (*iter)->decrRef(); m2->decrRef(); m1->decrRef(); } @@ -2040,17 +2027,17 @@ void MEDCouplingBasicsTest1::testFuseUMeshesOnSameCoords() MEDCouplingUMesh *m2=build2DTargetMesh_1(); mcIdType cells1[3]={2,3,4}; MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true); - auto *m3=dynamic_cast(m3_1); + MEDCouplingUMesh *m3=dynamic_cast(m3_1); CPPUNIT_ASSERT(m3); meshes.push_back(m3); mcIdType cells2[3]={1,2,4}; MEDCouplingPointSet *m4_1=m2->buildPartOfMySelf(cells2,cells2+3,true); - auto *m4=dynamic_cast(m4_1); + MEDCouplingUMesh *m4=dynamic_cast(m4_1); CPPUNIT_ASSERT(m4); meshes.push_back(m4); mcIdType cells3[2]={1,2}; MEDCouplingPointSet *m5_1=m2->buildPartOfMySelf(cells3,cells3+2,true); - auto *m5=dynamic_cast(m5_1); + MEDCouplingUMesh *m5=dynamic_cast(m5_1); CPPUNIT_ASSERT(m5); meshes.push_back(m5); m2->decrRef(); @@ -2065,14 +2052,14 @@ void MEDCouplingBasicsTest1::testFuseUMeshesOnSameCoords() { DataArrayIdType *arr=corr[i]; CPPUNIT_ASSERT_EQUAL(1,(int)arr->getNumberOfComponents()); - mcIdType const nbOfVals=expectedVals1[i]; + mcIdType nbOfVals=expectedVals1[i]; CPPUNIT_ASSERT_EQUAL(nbOfVals,arr->getNumberOfTuples()); const mcIdType *vals=arr->getConstPointer(); for(mcIdType j=0;j > fidsOfGroups; - std::vector const corr2(corr.begin(),corr.end()); + std::vector corr2(corr.begin(),corr.end()); DataArrayIdType *arr2=DataArrayIdType::MakePartition(corr2,m7->getNumberOfCells(),fidsOfGroups); const mcIdType fidExp[4]={5,1,3,4}; const mcIdType fidsGrp[3][3]={{1,3,5},{3,4,5},{4,5,23344}}; @@ -2082,12 +2069,12 @@ void MEDCouplingBasicsTest1::testFuseUMeshesOnSameCoords() CPPUNIT_ASSERT(std::equal(fidExp,fidExp+4,arr2->getConstPointer())); for(int i=0;i<3;i++) { - mcIdType const nbOfVals=expectedVals1[i]; + mcIdType nbOfVals=expectedVals1[i]; CPPUNIT_ASSERT_EQUAL(nbOfVals,ToIdType(fidsOfGroups[i].size())); CPPUNIT_ASSERT(std::equal(fidsOfGroups[i].begin(),fidsOfGroups[i].end(),fidsGrp[i])); } - for(auto & iter : corr) - iter->decrRef(); + for(std::vector::iterator iter=corr.begin();iter!=corr.end();iter++) + (*iter)->decrRef(); arr2->decrRef(); m7->decrRef(); // @@ -2102,9 +2089,9 @@ void MEDCouplingBasicsTest1::testFuseUMeshesOnSameCoords2() MEDCouplingUMesh *m1=build3DExtrudedUMesh_1(m2); m2->decrRef(); const mcIdType part1[5]={2,3,6,4,10}; - auto *m3=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part1,part1+5,true); + MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part1,part1+5,true); const mcIdType part2[4]={5,6,4,7}; - auto *m4=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part2,part2+4,true); + MEDCouplingUMesh *m4=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part2,part2+4,true); std::vector meshes; meshes.push_back(m1); meshes.push_back(m3); @@ -2113,7 +2100,7 @@ void MEDCouplingBasicsTest1::testFuseUMeshesOnSameCoords2() std::vector corr; MEDCouplingUMesh *m5=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(18,(int)m5->getNumberOfCells()); - auto it=corr.begin(); + std::vector::iterator it=corr.begin(); const mcIdType exp1[4]={18,5,5,4}; const mcIdType exp2[4][18]={ {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}, @@ -2124,7 +2111,7 @@ void MEDCouplingBasicsTest1::testFuseUMeshesOnSameCoords2() int i=0; for(;it!=corr.end();it++,i++) { - mcIdType const sz=(*it)->getNumberOfTuples(); + mcIdType sz=(*it)->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(exp1[i],sz); CPPUNIT_ASSERT(std::equal(exp2[i],exp2[i]+sz,(*it)->getConstPointer())); } @@ -2140,7 +2127,7 @@ void MEDCouplingBasicsTest1::testBuildOrthogonalField() { MEDCouplingUMesh *targetMesh=build3DSurfTargetMesh_1(); MEDCouplingFieldDouble *field=targetMesh->buildOrthogonalField(); - double const expected[3]={0.70710678118654746,0.,-0.70710678118654746}; + double expected[3]={0.70710678118654746,0.,-0.70710678118654746}; CPPUNIT_ASSERT_EQUAL(5,(int)field->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)field->getNumberOfComponents()); const double *vals=field->getArray()->getConstPointer(); @@ -2188,7 +2175,7 @@ void MEDCouplingBasicsTest1::testGetCellsContainingPoint() //2D with no help of bounding box. double center[2]={0.2,0.2}; DataArrayDouble::Rotate2DAlg(center,0.78539816339744830962,6,pos,pos); - targetMesh->rotate(center,nullptr,0.78539816339744830962); + targetMesh->rotate(center,0,0.78539816339744830962); targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2); CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(7,(int)t2->getNbOfElems()); @@ -2248,7 +2235,7 @@ void MEDCouplingBasicsTest1::testGetValueOn1() { MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); MEDCouplingFieldDouble *fieldOnCells=MEDCouplingFieldDouble::New(ON_CELLS); - std::size_t const nbOfCells=targetMesh->getNumberOfCells(); + std::size_t nbOfCells=targetMesh->getNumberOfCells(); fieldOnCells->setMesh(targetMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(nbOfCells,2); @@ -2269,7 +2256,7 @@ void MEDCouplingBasicsTest1::testGetValueOn1() // targetMesh=build2DSourceMesh_1(); MEDCouplingFieldDouble *fieldOnNodes=MEDCouplingFieldDouble::New(ON_NODES); - mcIdType const nbOfNodes=targetMesh->getNumberOfNodes(); + mcIdType nbOfNodes=targetMesh->getNumberOfNodes(); fieldOnNodes->setMesh(targetMesh); array=DataArrayDouble::New(); array->alloc(nbOfNodes,2); @@ -2342,7 +2329,7 @@ void MEDCouplingBasicsTest1::testCMesh0() MEDCouplingMesh* meshDeepCopy=mesh->deepCopy(); MEDCouplingCMesh* meshClone=mesh->clone(false); - CPPUNIT_ASSERT_THROW(meshEmpty->copyTinyStringsFrom(nullptr),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(meshEmpty->copyTinyStringsFrom(0),INTERP_KERNEL::Exception); meshEmpty->copyTinyStringsFrom(mesh); //no data in meshEmpty, expected false CPPUNIT_ASSERT(!meshEmpty->isEqual(mesh,1e-12)); @@ -2509,7 +2496,7 @@ void MEDCouplingBasicsTest1::testCMesh2() ids->decrRef(); check->decrRef(); mcIdType cells1[4]={0,1,25,26}; - auto *partMesh1= + MEDCouplingUMesh *partMesh1= dynamic_cast(mesh1->buildPart(cells1,cells1+4)); CPPUNIT_ASSERT(partMesh1); CPPUNIT_ASSERT_EQUAL(4,(int)partMesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); @@ -2518,7 +2505,7 @@ void MEDCouplingBasicsTest1::testCMesh2() mcIdType cells2[2]={25,26}; DataArrayIdType* arr1; - auto *partMesh2= + MEDCouplingCMesh *partMesh2= dynamic_cast(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1)); CPPUNIT_ASSERT(partMesh2); CPPUNIT_ASSERT_EQUAL(2,(int)partMesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); @@ -2526,7 +2513,7 @@ void MEDCouplingBasicsTest1::testCMesh2() mcIdType cells3[2]={2,3}; DataArrayIdType* arr2; - auto *partMesh3= + MEDCouplingUMesh *partMesh3= dynamic_cast(partMesh1->buildPartAndReduceNodes(cells3,cells3+2,arr2)); CPPUNIT_ASSERT(partMesh3); CPPUNIT_ASSERT_EQUAL(2,(int)partMesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); @@ -2639,7 +2626,7 @@ void MEDCouplingBasicsTest1::testFindNodeOnPlane() double v[3]={0.,0.,2.}; mesh->findNodesOnPlane(pt,v,1e-12,n); CPPUNIT_ASSERT_EQUAL(9,(int)n.size()); - auto *m3dSurf=(MEDCouplingUMesh *)mesh->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); + MEDCouplingUMesh *m3dSurf=(MEDCouplingUMesh *)mesh->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); MEDCouplingMappedExtrudedMesh *me=MEDCouplingMappedExtrudedMesh::New(mesh,m3dSurf,0); const DataArrayIdType *da=me->getMesh3DIds(); CPPUNIT_ASSERT_EQUAL(8,(int)me->getNumberOfCells()); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.hxx index 2b6eb43e1..f03c67233 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.hxx @@ -23,7 +23,8 @@ #include "MEDCouplingBasicsTest.hxx" -#include +#include +#include namespace MEDCoupling { diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index e1fbca629..f9c73195f 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -19,25 +19,17 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingBasicsTest2.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "InterpKernelException.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MEDCouplingUMesh.hxx" +#include "MEDCouplingCMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingGaussLocalization.hxx" -#include "NormalizedGeometricTypes" #include #include -#include -#include #include -#include -#include -#include +#include using namespace MEDCoupling; @@ -51,7 +43,7 @@ void MEDCouplingBasicsTest2::testGaussPointField1() const double gsCoo1[12]={ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b, 2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 }; const double wg1[6]={ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 }; - std::vector const _refCoo1(refCoo1,refCoo1+6); + std::vector _refCoo1(refCoo1,refCoo1+6); std::vector _gsCoo1(gsCoo1,gsCoo1+12); std::vector _wg1(wg1,wg1+6); // @@ -66,7 +58,7 @@ void MEDCouplingBasicsTest2::testGaussPointField1() CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo1,_gsCoo1,_wg1),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getNbOfGaussLocalization()); const double refCoo2[8]={ 0.,0., 1.,0., 1.,1., 0.,1. }; - std::vector const _refCoo2(refCoo2,refCoo2+8); + std::vector _refCoo2(refCoo2,refCoo2+8); _gsCoo1.resize(4); _wg1.resize(2); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo2,_gsCoo1,_wg1); CPPUNIT_ASSERT_EQUAL(ToIdType(2),f->getNbOfGaussLocalization()); @@ -118,7 +110,7 @@ void MEDCouplingBasicsTest2::testGaussPointField1() MEDCouplingFieldDouble *f2=f->clone(true); CPPUNIT_ASSERT(f->isEqual(f2,1e-14,1e-14)); MEDCouplingGaussLocalization& gl1=f2->getGaussLocalization(0); - double const tmp=gl1.getGaussCoord(1,1); + double tmp=gl1.getGaussCoord(1,1); CPPUNIT_ASSERT_DOUBLES_EQUAL(2.07*_b-1,tmp,1e-14); gl1.setGaussCoord(1,1,0.07); CPPUNIT_ASSERT(!f->isEqual(f2,1e-14,1e-14)); @@ -176,7 +168,7 @@ void MEDCouplingBasicsTest2::testCellOrientation1() vec[2]=-1.; // connectivity inversion mcIdType *conn=m->getNodalConnectivity()->getPointer(); - mcIdType const tmp=conn[11]; + mcIdType tmp=conn[11]; conn[11]=conn[12]; conn[12]=tmp; m->are2DCellsNotCorrectlyOriented(vec,false,res1); @@ -196,7 +188,7 @@ void MEDCouplingBasicsTest2::testCellOrientation1() void MEDCouplingBasicsTest2::testCellOrientation2() { - MEDCouplingUMesh *m1=nullptr; + MEDCouplingUMesh *m1=0; MEDCouplingUMesh *m2=build3DExtrudedUMesh_1(m1); m1->decrRef(); std::vector res1; @@ -383,7 +375,7 @@ void MEDCouplingBasicsTest2::testNormL12Integ1D() DataArrayDouble *f3=m1->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(4,(int)f3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)f3->getNumberOfComponents()); - double const expected9[4]={0.75,5.105,0.8,5.155}; + double expected9[4]={0.75,5.105,0.8,5.155}; ptr=f3->getConstPointer(); for(int i=0;i<4;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected9[i],ptr[i],1e-12); @@ -392,12 +384,12 @@ void MEDCouplingBasicsTest2::testNormL12Integ1D() MEDCouplingFieldDouble *f2=m1->getMeasureField(false); CPPUNIT_ASSERT_EQUAL(4,(int)f2->getArray()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents()); - double const expected1[4]={0.5,0.21,-0.6,-0.31}; + double expected1[4]={0.5,0.21,-0.6,-0.31}; ptr=f2->getArray()->getConstPointer(); for(int i=0;i<4;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],ptr[i],1e-12); f2->decrRef(); - double const expected2[4]={0.5,0.21,0.6,0.31}; + double expected2[4]={0.5,0.21,0.6,0.31}; f2=m1->getMeasureField(true); ptr=f2->getArray()->getConstPointer(); for(int i=0;i<4;i++) @@ -406,19 +398,19 @@ void MEDCouplingBasicsTest2::testNormL12Integ1D() //integral double res[3]; f1->integral(false,res); - double const expected3[3]={0.9866,-0.3615,0.4217}; + double expected3[3]={0.9866,-0.3615,0.4217}; for(int i=0;i<3;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],res[i],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[0],f1->integral(0,false),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[1],f1->integral(1,false),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[2],f1->integral(2,false),1e-12); f1->integral(true,res); - double const expected4[3]={-3.4152,8.7639,-14.6879}; + double expected4[3]={-3.4152,8.7639,-14.6879}; for(int i=0;i<3;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected4[i],res[i],1e-12); //normL1 f1->normL1(res); - double const expected5[3]={6.979506172839505, 16.89018518518518, 27.02969135802469}; + double expected5[3]={6.979506172839505, 16.89018518518518, 27.02969135802469}; for(int i=0;i<3;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[i],res[i],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[0],f1->normL1(0),1e-12); @@ -426,7 +418,7 @@ void MEDCouplingBasicsTest2::testNormL12Integ1D() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[2],f1->normL1(2),1e-12); //normL2 f1->normL2(res); - double const expected7[3]={7.090910979452395, 16.9275542960123, 27.053271464160858}; + double expected7[3]={7.090910979452395, 16.9275542960123, 27.053271464160858}; for(int i=0;i<3;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected7[i],res[i],1e-9); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected7[0],f1->normL2(0),1e-9); @@ -462,7 +454,7 @@ void MEDCouplingBasicsTest2::testNormL12Integ1D() f3=m1->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(4,(int)f3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)f3->getNumberOfComponents()); - double const expected10[8]={0.75,0.75,5.105,5.105,0.8,0.8,5.155,5.155}; + double expected10[8]={0.75,0.75,5.105,5.105,0.8,0.8,5.155,5.155}; ptr=f3->getConstPointer(); for(int i=0;i<8;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected10[i],ptr[i],1e-12); @@ -498,7 +490,7 @@ void MEDCouplingBasicsTest2::testAreaBary2D() MEDCouplingFieldDouble *f1=m1->getMeasureField(false); CPPUNIT_ASSERT_EQUAL(10,(int)f1->getArray()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents()); - double const expected1[10]={-0.5,-1,-1.5,-0.5,-1, 0.5,1,1.5,0.5,1}; + double expected1[10]={-0.5,-1,-1.5,-0.5,-1, 0.5,1,1.5,0.5,1}; const double *ptr=f1->getArray()->getConstPointer(); for(int i=0;i<10;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],ptr[i],1e-12); @@ -511,7 +503,7 @@ void MEDCouplingBasicsTest2::testAreaBary2D() DataArrayDouble *f2=m1->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(10,(int)f2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents()); - double const expected2[20]={ + double expected2[20]={ 0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5, 0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5, }; @@ -531,7 +523,7 @@ void MEDCouplingBasicsTest2::testAreaBary2D() CPPUNIT_ASSERT_EQUAL(10,(int)f2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)f2->getNumberOfComponents()); ptr=f2->getConstPointer(); - double const expected3[30]={ + double expected3[30]={ 0.5,0.3333333333333333,0.,0.5,0.5,0.,0.5,0.77777777777777777,0.,0.5,0.3333333333333333,0.,0.5,0.5,0., 0.5,0.3333333333333333,0.,0.5,0.5,0.,0.5,0.77777777777777777,0.,0.5,0.3333333333333333,0.,0.5,0.5,0. }; @@ -601,7 +593,7 @@ void MEDCouplingBasicsTest2::testAreaBary3D() , 55 , 5 , 12 , 65 , -1 , 66 , 67 , 65 , 55 , 56 , 57 , -1 , 63 , 66 , 57 , 59 , 64 , -1 , 64 , 62 , 58 , 59 , -1 , 60 , 63 , 66 , 67 , 68 , 61 , -1 , 61 , 68 , 20 , 21 , -1 , 67 , 68 , 20 , 12 , 65}; - double const barys[]={ -0.0165220465527 , -0.0190922868195 , 0.158882733414 , + double barys[]={ -0.0165220465527 , -0.0190922868195 , 0.158882733414 , 0.0287618656076 , 0.135874379934 , -0.14601588119 , -0.147128055553 , 0.0465995097041 , -0.049391174453 , -0.00142506732317 , -0.0996953090351 , -0.115159183132 }; @@ -682,12 +674,12 @@ void MEDCouplingBasicsTest2::testRenumberCellsForFields() const double gsCoo1[12]={ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b, 2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 }; const double wg1[6]={ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 }; - std::vector const _refCoo1(refCoo1,refCoo1+6); + std::vector _refCoo1(refCoo1,refCoo1+6); std::vector _gsCoo1(gsCoo1,gsCoo1+12); std::vector _wg1(wg1,wg1+6); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1); const double refCoo2[8]={ 0.,0., 1.,0., 1.,1., 0.,1. }; - std::vector const _refCoo2(refCoo2,refCoo2+8); + std::vector _refCoo2(refCoo2,refCoo2+8); _gsCoo1.resize(4); _wg1.resize(2); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo2,_gsCoo1,_wg1); arr=DataArrayDouble::New(); @@ -701,7 +693,7 @@ void MEDCouplingBasicsTest2::testRenumberCellsForFields() CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12)); f->renumberCells(renumber1,false); CPPUNIT_ASSERT(!f->isEqual(fCpy,1e-12,1e-12)); - double const expected2[36]={21.,1021.,22.,1022.,23.,1023.,24.,1024.,25.,1025.,26.,1026., 11.,1011.,12.,1012.,13.,1013.,14.,1014.,15.,1015.,16.,1016., 41.,1041.,42.,1042., 1.,1001.,2.,1002., 31.,1031.,32.,1032.}; + double expected2[36]={21.,1021.,22.,1022.,23.,1023.,24.,1024.,25.,1025.,26.,1026., 11.,1011.,12.,1012.,13.,1013.,14.,1014.,15.,1015.,16.,1016., 41.,1041.,42.,1042., 1.,1001.,2.,1002., 31.,1031.,32.,1032.}; ptr=f->getArray()->getConstPointer(); for(int i=0;i<36;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],ptr[i],1e-12); @@ -724,7 +716,7 @@ void MEDCouplingBasicsTest2::testRenumberCellsForFields() CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12)); f->renumberCells(renumber1,false); CPPUNIT_ASSERT(!f->isEqual(fCpy,1e-12,1e-12)); - double const expected3[36]={21.,1021.,22.,1022.,23.,1023.,11.,1011.,12.,1012.,13.,1013.,41.,1041.,42.,1042.,43.,1043.,44.,1044.,1.,1001.,2.,1002.,3.,1003.,4.,1004.,31.,1031.,32.,1032.,33.,1033.,34.,1034.}; + double expected3[36]={21.,1021.,22.,1022.,23.,1023.,11.,1011.,12.,1012.,13.,1013.,41.,1041.,42.,1042.,43.,1043.,44.,1044.,1.,1001.,2.,1002.,3.,1003.,4.,1004.,31.,1031.,32.,1032.,33.,1033.,34.,1034.}; ptr=f->getArray()->getConstPointer(); for(int i=0;i<36;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],ptr[i],1e-12); @@ -743,7 +735,7 @@ void MEDCouplingBasicsTest2::testRenumberNodesForFields() f->setMesh(m); CPPUNIT_ASSERT_EQUAL(ToIdType(9),f->getNumberOfMeshPlacesExpected()); DataArrayDouble *arr=DataArrayDouble::New(); - mcIdType const nbOfNodes=m->getNumberOfNodes(); + mcIdType nbOfNodes=m->getNumberOfNodes(); arr->alloc(nbOfNodes,3); f->setArray(arr); arr->decrRef(); @@ -786,10 +778,10 @@ void MEDCouplingBasicsTest2::testConvertQuadraticCellsToLinear() { MEDCouplingUMesh *mesh=build2DTargetMesh_3(); mesh->checkConsistencyLight(); - std::set const types=mesh->getAllGeoTypes(); + std::set types=mesh->getAllGeoTypes(); CPPUNIT_ASSERT_EQUAL(5,(int)types.size()); INTERP_KERNEL::NormalizedCellType expected1[5]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_TRI6, INTERP_KERNEL::NORM_QUAD8}; - std::set const expected1Bis(expected1,expected1+5); + std::set expected1Bis(expected1,expected1+5); CPPUNIT_ASSERT(expected1Bis==types); CPPUNIT_ASSERT(mesh->isPresenceOfQuadratic()); CPPUNIT_ASSERT_EQUAL(ToIdType(62),mesh->getNodalConnectivityArrayLen()); @@ -802,10 +794,10 @@ void MEDCouplingBasicsTest2::testConvertQuadraticCellsToLinear() MEDCouplingFieldDouble *f2=mesh->getMeasureField(false); CPPUNIT_ASSERT(f1->getArray()->isEqual(*f2->getArray(),1e-12)); CPPUNIT_ASSERT_EQUAL(ToIdType(48),mesh->getNodalConnectivityArrayLen()); - std::set const types2=mesh->getAllGeoTypes(); + std::set types2=mesh->getAllGeoTypes(); CPPUNIT_ASSERT_EQUAL(3,(int)types2.size()); INTERP_KERNEL::NormalizedCellType expected2[3]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4}; - std::set const expected2Bis(expected2,expected2+3); + std::set expected2Bis(expected2,expected2+3); CPPUNIT_ASSERT(expected2Bis==types2); // f1->decrRef(); @@ -820,42 +812,42 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() DataArrayIdType *cellCor,*nodeCor; //First test mesh1 mesh1->checkGeoEquivalWith(mesh1,0,1e-12,cellCor,nodeCor);//deepEqual - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); mesh1->checkGeoEquivalWith(mesh1,1,1e-12,cellCor,nodeCor);//fastEqual - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); mesh1->checkGeoEquivalWith(mesh1,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); //Second test mesh1 and mesh2 are 2 different meshes instance mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor);//deepEqual - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); //Third test : cell permutation by keeping the first the middle and the last as it is. const mcIdType renum[]={0,2,1,3,4,5,6,8,7,9}; mesh2->renumberCells(renum,false); CPPUNIT_ASSERT_THROW(mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor),INTERP_KERNEL::Exception);//deepEqual fails - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual do not see anything - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations CPPUNIT_ASSERT(cellCor); CPPUNIT_ASSERT_EQUAL(10,(int)cellCor->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)cellCor->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(renum,renum+10,cellCor->getConstPointer())); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(nodeCor==0); cellCor->decrRef(); - cellCor=nullptr; - CPPUNIT_ASSERT(nodeCor==nullptr); + cellCor=0; + CPPUNIT_ASSERT(nodeCor==0); //4th test : cell and node permutation by keeping the first the middle and the last as it is. mesh2->decrRef(); mesh2=build2DTargetMesh_3(); @@ -863,11 +855,11 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() mesh2->renumberCells(renum,false); mesh2->renumberNodes(renum2,11); CPPUNIT_ASSERT_THROW(mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor),INTERP_KERNEL::Exception);//deepEqual fails - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual do not see anything - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations CPPUNIT_ASSERT(cellCor); CPPUNIT_ASSERT_EQUAL(10,(int)cellCor->getNumberOfTuples()); @@ -878,9 +870,9 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() CPPUNIT_ASSERT_EQUAL(1,(int)nodeCor->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(renum2,renum2+11,nodeCor->getConstPointer())); cellCor->decrRef(); - cellCor=nullptr; + cellCor=0; nodeCor->decrRef(); - nodeCor=nullptr; + nodeCor=0; //5th test : modification of the last cell to check fastCheck detection. mesh2->decrRef(); mesh2=build2DTargetMesh_3(); @@ -892,14 +884,14 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() } catch(INTERP_KERNEL::Exception&) { isExcep=true; } CPPUNIT_ASSERT(isExcep); isExcep=false; - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); try { mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual has detected something } catch(INTERP_KERNEL::Exception&) { isExcep=true; } CPPUNIT_ASSERT(isExcep); isExcep=false; - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); mesh2->checkGeoEquivalWith(mesh1,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations CPPUNIT_ASSERT(cellCor); CPPUNIT_ASSERT_EQUAL(10,(int)cellCor->getNumberOfTuples()); @@ -910,9 +902,9 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() CPPUNIT_ASSERT_EQUAL(1,(int)nodeCor->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(renum2,renum2+11,nodeCor->getConstPointer())); cellCor->decrRef(); - cellCor=nullptr; + cellCor=0; nodeCor->decrRef(); - nodeCor=nullptr; + nodeCor=0; // mesh1->decrRef(); mesh2->decrRef(); @@ -924,8 +916,8 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith2() MEDCouplingUMesh *mesh2=build2DTargetMesh_1(); DataArrayIdType *cellCor,*nodeCor; mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor); - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor!=nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor!=0); const mcIdType expected1[9]={0, 1, 3, 4, 5, 6, 7, 8, 9}; for(int i=0;i<9;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],nodeCor->getIJ(i,0)); @@ -938,7 +930,7 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith2() void MEDCouplingBasicsTest2::testCopyTinyStringsFromOnFields() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - std::size_t const nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME); f->setMesh(m); CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected()); @@ -1114,7 +1106,7 @@ void MEDCouplingBasicsTest2::testChangeUnderlyingMesh1() void MEDCouplingBasicsTest2::testGetMaxValue1() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - std::size_t const nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME); f->setMesh(m); DataArrayDouble *a1=DataArrayDouble::New(); @@ -1355,7 +1347,7 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() CPPUNIT_ASSERT_EQUAL(6,(int)f2->getMesh()->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); - auto *m2C=dynamic_cast(const_cast(f2->getMesh())); + MEDCouplingUMesh *m2C=dynamic_cast(const_cast(f2->getMesh())); CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen()); const double expected2[12]={0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7}; for(int i=0;i<12;i++) @@ -1855,7 +1847,7 @@ void MEDCouplingBasicsTest2::testMaxPerTuple1() CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,f2->getIJ(i,0),1e-13); f2->decrRef(); // - DataArrayIdType *d2I=nullptr; + DataArrayIdType *d2I=0; DataArrayDouble *d2=array->maxPerTupleWithCompoId(d2I); CPPUNIT_ASSERT_EQUAL(1,(int)d2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,(int)d2->getNumberOfTuples()); @@ -1974,14 +1966,14 @@ void MEDCouplingBasicsTest2::testIsEqualWithoutConsideringStr1() mesh2->getCoords()->setInfoOnComponent(1,""); CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12)); - double const tmp=mesh2->getCoords()->getIJ(0,3); + double tmp=mesh2->getCoords()->getIJ(0,3); mesh2->getCoords()->setIJ(0,3,9999.); CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(!mesh1->isEqualWithoutConsideringStr(mesh2,1e-12)); mesh2->getCoords()->setIJ(0,3,tmp); CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12)); - mcIdType const tmp2=mesh2->getNodalConnectivity()->getIJ(0,4); + mcIdType tmp2=mesh2->getNodalConnectivity()->getIJ(0,4); mesh2->getNodalConnectivity()->setIJ(0,4,0); CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(!mesh1->isEqualWithoutConsideringStr(mesh2,1e-12)); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.hxx index 71f554231..a945f2f42 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.hxx @@ -23,7 +23,8 @@ #include "MEDCouplingBasicsTest.hxx" -#include +#include +#include namespace MEDCoupling { diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx index 1bb5c4a9d..bf292054b 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx @@ -19,28 +19,17 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingBasicsTest3.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCType.hxx" -#include "MEDCouplingPointSet.hxx" -#include "MCIdType.hxx" -#include "MCAuto.hxx" -#include "InterpKernelException.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" +#include "MEDCouplingMemArray.hxx" #include "MEDCouplingMemArray.txx" #include "MEDCouplingGaussLocalization.hxx" -#include "NormalizedGeometricTypes" -#include #include -#include -#include -#include -#include -#include -#include +#include +#include using namespace MEDCoupling; @@ -189,7 +178,7 @@ void MEDCouplingBasicsTest3::testFieldDoubleZipConnectivity1() MEDCouplingUMesh *m2=build2DTargetMesh_1(); const mcIdType cells1[3]={2,3,4}; MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true); - auto *m3=dynamic_cast(m3_1); + MEDCouplingUMesh *m3=dynamic_cast(m3_1); CPPUNIT_ASSERT(m3); m2->decrRef(); MEDCouplingUMesh *m4=build2DSourceMesh_1(); @@ -501,7 +490,7 @@ void MEDCouplingBasicsTest3::testDaDoubleGetMinMaxValues1() void MEDCouplingBasicsTest3::testFieldDoubleGetMinMaxValues2() { - MEDCouplingUMesh *m1=nullptr; + MEDCouplingUMesh *m1=0; MEDCouplingUMesh *m2=build3DExtrudedUMesh_1(m1); m1->decrRef(); CPPUNIT_ASSERT_EQUAL(18,(int)m2->getNumberOfCells()); @@ -680,8 +669,8 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1() a1->setInfoOnComponent(2,"cccc"); a1->setInfoOnComponent(3,"dddd"); const mcIdType arr2[6]={1,2,1,2,0,0}; - std::vector const arr2V(arr2,arr2+6); - auto *a2=static_cast(a1->keepSelectedComponents(arr2V)); + std::vector arr2V(arr2,arr2+6); + DataArrayDouble *a2=static_cast(a1->keepSelectedComponents(arr2V)); CPPUNIT_ASSERT_EQUAL(6,(int)a2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,(int)a2->getNumberOfTuples()); CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(0))=="bbbb"); @@ -694,7 +683,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1() for(int i=0;i<30;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a2->getIJ(0,i),1e-14); MCAuto a3(a1->convertToIntArr()); - auto *a4=static_cast(a3->keepSelectedComponents(arr2V)); + DataArrayInt *a4=static_cast(a3->keepSelectedComponents(arr2V)); CPPUNIT_ASSERT_EQUAL(6,(int)a4->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,(int)a4->getNumberOfTuples()); CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb"); @@ -707,12 +696,12 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1() CPPUNIT_ASSERT_EQUAL((int)expected1[i],a4->getIJ(0,i)); // setSelectedComponents const mcIdType arr3[2]={3,2}; - std::vector const arr3V(arr3,arr3+2); - auto *a5=static_cast(a1->keepSelectedComponents(arr3V)); + std::vector arr3V(arr3,arr3+2); + DataArrayDouble *a5=static_cast(a1->keepSelectedComponents(arr3V)); a5->setInfoOnComponent(0,"eeee"); a5->setInfoOnComponent(1,"ffff"); const mcIdType arr4[2]={1,2}; - std::vector const arr4V(arr4,arr4+2); + std::vector arr4V(arr4,arr4+2); a2->setSelectedComponents(a5,arr4V); CPPUNIT_ASSERT_EQUAL(6,(int)a2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,(int)a2->getNumberOfTuples()); @@ -743,8 +732,8 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1() const mcIdType arr5[3]={2,3,6}; const mcIdType arr6[3]={2,7,5}; const mcIdType arr7[4]={2,1,4,6}; - std::vector const arr5V(arr5,arr5+3); - std::vector const arr6V(arr6,arr6+3); + std::vector arr5V(arr5,arr5+3); + std::vector arr6V(arr6,arr6+3); std::vector arr7V(arr7,arr7+4); CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr5V),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr6V),INTERP_KERNEL::Exception); @@ -777,7 +766,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent2() f1->checkConsistencyLight(); // const mcIdType arr2[6]={1,2,1,2,0,0}; - std::vector const arr2V(arr2,arr2+6); + std::vector arr2V(arr2,arr2+6); MEDCouplingFieldDouble *f2=f1->keepSelectedComponents(arr2V); CPPUNIT_ASSERT(f2->getMesh()==f1->getMesh()); CPPUNIT_ASSERT(f2->getTimeDiscretization()==ONE_TIME); @@ -799,14 +788,14 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent2() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f2->getIJ(0,i),1e-14); //setSelectedComponents const mcIdType arr3[2]={3,2}; - std::vector const arr3V(arr3,arr3+2); + std::vector arr3V(arr3,arr3+2); MEDCouplingFieldDouble *f5=f1->keepSelectedComponents(arr3V); f5->setTime(6.7,8,9); f5->getArray()->setInfoOnComponent(0,"eeee"); f5->getArray()->setInfoOnComponent(1,"ffff"); f5->checkConsistencyLight(); const mcIdType arr4[2]={1,2}; - std::vector const arr4V(arr4,arr4+2); + std::vector arr4V(arr4,arr4+2); f2->setSelectedComponents(f5,arr4V); CPPUNIT_ASSERT_EQUAL(6,(int)f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples()); @@ -945,7 +934,7 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() CPPUNIT_ASSERT(!((dbl->reprZip().find("Number of components : 1"))==std::string::npos)); std::ostringstream ret; - dbl->writeVTK(ret,2,"file.tmp",nullptr); + dbl->writeVTK(ret,2,"file.tmp",0); CPPUNIT_ASSERT(!((ret.str().find("getIJ(1,0)); CPPUNIT_ASSERT_EQUAL(ToIdType(11),c->getIJ(2,0)); c->decrRef(); - DataArrayIdType *cI=nullptr; + DataArrayIdType *cI=0; mesh->getNodeIdsNearPoints(pts,3,1e-7,c,cI); CPPUNIT_ASSERT_EQUAL(ToIdType(4),cI->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(ToIdType(4),c->getNumberOfTuples()); @@ -1466,7 +1455,7 @@ void MEDCouplingBasicsTest3::testExtrudedMesh6() f->changeSpaceDimension(2); // const double center[2]={0.,0.}; - f->rotate(center,nullptr,M_PI/3); + f->rotate(center,0,M_PI/3); MEDCouplingUMesh *g=c->buildExtrudedMesh(f,0); g->checkConsistencyLight(); const double expected1[]={ 0.4330127018922193, 0.4330127018922193, 0.649519052838329, 1.2990381056766578, 1.299038105676658, 1.948557158514987, 2.1650635094610955, 2.1650635094610964, 3.2475952641916446, 3.031088913245533, 3.0310889132455352, 4.546633369868303 }; @@ -1754,7 +1743,7 @@ void MEDCouplingBasicsTest3::testFieldMeld1() for(int i=0;i<15;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f3->getIJ(0,i),1e-12); int dt,it; - double const time=f3->getTime(dt,it); + double time=f3->getTime(dt,it); CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,time,1e-14); CPPUNIT_ASSERT_EQUAL(2,dt); CPPUNIT_ASSERT_EQUAL(1,it); @@ -1969,7 +1958,7 @@ void MEDCouplingBasicsTest3::testAreCellsIncludedIn1() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); const mcIdType pt[2]={1,3}; - auto *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(pt,pt+2,true); + MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(pt,pt+2,true); DataArrayIdType *tmp; CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp)); CPPUNIT_ASSERT_EQUAL(2,(int)tmp->getNumberOfTuples()); @@ -2245,7 +2234,7 @@ void MEDCouplingBasicsTest3::testAreCellsIncludedIn2() { const char myName[]="Vitoo"; MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - auto *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(nullptr,nullptr,true); + MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(0,0,true); CPPUNIT_ASSERT_EQUAL(0,(int)m2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,m2->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,m2->getMeshDimension()); @@ -2386,9 +2375,9 @@ void MEDCouplingBasicsTest3::testMergeUMeshes2() MEDCouplingUMesh *m3=build3DSurfTargetMesh_1(); // const mcIdType vec1[3]={0,2,3}; - auto *m2_2=(MEDCouplingUMesh *)m2->buildPartOfMySelf(vec1,vec1+3,false); + MEDCouplingUMesh *m2_2=(MEDCouplingUMesh *)m2->buildPartOfMySelf(vec1,vec1+3,false); const mcIdType vec2[2]={1,1}; - auto *m3_2=(MEDCouplingUMesh *)m3->buildPartOfMySelf(vec2,vec2+2,false); + MEDCouplingUMesh *m3_2=(MEDCouplingUMesh *)m3->buildPartOfMySelf(vec2,vec2+2,false); // std::vector ms(3); std::vector ms2(3); @@ -2406,22 +2395,22 @@ void MEDCouplingBasicsTest3::testMergeUMeshes2() m4bis->decrRef(); // const mcIdType vec3[5]={0,1,2,3,4}; - auto *m4_1=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec3,vec3+5,false); + MEDCouplingUMesh *m4_1=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec3,vec3+5,false); m4_1->setName(m1->getName().c_str()); CPPUNIT_ASSERT(m4_1->isEqual(m1,1e-12)); m4_1->decrRef(); // const mcIdType vec4[3]={5,6,7}; - auto *m4_2=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec4,vec4+3,false); - DataArrayIdType *cellCor=nullptr; - DataArrayIdType *nodeCor=nullptr; + MEDCouplingUMesh *m4_2=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec4,vec4+3,false); + DataArrayIdType *cellCor=0; + DataArrayIdType *nodeCor=0; m4_2->checkGeoEquivalWith(m2_2,10,1e-12,cellCor,nodeCor); - CPPUNIT_ASSERT(cellCor==nullptr); - CPPUNIT_ASSERT(nodeCor==nullptr); + CPPUNIT_ASSERT(cellCor==0); + CPPUNIT_ASSERT(nodeCor==0); m4_2->decrRef(); // const mcIdType vec5[2]={8,9}; - auto *m4_3=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec5,vec5+2,false); + MEDCouplingUMesh *m4_3=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec5,vec5+2,false); CPPUNIT_ASSERT_EQUAL(2,(int)m4_3->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,(int)m4_3->getNumberOfNodes()); m3_2->zipCoords(); @@ -2450,7 +2439,7 @@ void MEDCouplingBasicsTest3::testBuild0DMeshFromCoords1() CPPUNIT_ASSERT_EQUAL(4,(int)m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(0,m->getMeshDimension()); - std::set const types=m->getAllGeoTypes(); + std::set types=m->getAllGeoTypes(); CPPUNIT_ASSERT_EQUAL(1,(int)types.size()); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POINT1,*types.begin()); for(int i=0;i<4;i++) diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.hxx index 9aa8b612b..0c22cb9a5 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.hxx @@ -23,7 +23,8 @@ #include "MEDCouplingBasicsTest.hxx" -#include +#include +#include namespace MEDCoupling { diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index bf4894061..8f0297694 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -19,27 +19,18 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingBasicsTest4.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "InterpKernelException.hxx" -#include "MEDCouplingDefinitionTime.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" -#include "MCAuto.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDCouplingGaussLocalization.hxx" #include "MEDCouplingMultiFields.hxx" #include "MEDCouplingFieldOverTime.hxx" -#include "NormalizedGeometricTypes" -#include #include -#include -#include -#include -#include +#include +#include using namespace MEDCoupling; @@ -49,7 +40,7 @@ void MEDCouplingBasicsTest4::testDescriptionInMeshTimeUnit1() MEDCouplingUMesh *m=build2DTargetMesh_1(); m->setDescription(text1); CPPUNIT_ASSERT(std::string(m->getDescription())==text1); - auto *m2=(MEDCouplingUMesh *)m->deepCopy(); + MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCopy(); CPPUNIT_ASSERT(m->isEqual(m2,1e-12)); CPPUNIT_ASSERT(std::string(m2->getDescription())==text1); m2->setDescription("ggg"); @@ -70,12 +61,12 @@ void MEDCouplingBasicsTest4::testDescriptionInMeshTimeUnit1() void MEDCouplingBasicsTest4::testMultiFields1() { MEDCouplingMultiFields *mfs=buildMultiFields_1(); - std::vector const ms=mfs->getMeshes(); + std::vector ms=mfs->getMeshes(); std::vector refs; - std::vector const dms=mfs->getDifferentMeshes(refs); - std::vector const das=mfs->getArrays(); + std::vector dms=mfs->getDifferentMeshes(refs); + std::vector das=mfs->getArrays(); std::vector< std::vector > refs2; - std::vector const das2=mfs->getDifferentArrays(refs2); + std::vector das2=mfs->getDifferentArrays(refs2); // CPPUNIT_ASSERT_EQUAL(5,(int)ms.size()); CPPUNIT_ASSERT_EQUAL(2,(int)dms.size()); @@ -99,7 +90,7 @@ void MEDCouplingBasicsTest4::testFieldOverTime1() CPPUNIT_ASSERT_THROW(MEDCouplingFieldOverTime::New(fs),INTERP_KERNEL::Exception); f4bis->setTime(2.7,20,21); MEDCouplingFieldOverTime *fot=MEDCouplingFieldOverTime::New(fs); - MEDCouplingDefinitionTime const dt=fot->getDefinitionTimeZone(); + MEDCouplingDefinitionTime dt=fot->getDefinitionTimeZone(); std::vector hs=dt.getHotSpotsTime(); CPPUNIT_ASSERT_EQUAL(6,(int)hs.size()); const double expected1[]={0.2,0.7,1.2,1.35,1.7,2.7}; @@ -162,8 +153,8 @@ void MEDCouplingBasicsTest4::testFieldOverTime1() dt3.unserialize(tmp1,tmp2); CPPUNIT_ASSERT(dt2.isEqual(dt3)); // - for(auto & f : fs) - f->decrRef(); + for(std::vector::iterator it=fs.begin();it!=fs.end();it++) + (*it)->decrRef(); fot->decrRef(); } @@ -282,7 +273,7 @@ void MEDCouplingBasicsTest4::testMeshSetTime1() CPPUNIT_ASSERT(!m1->isEqual(m2,1e-12)); // m1->setTime(10.34,55,12); - auto *m3=(MEDCouplingUMesh *)m1->deepCopy(); + MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->deepCopy(); CPPUNIT_ASSERT(m1->isEqual(m3,1e-12)); tmp3=m3->getTime(tmp1,tmp2); CPPUNIT_ASSERT_EQUAL(55,tmp1); @@ -306,7 +297,7 @@ void MEDCouplingBasicsTest4::testMeshSetTime1() CPPUNIT_ASSERT_EQUAL(8,tmp1); CPPUNIT_ASSERT_EQUAL(100,tmp2); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.67,tmp3,1e-12); - auto *c=(MEDCouplingCMesh *)b->deepCopy(); + MEDCouplingCMesh *c=(MEDCouplingCMesh *)b->deepCopy(); CPPUNIT_ASSERT(c->isEqual(b,1e-12)); tmp3=c->getTime(tmp1,tmp2); CPPUNIT_ASSERT_EQUAL(8,tmp1); @@ -522,7 +513,7 @@ void MEDCouplingBasicsTest4::testGaussCoordinates1() std::vector gsCoo1(1); gsCoo1[0]=0.2; std::vector refCoo1(2); refCoo1[0]=-1.0; refCoo1[1]=1.0; f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_SEG2,refCoo1,gsCoo1,wg1); - std::vector const wg2(wg1); + std::vector wg2(wg1); std::vector gsCoo2(1); gsCoo2[0]=0.2; std::vector refCoo2(3); refCoo2[0]=-1.0; refCoo2[1]=1.0; refCoo2[2]=0.0; f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_SEG3,refCoo2,gsCoo2,wg2); @@ -543,27 +534,27 @@ void MEDCouplingBasicsTest4::testGaussCoordinates1() f->setMesh(m2); std::vector wg3(2); wg3[0]=0.3; wg3[1]=0.3; const double tria3CooGauss[4]={ 0.1, 0.8, 0.2, 0.7 }; - std::vector const gsCoo3(tria3CooGauss,tria3CooGauss+4); + std::vector gsCoo3(tria3CooGauss,tria3CooGauss+4); const double tria3CooRef[6]={ 0.0, 0.0, 1.0 , 0.0, 0.0, 1.0 }; - std::vector const refCoo3(tria3CooRef,tria3CooRef+6); + std::vector refCoo3(tria3CooRef,tria3CooRef+6); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,refCoo3,gsCoo3,wg3); std::vector wg4(3); wg4[0]=0.3; wg4[1]=0.3; wg4[2]=0.3; const double tria6CooGauss[6]={ 0.3, 0.2, 0.2, 0.1, 0.2, 0.4 }; - std::vector const gsCoo4(tria6CooGauss,tria6CooGauss+6); + std::vector gsCoo4(tria6CooGauss,tria6CooGauss+6); const double tria6CooRef[12]={0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.5, 0.0, 0.5, 0.5, 0.0, 0.5}; - std::vector const refCoo4(tria6CooRef,tria6CooRef+12); + std::vector refCoo4(tria6CooRef,tria6CooRef+12); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI6,refCoo4,gsCoo4,wg4); std::vector wg5(4); wg5[0]=0.3; wg5[1]=0.3; wg5[2]=0.3; wg5[3]=0.3; const double quad4CooGauss[8]={ 0.3, 0.2, 0.2, 0.1, 0.2, 0.4, 0.15, 0.27 }; - std::vector const gsCoo5(quad4CooGauss,quad4CooGauss+8); + std::vector gsCoo5(quad4CooGauss,quad4CooGauss+8); const double quad4CooRef[8]={-1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0}; - std::vector const refCoo5(quad4CooRef,quad4CooRef+8); + std::vector refCoo5(quad4CooRef,quad4CooRef+8); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,refCoo5,gsCoo5,wg5); std::vector wg6(4); wg6[0]=0.3; wg6[1]=0.3; wg6[2]=0.3; wg6[3]=0.3; const double quad8CooGauss[8]={ 0.34, 0.16, 0.21, 0.3, 0.23, 0.4, 0.14, 0.37 }; - std::vector const gsCoo6(quad8CooGauss,quad8CooGauss+8); + std::vector gsCoo6(quad8CooGauss,quad8CooGauss+8); const double quad8CooRef[16]={ -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, -1.0, 0.0}; - std::vector const refCoo6(quad8CooRef,quad8CooRef+16); + std::vector refCoo6(quad8CooRef,quad8CooRef+16); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD8,refCoo6,gsCoo6,wg6); // resToTest=f->getLocalizationOfDiscr(); @@ -586,51 +577,51 @@ void MEDCouplingBasicsTest4::testGaussCoordinates1() // std::vector wg7(1); wg7[0]=0.3; const double tetra4CooGauss[3]={0.34, 0.16, 0.21}; - std::vector const gsCoo7(tetra4CooGauss,tetra4CooGauss+3); + std::vector gsCoo7(tetra4CooGauss,tetra4CooGauss+3); const double tetra4CooRef[12]={0.0,1.0,0.0, 0.0,0.0,1.0, 0.0,0.0,0.0, 1.0,0.0,0.0}; - std::vector const refCoo7(tetra4CooRef,tetra4CooRef+12); + std::vector refCoo7(tetra4CooRef,tetra4CooRef+12); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TETRA4,refCoo7,gsCoo7,wg7); std::vector wg8(1); wg8[0]=0.3; const double tetra10CooGauss[3]={0.2, 0.3, 0.1}; - std::vector const gsCoo8(tetra10CooGauss,tetra10CooGauss+3); + std::vector gsCoo8(tetra10CooGauss,tetra10CooGauss+3); const double tetra10CooRef[30]={0.0,1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0, 1.0,0.0,0.0, 0.0,0.5,0.0, 0.0,0.0,0.5, 0.0,0.5,0.5, 0.5,0.5,0.0, 0.5,0.0,0.0, 0.5,0.0,0.5}; - std::vector const refCoo8(tetra10CooRef,tetra10CooRef+30); + std::vector refCoo8(tetra10CooRef,tetra10CooRef+30); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TETRA10,refCoo8,gsCoo8,wg8); std::vector wg9(1); wg9[0]=0.3; const double pyra5CooGauss[3]={0.2, 0.3, 0.1}; - std::vector const gsCoo9(pyra5CooGauss,pyra5CooGauss+3); + std::vector gsCoo9(pyra5CooGauss,pyra5CooGauss+3); const double pyra5CooRef[15]={1.0,0.0,0.0, 0.0,1.0,0.0, -1.0,0.0,0.0, 0.0,-1.0,0.0, 0.0,0.0,1.0}; - std::vector const refCoo9(pyra5CooRef,pyra5CooRef+15); + std::vector refCoo9(pyra5CooRef,pyra5CooRef+15); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PYRA5,refCoo9,gsCoo9,wg9); std::vector wg10(1); wg10[0]=0.3; const double pyra13CooGauss[3]={0.1, 0.2, 0.7}; - std::vector const gsCoo10(pyra13CooGauss,pyra13CooGauss+3); + std::vector gsCoo10(pyra13CooGauss,pyra13CooGauss+3); const double pyra13CooRef[39]={1.0,0.0,0.0, 0.0,1.0,0.0,-1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,1.0,0.5,0.5,0.0,-0.5,0.5,0.0,-0.5,-0.5,0.0,0.5,-0.5,0.0,0.5,0.0,0.5,0.0,0.5,0.5,-0.5,0.0,0.5,0.0,-0.5,0.5}; - std::vector const refCoo10(pyra13CooRef,pyra13CooRef+39); + std::vector refCoo10(pyra13CooRef,pyra13CooRef+39); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PYRA13,refCoo10,gsCoo10,wg10); std::vector wg11(1); wg11[0]=0.3; const double penta6CooGauss[3]={0.2, 0.3, 0.1}; - std::vector const gsCoo11(penta6CooGauss,penta6CooGauss+3); + std::vector gsCoo11(penta6CooGauss,penta6CooGauss+3); const double penta6CooRef[18]={-1.0,1.0,0.0,-1.0,-0.0,1.0,-1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0}; - std::vector const refCoo11(penta6CooRef,penta6CooRef+18); + std::vector refCoo11(penta6CooRef,penta6CooRef+18); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PENTA6,refCoo11,gsCoo11,wg11); std::vector wg12(1); wg12[0]=0.3; const double penta15CooGauss[3]={0.2, 0.3,0.15}; - std::vector const gsCoo12(penta15CooGauss,penta15CooGauss+3); + std::vector gsCoo12(penta15CooGauss,penta15CooGauss+3); const double penta15CooRef[45]={-1.0,1.0,0.0,-1.0,0.0,1.0,-1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,-1.0,0.5,0.5,-1.0,0.0,0.5,-1.0,0.5,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.5,0.5,1.0,0.0, 0.5,1.0,0.5,0.0}; - std::vector const refCoo12(penta15CooRef,penta15CooRef+45); + std::vector refCoo12(penta15CooRef,penta15CooRef+45); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PENTA15,refCoo12,gsCoo12,wg12); std::vector wg13(1); wg13[0]=0.3; const double hexa8CooGauss[3]={0.2,0.3,0.15}; - std::vector const gsCoo13(hexa8CooGauss,hexa8CooGauss+3); + std::vector gsCoo13(hexa8CooGauss,hexa8CooGauss+3); const double hexa8CooRef[24]={-1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0}; - std::vector const refCoo13(hexa8CooRef,hexa8CooRef+24); + std::vector refCoo13(hexa8CooRef,hexa8CooRef+24); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_HEXA8,refCoo13,gsCoo13,wg13); std::vector wg14(1); wg14[0]=0.3; const double hexa20CooGauss[3]={0.11,0.3,0.55}; - std::vector const gsCoo14(hexa20CooGauss,hexa20CooGauss+3); + std::vector gsCoo14(hexa20CooGauss,hexa20CooGauss+3); const double hexa20CooRef[60]={-1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0,0.0,-1.0,-1.0,1.0,0.0,-1.0,0.0,1.0,-1.0,-1.0,0.0,-1.0,-1.0,-1.0,0.0,1.0,-1.0,0.0,1.0,1.0,0.0,-1.0,1.0,0.0,0.0,-1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,-1.0,0.0,1.0}; - std::vector const refCoo14(hexa20CooRef,hexa20CooRef+60); + std::vector refCoo14(hexa20CooRef,hexa20CooRef+60); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_HEXA20,refCoo14,gsCoo14,wg14); // resToTest=f->getLocalizationOfDiscr(); @@ -743,7 +734,7 @@ void MEDCouplingBasicsTest4::testGetValueOn2() MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); f->setMesh(m); DataArrayDouble *arr=DataArrayDouble::New(); - std::size_t const nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); arr->alloc(nbOfCells,3); f->setArray(arr); arr->decrRef(); @@ -762,7 +753,7 @@ void MEDCouplingBasicsTest4::testGetValueOn2() f=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME); f->setMesh(m); arr=DataArrayDouble::New(); - mcIdType const nbOfNodes=m->getNumberOfNodes(); + mcIdType nbOfNodes=m->getNumberOfNodes(); arr->alloc(nbOfNodes,3); f->setArray(arr); arr->decrRef(); @@ -965,7 +956,7 @@ void MEDCouplingBasicsTest4::testUnPolyze2() m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn); m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn); m->finishInsertingCells(); - std::vector const ms(4,m); + std::vector ms(4,m); MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(ms); std::vector temp(1,2); m2->convertToPolyTypes(&temp[0],&temp[0]+temp.size()); @@ -1143,14 +1134,14 @@ void MEDCouplingBasicsTest4::testDAIOperations1() void MEDCouplingBasicsTest4::testEmulateMEDMEMBDC1() { - MEDCouplingUMesh *m1=nullptr; + MEDCouplingUMesh *m1=0; MEDCouplingUMesh *m=buildPointe_1(m1); DataArrayIdType *da1=DataArrayIdType::New(); DataArrayIdType *da2=DataArrayIdType::New(); - DataArrayIdType *da3=nullptr; - DataArrayIdType *da4=nullptr; - DataArrayIdType *da5=nullptr; - DataArrayIdType *da0=nullptr; + DataArrayIdType *da3=0; + DataArrayIdType *da4=0; + DataArrayIdType *da5=0; + DataArrayIdType *da0=0; MEDCouplingUMesh *m2=m->emulateMEDMEMBDC(m1,da1,da2,da3,da4,da5,da0); const mcIdType expected0[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46}; const mcIdType expected1[6]={1,32,29,23,41,36}; @@ -1198,7 +1189,7 @@ void MEDCouplingBasicsTest4::testEmulateMEDMEMBDC1() void MEDCouplingBasicsTest4::testGetLevArrPerCellTypes1() { - MEDCouplingUMesh *m1=nullptr; + MEDCouplingUMesh *m1=0; MEDCouplingUMesh *m=buildPointe_1(m1); m1->decrRef(); DataArrayIdType *d0=DataArrayIdType::New(); @@ -1208,7 +1199,7 @@ void MEDCouplingBasicsTest4::testGetLevArrPerCellTypes1() m1=m->buildDescendingConnectivity(d0,d1,d2,d3); d0->decrRef(); d1->decrRef(); d2->decrRef(); d3->decrRef(); INTERP_KERNEL::NormalizedCellType order[2]={INTERP_KERNEL::NORM_TRI3,INTERP_KERNEL::NORM_QUAD4}; - DataArrayIdType *da1=nullptr; + DataArrayIdType *da1=0; DataArrayIdType *da0=m1->getLevArrPerCellTypes(order,order+2,da1); const mcIdType expected0[47]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1}; const mcIdType expected1[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46}; @@ -1237,10 +1228,10 @@ void MEDCouplingBasicsTest4::testGetLevArrPerCellTypes1() void MEDCouplingBasicsTest4::testSortCellsInMEDFileFrmt1() { - MEDCouplingUMesh *m1=nullptr; + MEDCouplingUMesh *m1=0; MEDCouplingUMesh *m=buildPointe_1(m1); - auto *m2=(MEDCouplingUMesh *)m->deepCopy(); - m->setCoords(nullptr); + MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCopy(); + m->setCoords(0); const mcIdType vals[16]={0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13}; DataArrayIdType *da=DataArrayIdType::New(); da->alloc(16,1); @@ -1305,7 +1296,7 @@ void MEDCouplingBasicsTest4::testDAISplitByValueRange1() DataArrayIdType *d=DataArrayIdType::New(); d->alloc(9,1); std::copy(val1,val1+9,d->getPointer()); - DataArrayIdType *ee=nullptr,*f=nullptr,*g=nullptr; + DataArrayIdType *ee=0,*f=0,*g=0; d->splitByValueRange(val2,val2+3,ee,f,g); CPPUNIT_ASSERT_EQUAL(9,(int)ee->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)ee->getNumberOfComponents()); @@ -1785,7 +1776,7 @@ void MEDCouplingBasicsTest4::testDADFindCommonTuples1() da->alloc(6,1); const double array1[6]={2.3,1.2,1.3,2.3,2.301,0.8}; std::copy(array1,array1+6,da->getPointer()); - DataArrayIdType *c=nullptr,*cI=nullptr; + DataArrayIdType *c=0,*cI=0; // nbOftuples=1 da->findCommonTuples(1e-2,-1,c,cI); const mcIdType expected1[3]={0,3,4}; @@ -1970,7 +1961,7 @@ void MEDCouplingBasicsTest4::testGetNodeIdsInUse1() { MEDCouplingUMesh *m0=build2DTargetMesh_1(); const mcIdType CellIds[2]={1,2}; - auto *m1=static_cast(m0->buildPartOfMySelf(CellIds,CellIds+2,true)); + MEDCouplingUMesh *m1=static_cast(m0->buildPartOfMySelf(CellIds,CellIds+2,true)); mcIdType newNbOfNodes=-1; DataArrayIdType *arr=m1->getNodeIdsInUse(newNbOfNodes); const mcIdType expected[9]={-1,0,1,-1,2,3,-1,-1,-1}; @@ -2041,14 +2032,14 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp1() m1c->setCoordsAt(1,coordY); MEDCouplingUMesh *m1=m1c->buildUnstructured(); const mcIdType subPart1[3]={3,4,5}; - auto *m1bis=static_cast(m1->buildPartOfMySelf(subPart1,subPart1+3,false)); - auto *m2tmp=static_cast(m1->deepCopy()); + MEDCouplingUMesh *m1bis=static_cast(m1->buildPartOfMySelf(subPart1,subPart1+3,false)); + MEDCouplingUMesh *m2tmp=static_cast(m1->deepCopy()); const mcIdType subPart2[3]={0,1,2}; - auto *m2=static_cast(m2tmp->buildPartOfMySelf(subPart2,subPart2+3,false)); + MEDCouplingUMesh *m2=static_cast(m2tmp->buildPartOfMySelf(subPart2,subPart2+3,false)); const double vec[2]={0.5,0.5}; m2->translate(vec); // End of construction of input meshes m1bis and m2 -> start of specific part of the test - DataArrayIdType *d1=nullptr,*d2=nullptr; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1bis,m2,1e-10,d1,d2); const mcIdType expected1[8]={0,0,1,1,1,2,2,2}; const mcIdType expected2[8]={0,-1,0,1,-1,1,2,-1}; @@ -2134,7 +2125,7 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp2() m2c->setCoordsAt(1,coordsY2); MEDCouplingUMesh *m2=m2c->buildUnstructured(); // - DataArrayIdType *d1=nullptr,*d2=nullptr; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2); const mcIdType expected1[9]={0,0,1,1,2,2,3,4,5}; const mcIdType expected2[9]={0,2,1,3,1,3,2,3,3}; @@ -2214,7 +2205,7 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp3() m2->setCoords(myCoords2); myCoords2->decrRef(); // - DataArrayIdType *d1=nullptr,*d2=nullptr; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2); m3->unPolyze(); const mcIdType expected1[16]={0,1,1,1,2,3,3,3,4,5,5,5,6,7,7,7}; diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx index 021f7db15..e2fc9a45a 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx @@ -23,7 +23,8 @@ #include "MEDCouplingBasicsTest.hxx" -#include +#include +#include namespace MEDCoupling { diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx index 754e3cd18..162ae69bc 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx @@ -19,29 +19,19 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingBasicsTest5.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" -#include "InterpKernelException.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingPointSet.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDCouplingGaussLocalization.hxx" #include "MEDCouplingMultiFields.hxx" -#include "NormalizedGeometricTypes" +#include "MEDCouplingFieldOverTime.hxx" -#include #include -#include -#include -#include -#include -#include -#include +#include +#include using namespace MEDCoupling; @@ -67,7 +57,7 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2D1() m1->setCoords(myCoords1); myCoords1->decrRef(); // - auto *m11=static_cast(m1->deepCopy()); + MEDCouplingUMesh *m11=static_cast(m1->deepCopy()); m11->tessellate2D(1.); CPPUNIT_ASSERT(m11->getCoords()->isEqual(*m11->getCoords(),1e-12)); const mcIdType expected1[48]={5,0,3,11,1,5,3,4,12,2,1,11,5,5,15,3,0,5,6,16,4,3,15,5,5,5,0,7,19,5,6,5,19,7,8,20,5,0,1,23,7,5,1,2,24,8,7,23}; @@ -78,7 +68,7 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2D1() CPPUNIT_ASSERT(std::equal(expected2,expected2+9,m11->getNodalConnectivityIndex()->getConstPointer())); m11->decrRef(); // - auto *m12=static_cast(m1->deepCopy()); + MEDCouplingUMesh *m12=static_cast(m1->deepCopy()); m12->tessellate2D(0.5); CPPUNIT_ASSERT_EQUAL(ToIdType(41),m12->getNumberOfNodes()); const mcIdType expected3[60]={5,0,3,25,26,1,5,3,4,27,28,2,1,26,25,5,5,29,30,3,0,5,6,31,32,4,3,30,29,5,5,5,0,7,33,34,5,6,5,34,33,7,8,35,36,5,0,1,37,38,7,5,1,2,39,40,8,7,38,37}; @@ -112,7 +102,7 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2DCurve1() m1->setCoords(myCoords); myCoords->decrRef(); - auto *m2 = static_cast(m1->deepCopy()); + MEDCouplingUMesh *m2 = static_cast(m1->deepCopy()); m2->tessellate2D(0.1); CPPUNIT_ASSERT_NO_THROW(m2->checkConsistency(0.0)); // eps param not used m1->decrRef(); @@ -158,7 +148,7 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp4() m2->setCoords(myCoords2); myCoords2->decrRef(); // - DataArrayIdType *d1=nullptr,*d2=nullptr; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m2,m1,1e-10,d1,d2); m3->unPolyze(); const mcIdType expected1[16]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7}; @@ -189,7 +179,7 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp4() void MEDCouplingBasicsTest5::testGetCellIdsCrossingPlane1() { - MEDCouplingUMesh *mesh2D=nullptr; + MEDCouplingUMesh *mesh2D=0; MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); const double vec[3]={-0.07,1.,0.07}; const double origin[3]={1.524,1.4552,1.74768}; @@ -210,13 +200,13 @@ void MEDCouplingBasicsTest5::testGetCellIdsCrossingPlane1() void MEDCouplingBasicsTest5::testBuildSlice3D1() { - MEDCouplingUMesh *mesh2D=nullptr; + MEDCouplingUMesh *mesh2D=0; MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); mesh2D->decrRef(); // First slice in the middle of 3D cells const double vec1[3]={-0.07,1.,0.07}; const double origin1[3]={1.524,1.4552,1.74768}; - DataArrayIdType *ids=nullptr; + DataArrayIdType *ids=0; MEDCouplingUMesh *slice1=mesh3D->buildSlice3D(origin1,vec1,1e-10,ids); const mcIdType expected1[9]={1,3,4,7,9,10,13,15,16}; const mcIdType expected2[47]={5,42,41,40,43,44,5,42,46,45,41,5,44,43,40,47,48,5,49,42,44,50,5,49,51,46,42,5,50,44,48,52,5,53,49,50,54,5,53,55,51,49,5,54,50,52,56}; @@ -285,7 +275,7 @@ void MEDCouplingBasicsTest5::testBuildSlice3D1() void MEDCouplingBasicsTest5::testBuildSlice3DSurf1() { - MEDCouplingUMesh *mesh2D=nullptr; + MEDCouplingUMesh *mesh2D=0; MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); mesh2D->decrRef(); DataArrayIdType *a=DataArrayIdType::New(),*b=DataArrayIdType::New(),*c=DataArrayIdType::New(),*d=DataArrayIdType::New(); @@ -295,7 +285,7 @@ void MEDCouplingBasicsTest5::testBuildSlice3DSurf1() // const double vec1[3]={-0.07,1.,0.07}; const double origin1[3]={1.524,1.4552,1.74768}; - DataArrayIdType *ids=nullptr; + DataArrayIdType *ids=0; MEDCouplingUMesh *slice1=mesh2D->buildSlice3DSurf(origin1,vec1,1e-10,ids); const mcIdType expected1[25]={6,8,10,11,13,18,19,21,23,25,26,38,41,43,47,49,52,53,64,67,69,73,75,78,79}; const mcIdType expected2[75]={1,40,41,1,42,41,1,40,43,1,44,43,1,42,44,1,45,41,1,42,46,1,46,45,1,47,40,1,47,48,1,44,48,1,49,42,1,44,50,1,49,50,1,49,51,1,51,46,1,48,52,1,50,52,1,53,49,1,50,54,1,53,54,1,53,55,1,55,51,1,52,56,1,54,56}; @@ -348,7 +338,7 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1() const char *comps[2]={"comp1","comp2"}; std::vector compsCpp(comps,comps+2); DataArrayDouble *da=DataArrayDouble::New(); - DataArrayDouble *tmp=nullptr; + DataArrayDouble *tmp=0; da->setInfoAndChangeNbOfCompo(compsCpp); da->setName("da"); da->alloc(7,2); @@ -442,7 +432,7 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() const char *comps[2]={"comp1","comp2"}; std::vector compsCpp(comps,comps+2); DataArrayIdType *da=DataArrayIdType::New(); - DataArrayIdType *tmp=nullptr; + DataArrayIdType *tmp=0; da->setInfoAndChangeNbOfCompo(compsCpp); da->setName("da"); da->alloc(7,2); @@ -584,12 +574,12 @@ void MEDCouplingBasicsTest5::testAre2DCellsNotCorrectlyOriented1() myCoords1->decrRef(); // double vec1[3]={0.,0.,1.}; - auto *vec2=new double[2]; + double *vec2=new double[2]; for(int i=0;i<18;i++) { vec2[0]=3.*cos(M_PI/9.*i); vec2[1]=3.*sin(M_PI/9.*i); - auto *m1Cpy=static_cast(m1->deepCopy()); + MEDCouplingUMesh *m1Cpy=static_cast(m1->deepCopy()); m1Cpy->translate(vec2); std::vector res; CPPUNIT_ASSERT_THROW(m1Cpy->are2DCellsNotCorrectlyOriented(vec1,false,res),INTERP_KERNEL::Exception); @@ -747,19 +737,19 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() myCoords3D->decrRef(); mesh3D->checkConsistencyLight(); // - auto *mesh3D_2=dynamic_cast(mesh3D->deepCopy()); - auto *mesh2D_2=dynamic_cast(mesh2D->deepCopy()); - auto *mesh3D_4=dynamic_cast(mesh3D->deepCopy()); - auto *mesh2D_4=dynamic_cast(mesh2D->deepCopy()); + MEDCouplingUMesh *mesh3D_2=dynamic_cast(mesh3D->deepCopy()); + MEDCouplingUMesh *mesh2D_2=dynamic_cast(mesh2D->deepCopy()); + MEDCouplingUMesh *mesh3D_4=dynamic_cast(mesh3D->deepCopy()); + MEDCouplingUMesh *mesh2D_4=dynamic_cast(mesh2D->deepCopy()); DataArrayIdType *renumNodes=DataArrayIdType::New(); - mcIdType const oldNbOf3DNodes=mesh3D->getNumberOfNodes(); + mcIdType oldNbOf3DNodes=mesh3D->getNumberOfNodes(); renumNodes->alloc(mesh2D->getNumberOfNodes(),1); renumNodes->iota(oldNbOf3DNodes); DataArrayDouble *coo=DataArrayDouble::Aggregate(mesh3D->getCoords(),mesh2D->getCoords()); mesh3D->setCoords(coo); mesh2D->setCoords(coo); coo->decrRef(); - auto *mesh2D_3=dynamic_cast(mesh2D->deepCopy()); + MEDCouplingUMesh *mesh2D_3=dynamic_cast(mesh2D->deepCopy()); mesh2D_3->shiftNodeNumbersInConn(oldNbOf3DNodes); mesh2D->renumberNodesInConn(renumNodes->getConstPointer()); renumNodes->decrRef(); @@ -768,7 +758,7 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() // DataArrayIdType *da1,*da2; mesh3D->checkGeoEquivalWith(mesh3D_2,10,1e-12,da1,da2); - CPPUNIT_ASSERT(da1==nullptr); + CPPUNIT_ASSERT(da1==0); CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); const mcIdType expected1[8]={8,11,12,9,4,5,6,7}; @@ -777,7 +767,7 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() da2->decrRef(); // mesh2D->checkGeoEquivalWith(mesh2D_2,10,1e-12,da1,da2); - CPPUNIT_ASSERT(da1==nullptr); + CPPUNIT_ASSERT(da1==0); CPPUNIT_ASSERT_EQUAL(9,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); for(mcIdType i=0;i<9;i++) @@ -785,7 +775,7 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() da2->decrRef(); // const double vect[3]={1.,0.,0.}; - auto *mesh2D_5=dynamic_cast(mesh2D_4->deepCopy()); + MEDCouplingUMesh *mesh2D_5=dynamic_cast(mesh2D_4->deepCopy()); mesh2D_5->translate(vect); std::vector meshes(3); meshes[0]=mesh3D_4; meshes[1]=mesh2D_4; meshes[2]=mesh2D_5; @@ -842,7 +832,7 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() void MEDCouplingBasicsTest5::testComputeNeighborsOfCells1() { MEDCouplingUMesh *m=build2DTargetMesh_1(); - DataArrayIdType *d1=nullptr,*d2=nullptr; + DataArrayIdType *d1=0,*d2=0; m->computeNeighborsOfCells(d1,d2); CPPUNIT_ASSERT_EQUAL(6,(int)d2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(10,(int)d1->getNumberOfTuples()); @@ -945,7 +935,7 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleGetMinMaxPerComponent1() { const double values1[12]={1.,2.,3.,-0.9,2.1,3.,1.3,1.7,3.,1.,1.8,3.}; DataArrayDouble *d1=DataArrayDouble::New(); - auto *res=new double[2*3]; + double *res=new double[2*3]; CPPUNIT_ASSERT_THROW(d1->getMinMaxPerComponent(res),INTERP_KERNEL::Exception); d1->alloc(4,3); std::copy(values1,values1+12,d1->getPointer()); @@ -992,8 +982,8 @@ void MEDCouplingBasicsTest5::testZipConnectivityPol1() MEDCouplingUMesh *m1=build2DTargetMesh_1(); const mcIdType cells1[3]={2,3,4}; MEDCouplingPointSet *m2_1=m1->buildPartOfMySelf(cells1,cells1+3,true); - auto *m2=dynamic_cast(m2_1); - DataArrayIdType *arr=nullptr; + MEDCouplingUMesh *m2=dynamic_cast(m2_1); + DataArrayIdType *arr=0; CPPUNIT_ASSERT(m2); // no permutation policy 0 CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,0,arr)); @@ -1064,7 +1054,7 @@ void MEDCouplingBasicsTest5::testZipConnectivityPol1() m2_1=m1->buildPartOfMySelf(cells2,cells2+2,true); m2=dynamic_cast(m2_1); CPPUNIT_ASSERT(m2); - arr=nullptr; + arr=0; // no permutation policy 0 CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,0,arr)); CPPUNIT_ASSERT_EQUAL(2,(int)arr->getNumberOfTuples()); @@ -1216,8 +1206,8 @@ void MEDCouplingBasicsTest5::testPartitionBySpreadZone1() MEDCouplingUMesh *m=build2DTargetMesh_1(); const mcIdType part0[3]={2,3,4}; const mcIdType part1[2]={0,1}; - auto *m1=static_cast(m->buildPartOfMySelf(part0,part0+3)); - auto *m2=static_cast(m->buildPartOfMySelf(part1,part1+2)); + MEDCouplingUMesh *m1=static_cast(m->buildPartOfMySelf(part0,part0+3)); + MEDCouplingUMesh *m2=static_cast(m->buildPartOfMySelf(part1,part1+2)); std::vector v(3); v[0]=m; v[1]=m1; v[2]=m2; MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshes(v); const mcIdType renum[10]={5,2,9,6,4,7,0,1,3,8}; @@ -1289,13 +1279,13 @@ void MEDCouplingBasicsTest5::testGiveCellsWithType1() void MEDCouplingBasicsTest5::testBuildSlice3D2() { - MEDCouplingUMesh *mesh2D=nullptr; + MEDCouplingUMesh *mesh2D=0; MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); mesh2D->decrRef(); // First slice in the middle of 3D cells const double vec1[3]={-0.07,1.,0.07}; const double origin1[3]={1.524,1.4552,1.74768}; - DataArrayIdType *ids=nullptr; + DataArrayIdType *ids=0; MEDCouplingUMesh *slice1=mesh3D->buildSlice3D(origin1,vec1,1e-10,ids); // MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); @@ -1313,7 +1303,7 @@ void MEDCouplingBasicsTest5::testBuildSlice3D2() CPPUNIT_ASSERT(f2->getArray()->isEqual(*arr2,1e-12)); CPPUNIT_ASSERT(slice1->isEqual(f2->getMesh(),1e-12)); int a,b; - double const c=f2->getTime(a,b); + double c=f2->getTime(a,b); CPPUNIT_ASSERT_EQUAL(6,a); CPPUNIT_ASSERT_EQUAL(7,b); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.5,c,1e-12); @@ -1385,10 +1375,10 @@ void MEDCouplingBasicsTest5::testComputeSkin1() const mcIdType expected3[18]={0,1,2,3,4,5,9,10,14,15,19,20,24,25,26,27,28,29}; CPPUNIT_ASSERT_EQUAL(ToIdType(18),ids->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected3,expected3+18,ids->getConstPointer())); - auto *part=dynamic_cast(umesh->buildFacePartOfMySelfNode(ids->begin(),ids->end(),true)); + MEDCouplingUMesh *part=dynamic_cast(umesh->buildFacePartOfMySelfNode(ids->begin(),ids->end(),true)); part->setName(skin->getName().c_str()); CPPUNIT_ASSERT(part->isEqual(skin,1e-12)); - auto *part2=dynamic_cast(part->buildPartOfMySelfSlice(1,18,2,true)); + MEDCouplingUMesh *part2=dynamic_cast(part->buildPartOfMySelfSlice(1,18,2,true)); DataArrayIdType *ids2=DataArrayIdType::Range(0,18,2); part->setPartOfMySelf(ids2->begin(),ids2->end(),*part2); ids2->decrRef(); @@ -1414,10 +1404,10 @@ void MEDCouplingBasicsTest5::testUMeshSetPartOfMySelf2() std::set s; s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); CPPUNIT_ASSERT(s==m->getAllGeoTypes()); const mcIdType ids1[3]={0,3,4}; - auto *part=static_cast(m->buildPartOfMySelf(ids1,ids1+3,true)); + MEDCouplingUMesh *part=static_cast(m->buildPartOfMySelf(ids1,ids1+3,true)); part->simplexize(0)->decrRef(); const mcIdType ids2[3]={1,2,5}; - auto *part2=static_cast(part->buildPartOfMySelf(ids2,ids2+3,true)); + MEDCouplingUMesh *part2=static_cast(part->buildPartOfMySelf(ids2,ids2+3,true)); m->setPartOfMySelf(ids1,ids1+3,*part2); const mcIdType expected1[20]={3,0,4,1,3,1,4,2,3,4,5,2,3,6,7,4,3,7,5,4}; CPPUNIT_ASSERT(std::equal(expected1,expected1+20,m->getNodalConnectivity()->getConstPointer())); @@ -1533,7 +1523,7 @@ void MEDCouplingBasicsTest5::testKrSpatialDiscretization1() const double targetPointCoordsX[40]={-0.5,-0.45,-0.4,-0.35,-0.3,-0.25,-0.2,-0.15,-0.1,-0.05,-6.93889390391e-17,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.0,1.05,1.1,1.15,1.2,1.25,1.3,1.35,1.4,1.45}; const double targetFieldValsExpected[40]={2.975379475824351, 2.95613491917003, 2.936890362515361, 2.917645805861018, 2.898401249206574, 2.879156692552137, 2.859912135897732, 2.840667579243201, 2.821423022588731, 2.802178465934342, 2.78293390927989, 2.763689352625457, 2.744444795971001, 2.725209522098197, 2.709077577124666, 2.706677252549218, 2.727467797847971, 2.713338094723676, 2.671342424824244, 2.664877370146978, 2.653840141412181, 2.619607861392791, 2.569777214476479, 2.513263929794591, 2.450732752808528, 2.368313560985155, 2.250909795670307, 2.098194272085416, 1.954257891732065, 1.895040660973802, 1.865256788315972, 1.835475248687992, 1.80569370905998, 1.775912169431971, 1.746130629803976, 1.716349090175918, 1.686567550547855, 1.656786010919941, 1.627004471291988, 1.597222931663817}; // - int const nbOfInputPoints=10; + int nbOfInputPoints=10; MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES_KR,ONE_TIME); DataArrayDouble *srcArrX=DataArrayDouble::New(); srcArrX->alloc(nbOfInputPoints,1); @@ -1548,7 +1538,7 @@ void MEDCouplingBasicsTest5::testKrSpatialDiscretization1() f->setArray(srcVals); f->checkConsistencyLight(); // - auto *res0=new double[1]; + double *res0=new double[1]; f->getValueOn(targetPointCoordsX,res0); CPPUNIT_ASSERT_DOUBLES_EQUAL(targetFieldValsExpected[0],res0[0],1e-10); delete [] res0; @@ -1627,7 +1617,7 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp5() m2->setConnectivity(conn,connI,true); coords->decrRef(); conn->decrRef(); connI->decrRef(); // - DataArrayIdType *d1=nullptr,*d2=nullptr; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2); CPPUNIT_ASSERT_EQUAL(105,(int)m3->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(105,(int)d1->getNumberOfTuples()); @@ -1780,7 +1770,7 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp6() m2->setConnectivity(conn,connI,true); coords->decrRef(); conn->decrRef(); connI->decrRef(); // - DataArrayIdType *d1=nullptr,*d2=nullptr; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2); CPPUNIT_ASSERT_EQUAL(4,(int)m3->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(4,(int)d1->getNumberOfTuples()); @@ -1809,7 +1799,7 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp6() void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp7() { - double const eps = 1.0e-8; + double eps = 1.0e-8; // coordinates circle - SEE getCircle() on the Python side DataArrayDouble *coords1=DataArrayDouble::New(); const double coordsData1[16]={0.5328427124746189, -0.08284271247461905, -0.03284271247461901, 0.4828427124746191, -0.03284271247461906, -0.082842712474619, 0.5328427124746191, 0.482842712474619}; @@ -1842,7 +1832,7 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp7() m2->setConnectivity(conn2,connI2,true); coords2->decrRef(); conn2->decrRef(); connI2->decrRef(); - DataArrayIdType * resToM1 = nullptr, * resToM2 = nullptr; + DataArrayIdType * resToM1 = 0, * resToM2 = 0; MEDCouplingUMesh *m_intersec=MEDCouplingUMesh::Intersect2DMeshes(m2, m1, eps, resToM1, resToM2); m_intersec->zipCoords(); @@ -1875,7 +1865,7 @@ void MEDCouplingBasicsTest5::testDAIBuildSubstractionOptimized1() DataArrayIdType *da3=DataArrayIdType::New(); da3->useArray(tab3,false,DeallocType::CPP_DEALLOC,3,1); DataArrayIdType *da4=DataArrayIdType::New(); da4->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1); // - DataArrayIdType *a=nullptr; + DataArrayIdType *a=0; a=da1->buildSubstractionOptimized(da2); CPPUNIT_ASSERT_EQUAL(4,(int)a->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents()); @@ -2014,7 +2004,7 @@ void MEDCouplingBasicsTest5::testSimplexize3() c->decrRef(); m->checkConsistency(); // - auto *m1=static_cast(m->deepCopy()); + MEDCouplingUMesh *m1=static_cast(m->deepCopy()); DataArrayIdType *d1=m1->simplexize(INTERP_KERNEL::PLANAR_FACE_5); m1->checkConsistency(); MEDCouplingFieldDouble *f1=m1->getMeasureField(ON_CELLS); @@ -2039,7 +2029,7 @@ void MEDCouplingBasicsTest5::testSimplexize3() m1->decrRef(); d1->decrRef(); // - auto *m2=static_cast(m->deepCopy()); + MEDCouplingUMesh *m2=static_cast(m->deepCopy()); DataArrayIdType *d2=m2->simplexize(INTERP_KERNEL::PLANAR_FACE_6); m2->checkConsistency(); MEDCouplingFieldDouble *f2=m2->getMeasureField(ON_CELLS); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx index aac22ac3a..a67429681 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx @@ -23,7 +23,8 @@ #include "MEDCouplingBasicsTest.hxx" -#include +#include +#include namespace MEDCoupling { diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTestData1.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTestData1.hxx index bb4eecfdd..ba4d63673 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTestData1.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTestData1.hxx @@ -18,8 +18,6 @@ // // Author : Anthony Geay (CEA/DEN) -#include "MCIdType.hxx" - static mcIdType connITT[201]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1029, 1058, 1087, 1116, 1145, 1174, 1203, 1232, 1261, 1290, 1319, 1348, 1377, 1406, 1435, 1464, 1493, 1522, 1551, 1580, 1609, 1638, 1667, 1696, 1725, 1754, 1783, 1812, 1841, 1870, 1899, 1928, 1957, 1986, 2015, 2044, 2073, 2102, 2131, 2160, 2189, 2218, 2247, 2276, 2305, 2334, 2363, 2392, 2421, 2450, 2479, 2508, 2537, 2566, 2595, diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx index 1d771b8cc..08f77cf03 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx @@ -19,22 +19,11 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingBasicsTestInterp.hxx" -#include "MEDCouplingNormalizedUnstructuredMesh.txx" -#include "Interpolation2D.hxx" -#include "InterpolationOptions.hxx" -#include "MCType.hxx" -#include "Interpolation3D.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingNormalizedCartesianMesh.hxx" -#include "InterpKernelException.hxx" -#include "InterpolationCC.hxx" -#include "InterpolationCU.hxx" -#include "Interpolation1D.hxx" -#include "Interpolation2D1D.hxx" -#include "Interpolation2D3D.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" +#include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" +#include "Interpolation2D.txx" #include "Interpolation3DSurf.hxx" #include "Interpolation3D.txx" #include "Interpolation2D1D.txx" @@ -42,19 +31,17 @@ #include "InterpolationCC.txx" #include "InterpolationCU.txx" #include "Interpolation2DCurve.hxx" +#include "Interpolation1D.txx" +#include "MEDCouplingNormalizedUnstructuredMesh.txx" #include "MEDCouplingNormalizedCartesianMesh.txx" -#include "NormalizedGeometricTypes" #include -#include -#include -#include -#include +#include using namespace MEDCoupling; -using IntersectionMatrix = int; +typedef std::vector > IntersectionMatrix; void MEDCouplingBasicsTestInterp::test2DInterpP0P0_1() { @@ -65,11 +52,11 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P0_1() MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; std::vector > res; - INTERP_KERNEL::IntersectionType const types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Convex, INTERP_KERNEL::Geometric2D}; - for(auto & type : types) + INTERP_KERNEL::IntersectionType types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Convex, INTERP_KERNEL::Geometric2D}; + for(int i=0;i<3;i++) { myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(type); + myInterpolator.setIntersectionType(types[i]); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[0][0],1e-12); @@ -219,11 +206,11 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P1_1() MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; std::vector > res; - INTERP_KERNEL::IntersectionType const types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; - for(auto & type : types) + INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; + for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(type); + myInterpolator.setIntersectionType(types[i]); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1"); CPPUNIT_ASSERT_EQUAL(9,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664,res[0][0],1e-12); @@ -329,11 +316,11 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P0_1() MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; std::vector > res; - INTERP_KERNEL::IntersectionType const types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; - for(auto & type : types) + INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; + for(mcIdType i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(type); + myInterpolator.setIntersectionType(types[i]); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12); @@ -441,11 +428,11 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P1_1() MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; std::vector > res; - INTERP_KERNEL::IntersectionType const types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; - for(auto & type : types) + INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; + for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(type); + myInterpolator.setIntersectionType(types[i]); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1"); CPPUNIT_ASSERT_EQUAL(9,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.08333333333333334,res[0][0],1.e-12); @@ -514,7 +501,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P0_1() MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; std::vector > res; - INTERP_KERNEL::IntersectionType const types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; + INTERP_KERNEL::IntersectionType types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); @@ -573,10 +560,10 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P1_1() INTERP_KERNEL::Interpolation3DSurf myInterpolator; std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; - for(auto & type : types) + for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(type); + myInterpolator.setIntersectionType(types[i]); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1"); CPPUNIT_ASSERT_EQUAL(9,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.041666666666666664*sqrt(2.),res[0][0],1e-12); @@ -641,10 +628,10 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P0_1() INTERP_KERNEL::Interpolation3DSurf myInterpolator; std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; - for(auto & type : types) + for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(type); + myInterpolator.setIntersectionType(types[i]); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25*sqrt(2.),res[0][0],1e-12); @@ -711,10 +698,10 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P1_1() INTERP_KERNEL::Interpolation3DSurf myInterpolator; std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; - for(auto & type : types) + for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(type); + myInterpolator.setIntersectionType(types[i]); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1"); CPPUNIT_ASSERT_EQUAL(9,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.08333333333333334*sqrt(2.),res[0][0],1.e-12); @@ -846,9 +833,9 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P0_3() { INTERP_KERNEL::Interpolation3DSurf myInterpolator; std::vector > res; - double const vecTrans[3]={0.,0.,1.e-10}; - double const vec[3]={0.,-1.,0.}; - double const pt[3]={-0.3,-0.3,5.e-11}; + double vecTrans[3]={0.,0.,1.e-10}; + double vec[3]={0.,-1.,0.}; + double pt[3]={-0.3,-0.3,5.e-11}; const int N=32; const double deltaA=M_PI/N; myInterpolator.setPrecision(1e-12); @@ -943,9 +930,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0_1() std::vector > res; myInterpolator.setPrecision(1e-12); INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( int i = 0; i < 4; ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); res.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); @@ -1012,9 +999,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_1() myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( int i = 0; i < 4; ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); res.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); @@ -1062,9 +1049,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_2() myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( int i = 0; i < 4; ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); res.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); @@ -1112,9 +1099,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_3() myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( int i = 0; i < 4; ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); res.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); @@ -1166,9 +1153,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_4() myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( int i = 0; i < 4; ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); res.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); @@ -1211,9 +1198,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P1_1() std::vector > res; myInterpolator.setPrecision(1e-12); INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( int i = 0; i < 4; ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); res.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1"); CPPUNIT_ASSERT_EQUAL(9,(int)res.size()); @@ -1268,9 +1255,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P1PL_1() myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( int i = 0; i < 4; ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); res.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1"); CPPUNIT_ASSERT_EQUAL(9,(int)res.size()); @@ -1301,9 +1288,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P0_1() std::vector > res; myInterpolator.setPrecision(1e-12); INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24}; - for (auto & i : sp) + for ( int i = 0; i < 3; ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); res.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); @@ -1358,9 +1345,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P0PL_1() myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( int i = 0; i < 4; ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); res.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); @@ -1406,7 +1393,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P1_1() myInterpolator.setPrecision(1e-12); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1"); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); - double const res3D[8][28]= {{124999.999883775978, 245370.370390364464, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 203703.703634892299, 187500.000094145857, 0.0, 0.0, 4629.6296266718, 0.0, 215277.777751402784, 209722.222322299582, 0.0, 0.0, 0.0, 0.0, 104166.666590829205, 121296.296368812196, 0.0, 250000.000003472145}, + double res3D[8][28]= {{124999.999883775978, 245370.370390364464, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 203703.703634892299, 187500.000094145857, 0.0, 0.0, 4629.6296266718, 0.0, 215277.777751402784, 209722.222322299582, 0.0, 0.0, 0.0, 0.0, 104166.666590829205, 121296.296368812196, 0.0, 250000.000003472145}, {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 120370.370368827047, 0.0, 0.0, 38888.888897777797, 0.0, 0.0, 45370.3703701697596, 0.0, 0.0, 45370.3703701697596, 83333.3333263888926, 0.0}, {0.0, 0.0, 0.0, 97222.2222222221753, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 97222.2222222221608, 0.0, 97222.2222222222044, 41666.6666666666642, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 277777.777787084982, 199074.074074073927, 0.0, 0.0, 0.0, 4629.62962962962774, 0.0, 321759.259254934732, 83333.3333333333139, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4629.62962667180363, 0.0, 0.0, 251388.88888319055, 194444.444454861077, 0.0, 79629.6296194135939, 250000.000003472145, 0.0, 0.0, 0.0, 0.0}, @@ -1946,11 +1933,11 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P0Bary_1() MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; std::vector > res; - INTERP_KERNEL::IntersectionType const types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D}; - for(auto & type : types) + INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D}; + for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(type); + myInterpolator.setIntersectionType(types[i]); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666669,res[0][0],1e-12); @@ -1988,10 +1975,10 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P0Bary_1() INTERP_KERNEL::Interpolation3DSurf myInterpolator; std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D}; - for(auto & type : types) + for(int i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); - myInterpolator.setIntersectionType(type); + myInterpolator.setIntersectionType(types[i]); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666669*sqrt(2.),res[0][0],1e-12); @@ -2019,6 +2006,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P0Bary_1() targetMesh->decrRef(); } +#include void MEDCouplingBasicsTestInterp::test3DInterpP1P0Bary_1() { MEDCouplingUMesh *sourceMesh=build3DSourceMesh_2(); @@ -2033,7 +2021,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P0Bary_1() myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); - double const res3D[5][28]={{104166.66658918398, 885416.666685817763, 135416.666666666541, 36458.3333333335031, 31249.9999999999018, 145833.333333333256, 41666.6666666667516, 124999.999999999971, 177083.333326388849, 0.0, 31249.9999999999636, 0.0, 41666.666620792399, 159722.22229009436, 0.0, 0.0, 41666.6666631944681, 125000, 43499.2283723790752, 164351.851924000395, 36458.3333372396883, 0.0, 0.0, 125000.000001736029, 34722.2221800900952, 13599.5370788455439, 0.0, 167438.27159690368}, + double res3D[5][28]={{104166.66658918398, 885416.666685817763, 135416.666666666541, 36458.3333333335031, 31249.9999999999018, 145833.333333333256, 41666.6666666667516, 124999.999999999971, 177083.333326388849, 0.0, 31249.9999999999636, 0.0, 41666.666620792399, 159722.22229009436, 0.0, 0.0, 41666.6666631944681, 125000, 43499.2283723790752, 164351.851924000395, 36458.3333372396883, 0.0, 0.0, 125000.000001736029, 34722.2221800900952, 13599.5370788455439, 0.0, 167438.27159690368}, {0.0, 41666.6664479170649, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 125000.000161457952, 0.0, 0.0, 0.0, 0.0, 111111.11112005508, 0.0, 0.0, 291666.666656249959, 41666.6666666666933, 6944.4444415638809, 270833.333520485845, 0.0, 0.0, 124999.999989583303, 41666.6665798612958, 20833.3333186342825, 145833.333354303701, 83333.3333263888198, 27777.7777501651799}, {0.0, 93750.0000000000728, 125000.000000000058, 0.0, 0.0, 72916.666666666526, 291666.666666666628, 41666.6666666667152, 197916.66666666657, 166666.666666666802, 218750.000000000116, 41666.6666666665697, 0.0, 0.0, 0.0, 0.0, 0.0, 41666.6666666666861, 0.0, 0.0, 0.0, 0.0, 0.0, 41666.6666666666642, 0.0, 0.0, 0.0, 0.0}, {72916.6666484848247, 82465.2777799315081, 0.0, 0.0, 217447.916666666686, 197916.666666666802, 0.0, 41666.6666666666715, 0.0, 0.0, 0.0, 0.0, 290364.583310396119, 125000.000018181803, 41666.6666666666351, 166666.666666666599, 0.0, 41666.6666666665551, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 27777.7777734705051, 0.0, 0.0, 27777.7778028684952}, @@ -2314,7 +2302,7 @@ void MEDCouplingBasicsTestInterp::test2D1DBasicInterpP0P0() CPPUNIT_ASSERT_DOUBLES_EQUAL(6., matrix[1][6],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(3., matrix[1][7],1e-12); - INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces = myInterpolator.retrieveDuplicateFaces(); + INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces(); CPPUNIT_ASSERT_EQUAL(1,(int)duplicateFaces.size()); INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces; @@ -2443,9 +2431,9 @@ void MEDCouplingBasicsTestInterp::test3D2DBasicInterpP0P0() myInterpolator.setPrecision(1e-12); std::vector > matrix; INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 }; - for (auto & i : sp) + for ( size_t i = 0; i < sizeof(sp)/sizeof(sp[0]); ++i ) { - myInterpolator.setSplittingPolicy( i ); + myInterpolator.setSplittingPolicy( sp[i] ); matrix.clear(); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0"); @@ -2475,7 +2463,7 @@ void MEDCouplingBasicsTestInterp::test3D2DBasicInterpP0P0() CPPUNIT_ASSERT_DOUBLES_EQUAL(80. ,matrix[2][5],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(112. ,matrix[2][6],1e-12); - INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType const duplicateFaces = myInterpolator.retrieveDuplicateFaces(); + INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces(); CPPUNIT_ASSERT_EQUAL(3,(int)duplicateFaces.size()); INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces; diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.hxx index d8a777ec6..419569d73 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.hxx @@ -23,7 +23,8 @@ #include "MEDCouplingBasicsTest.hxx" -#include +#include +#include namespace MEDCoupling { diff --git a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx index 84930c509..f75dc967e 100644 --- a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx @@ -18,27 +18,14 @@ // // Author : Anthony Geay (EDF R&D) -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" -#include "InterpKernelException.hxx" #include "MEDCouplingBasicsTest.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingPointSet.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" +#include "MEDCouplingMemArray.hxx" #include "MEDCouplingMemArray.txx" #include "MEDCouplingMultiFields.hxx" -#include -#include -#include -#include -#include -#include "NormalizedGeometricTypes" -#include -#include void CppExample_MEDCouplingFieldDouble_WriteVTK() @@ -122,12 +109,12 @@ void CppExample_MEDCouplingFieldDouble_MergeFields() field2->applyFunc("x + 5"); // "translate" field2 // concatenate field1 and field2 - MCAuto const field3 = + MCAuto field3 = MEDCouplingFieldDouble::MergeFields( field1, field2 ); std::vector fields( 2 ); fields[0] = field1; fields[1] = field2; - MCAuto const field4 = + MCAuto field4 = MEDCouplingFieldDouble::MergeFields( fields ); //! [CppSnippet_MEDCouplingFieldDouble_MergeFields_1] } @@ -230,7 +217,7 @@ void CppExample_MEDCouplingFieldDouble_applyFunc3() // transform the field to a 3D vector field const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; const char* varNames[2] = { "a", "b" }; // names used to refer to X and Y components - std::vector const varNamesVec( varNames, varNames+2 ); + std::vector varNamesVec( varNames, varNames+2 ); field->applyFuncNamedCompo( 3, varNamesVec, func ); // require 3 components CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components as required //! [CppSnippet_MEDCouplingFieldDouble_applyFunc3_1] @@ -341,7 +328,7 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic3() field->setMesh( mesh ); const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; const char* varNames[2] = { "a", "b" }; // names used to refer to X and Y coord components - std::vector const varNamesVec( varNames, varNames+2 ); + std::vector varNamesVec( varNames, varNames+2 ); field->fillFromAnalyticNamedCompo( 3, varNamesVec, func ); //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_2] //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_3] @@ -354,7 +341,7 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic3() double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // - double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" + double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )" @@ -392,7 +379,7 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic2() double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // - double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" + double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )" @@ -428,7 +415,7 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic() double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // - double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" + double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )" @@ -678,7 +665,7 @@ void CppExample_MEDCouplingMesh_fillFromAnalytic3() //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_2] const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; const char* varNames[2] = { "a", "b" }; // names used to refer to X and Y coord components - std::vector const varNamesVec( varNames, varNames+2 ); + std::vector varNamesVec( varNames, varNames+2 ); MCAuto field = mesh->fillFromAnalyticNamedCompo( MEDCoupling::ON_CELLS, 3, varNamesVec, func ); //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_2] @@ -692,7 +679,7 @@ void CppExample_MEDCouplingMesh_fillFromAnalytic3() double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // - double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" + double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )" @@ -728,7 +715,7 @@ void CppExample_MEDCouplingMesh_fillFromAnalytic2() double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // - double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" + double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )" @@ -762,7 +749,7 @@ void CppExample_MEDCouplingMesh_fillFromAnalytic() double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // - double const dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" + double dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ); // "sqrt( a*a + b*b )" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[0], 10 + bc1[1], 13 ); // "10 + IVec * b" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[1], 10 + bc1[0], 13 ); // "10 + JVec * a" CPPUNIT_ASSERT_DOUBLES_EQUAL( val1[2], 10 + dist , 13 ); // "10 + KVec * sqrt( a*a + b*b )" @@ -809,7 +796,7 @@ void CppExample_MEDCouplingUMesh_areCellsIncludedIn() (MEDCouplingUMesh*) mesh1->buildPartOfMySelf( cells2, cells2+3, true ); //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2] //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_3] - int const compType = 0; // the strongest policy + int compType = 0; // the strongest policy DataArrayIdType *corr2to1, *corr1to2; // a larger mesh1 includes a smaller mesh2 CPPUNIT_ASSERT( mesh1->areCellsIncludedIn( mesh2, compType, corr2to1 )); @@ -1364,8 +1351,8 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelf() //! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_1] //! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_2] const mcIdType cellIds[2]={1,2}; - auto* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true); - auto* mesh3=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,false); + MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true); + MEDCouplingUMesh* mesh3=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,false); CPPUNIT_ASSERT( coordsArr->isEqual( *mesh2->getCoords(), 1e-13 )); // same nodes CPPUNIT_ASSERT( !coordsArr->isEqual( *mesh3->getCoords(), 1e-13 )); // different nodes for ( mcIdType i = 0; i < 2; ++i ) @@ -1479,7 +1466,7 @@ void CppExample_MEDCouplingUMesh_zipCoordsTraducer() //! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_1] //! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_2] const mcIdType cellIds[2]={1,2}; - auto* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true); + MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true); DataArrayIdType *arr=mesh2->zipCoordsTraducer(); CPPUNIT_ASSERT_EQUAL( ToIdType(4), mesh2->getNumberOfNodes() ); // nb of nodes decreased CPPUNIT_ASSERT_EQUAL( mesh->getNumberOfNodes(), arr->getNumberOfTuples() ); @@ -1512,7 +1499,7 @@ void CppExample_MEDCouplingUMesh_getNodeIdsInUse() //! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_1] //! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_2] const mcIdType cellIds[2]={1,2}; - auto* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true); + MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true); mcIdType newNbOfNodes = 0; DataArrayIdType *arr=mesh2->getNodeIdsInUse( newNbOfNodes ); const mcIdType idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1}; @@ -2045,7 +2032,7 @@ void CppExample_DataArrayDouble_findCommonTuples() std::copy(array2,array2+12,da->getPointer()); //! [CppSnippet_DataArrayDouble_findCommonTuples1] //! [CppSnippet_DataArrayDouble_findCommonTuples2] - DataArrayIdType *c=nullptr,*cI=nullptr; + DataArrayIdType *c=0,*cI=0; da->findCommonTuples(1.01e-1,-1,c,cI); const mcIdType expected3[5]={0,3,4,1,2}; @@ -2131,7 +2118,7 @@ void CppExampleFieldDoubleBuildSubPart1() CPPUNIT_ASSERT_EQUAL(ToIdType(6),f2->getMesh()->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); - auto *m2C=dynamic_cast(const_cast(f2->getMesh())); + MEDCoupling::MEDCouplingUMesh *m2C=dynamic_cast(const_cast(f2->getMesh())); CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen()); const double expected2[12]={0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7}; for(mcIdType i=0;i<12;i++) @@ -2294,8 +2281,8 @@ void CppSnippetDataArrayBuild1() const mcIdType nbOfNodes=12; double coords[3*nbOfNodes]={2.,3.,4.,3.,4.,5.,4.,5.,6.,5.,6.,7.,6.,7.,8.,7.,8.,9.,8.,9.,10.,9.,10.,11.,10.,11.,12.,11.,12.,13.,12.,13.,14.,13.,14.,15.}; // - MEDCoupling::DataArrayDouble *coordsArr=nullptr; - double *tmp=nullptr; + MEDCoupling::DataArrayDouble *coordsArr=0; + double *tmp=0; //! [CppSnippetDataArrayBuild1_0] // //! [CppSnippetDataArrayBuild1_1] @@ -2341,7 +2328,7 @@ void CppSnippetDataArrayBuild1() coordsArr->alloc(nbOfNodes,3); tmp=coordsArr->getPointer(); std::copy(coords,coords+3*nbOfNodes,tmp); - MEDCoupling::DataArrayDouble *coordsArrCpy=nullptr; + MEDCoupling::DataArrayDouble *coordsArrCpy=0; //! [CppSnippetDataArrayBuild1_5] coordsArrCpy=coordsArr->deepCopy(); //! [CppSnippetDataArrayBuild1_5] @@ -2521,7 +2508,7 @@ void CppSnippetFieldDoubleBuild4() //! [CppSnippetFieldDoubleBuild4_1] } -int main(int /*argc*/, char * /*argv*/[]) +int main(int argc, char *argv[]) { CppExample_MEDCouplingFieldDouble_WriteVTK(); CppExample_MEDCouplingFieldDouble_MaxFields(); diff --git a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx index a15be6f09..c487fbe1c 100644 --- a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx @@ -19,10 +19,6 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingRemapperTest.hxx" -#include "InterpolationOptions.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MCType.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" @@ -31,14 +27,9 @@ #include "MEDCouplingRemapper.hxx" #include "MEDCouplingBasicsTest.hxx" -#include "NormalizedGeometricTypes" -#include #include -#include -#include #include -#include using namespace MEDCoupling; @@ -902,12 +893,12 @@ void MEDCouplingRemapperTest::testNatureOfField() void MEDCouplingRemapperTest::testExtruded() { - MEDCouplingUMesh *mesh2DS=nullptr; + MEDCouplingUMesh *mesh2DS=0; MEDCouplingUMesh *mesh3DS=build3DExtrudedUMesh_1(mesh2DS); MEDCouplingMappedExtrudedMesh *extS=MEDCouplingMappedExtrudedMesh::New(mesh3DS,mesh2DS,1); mesh3DS->decrRef(); mesh2DS->decrRef(); - MEDCouplingUMesh *mesh2DT=nullptr; + MEDCouplingUMesh *mesh2DT=0; MEDCouplingUMesh *mesh3DT=build3DExtrudedUMesh_1(mesh2DT); MEDCouplingMappedExtrudedMesh *extT=MEDCouplingMappedExtrudedMesh::New(mesh3DT,mesh2DT,1); // @@ -924,10 +915,10 @@ void MEDCouplingRemapperTest::testExtruded2() MEDCouplingUMesh *meshN,*meshTT,*meshTF; MEDCouplingBasicsTest::build3DExtrudedUMesh_2(meshN,meshTT,meshTF); std::vector n; - double const pt[3]={300.,300.,0.}; - double const v[3]={0.,0.,2.}; + double pt[3]={300.,300.,0.}; + double v[3]={0.,0.,2.}; meshN->findNodesOnPlane(pt,v,1e-12,n); - auto *meshN2D=(MEDCouplingUMesh *)meshN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); + MEDCouplingUMesh *meshN2D=(MEDCouplingUMesh *)meshN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); n.clear(); bool b=false; mcIdType newNbOfNodes; @@ -935,10 +926,10 @@ void MEDCouplingRemapperTest::testExtruded2() CPPUNIT_ASSERT(b); da->decrRef(); meshTT->findNodesOnPlane(pt,v,1e-12,n); - auto *meshTT2D=(MEDCouplingUMesh *)meshTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); + MEDCouplingUMesh *meshTT2D=(MEDCouplingUMesh *)meshTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); n.clear(); meshTF->findNodesOnPlane(pt,v,1e-12,n); - auto *meshTF2D=(MEDCouplingUMesh *)meshTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); + MEDCouplingUMesh *meshTF2D=(MEDCouplingUMesh *)meshTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); n.clear(); // MEDCouplingMappedExtrudedMesh *meshNE=MEDCouplingMappedExtrudedMesh::New(meshN,meshN2D,0); @@ -1028,7 +1019,7 @@ void MEDCouplingRemapperTest::testExtruded2() std::copy(vals2,vals2+meshTTE->getNumberOfCells(),array->getPointer()); array->decrRef(); srcField=remapper.reverseTransferField(trgField,4.220173); - double const expected3[40]={ + double expected3[40]={ 550.,550.,551.,552.,553.,550.,550.,554.,555.,556.,550.,550.,554.,555.,556.,550.,550.,557.,558.,559., 1550.,1550.,1551.,1552.,1553.,1550.,1550.,1554.,1555.,1556.,1550.,1550.,1554.,1555.,1556.,1550.,1550.,1557.,1558.,1559. }; @@ -1070,7 +1061,7 @@ void MEDCouplingRemapperTest::testExtruded2() std::copy(vals3,vals3+meshTFE->getNumberOfCells(),array->getPointer()); array->decrRef(); srcField=remapper.reverseTransferField(trgField,4.220173); - double const expected4[40]={ + double expected4[40]={ 566.,566.,552.5,553.5,554.5,566.,566.,554.5,555.5,556.5,566.,566.,558.5,559.5,560.5,566.,566.,560.5,561.5,562.5, 1566.,1566.,1552.5,1553.5,1554.5,1566.,1566.,1554.5,1555.5,1556.5,1566.,1566.,1558.5,1559.5,1560.5,1566.,1566.,1560.5,1561.5,1562.5 }; diff --git a/src/MEDCoupling/Test/MEDCouplingRemapperTest.hxx b/src/MEDCoupling/Test/MEDCouplingRemapperTest.hxx index 17e99845b..2a13de667 100644 --- a/src/MEDCoupling/Test/MEDCouplingRemapperTest.hxx +++ b/src/MEDCoupling/Test/MEDCouplingRemapperTest.hxx @@ -21,9 +21,10 @@ #ifndef __MEDCOUPLINGREMAPPERTEST_HXX__ #define __MEDCOUPLINGREMAPPERTEST_HXX__ -#include #include +#include +#include namespace MEDCoupling { diff --git a/src/MEDCoupling/Test/TestMEDCoupling.cxx b/src/MEDCoupling/Test/TestMEDCoupling.cxx index 9a72bbbf4..126b7bbd6 100644 --- a/src/MEDCoupling/Test/TestMEDCoupling.cxx +++ b/src/MEDCoupling/Test/TestMEDCoupling.cxx @@ -24,7 +24,6 @@ #include "MEDCouplingBasicsTest4.hxx" #include "MEDCouplingBasicsTest5.hxx" #include "MEDCouplingBasicsTestInterp.hxx" -#include CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::MEDCouplingBasicsTest1 ); CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::MEDCouplingBasicsTest2 ); diff --git a/src/MEDCoupling/Test/TestMEDCouplingRemapper.cxx b/src/MEDCoupling/Test/TestMEDCouplingRemapper.cxx index c8154bca8..bb85125c3 100644 --- a/src/MEDCoupling/Test/TestMEDCouplingRemapper.cxx +++ b/src/MEDCoupling/Test/TestMEDCouplingRemapper.cxx @@ -19,7 +19,6 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingRemapperTest.hxx" -#include CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::MEDCouplingRemapperTest ); diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 1a9534a58..7343254f6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -57,7 +57,6 @@ #include "InterpKernelAutoPtr.hxx" #include "BoxSplittingOptions.hxx" -#include "MEDCouplingNatureOfField.hxx" using namespace MEDCoupling; using namespace INTERP_KERNEL; diff --git a/src/MEDCoupling_Swig/MEDCouplingDataArrayTraits.hxx b/src/MEDCoupling_Swig/MEDCouplingDataArrayTraits.hxx index 2a9179639..0644fd71a 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataArrayTraits.hxx +++ b/src/MEDCoupling_Swig/MEDCouplingDataArrayTraits.hxx @@ -21,8 +21,7 @@ #ifndef __MEDCOUPLINGDATAARRAYTRAITS_HXX__ #define __MEDCOUPLINGDATAARRAYTRAITS_HXX__ -#include "MCType.hxx" -#include "MEDCouplingMemArray.txx" +#include "MEDCouplingMemArray.hxx" #include @@ -71,11 +70,11 @@ struct PyCallBackDataArraySt { MCData *_pt_mc; }; -using PyCallBackDataArrayChar = struct PyCallBackDataArraySt; -using PyCallBackDataArrayInt32 = struct PyCallBackDataArraySt; -using PyCallBackDataArrayInt64 = struct PyCallBackDataArraySt; -using PyCallBackDataArrayFloat = struct PyCallBackDataArraySt; -using PyCallBackDataArrayDouble = struct PyCallBackDataArraySt; +typedef struct PyCallBackDataArraySt PyCallBackDataArrayChar; +typedef struct PyCallBackDataArraySt PyCallBackDataArrayInt32; +typedef struct PyCallBackDataArraySt PyCallBackDataArrayInt64; +typedef struct PyCallBackDataArraySt PyCallBackDataArrayFloat; +typedef struct PyCallBackDataArraySt PyCallBackDataArrayDouble; extern "C" { @@ -83,31 +82,31 @@ extern "C" static PyObject *callbackmcdataarraychar___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - auto *self = (PyCallBackDataArrayChar *) ( type->tp_alloc(type, 0) ); + PyCallBackDataArrayChar *self = (PyCallBackDataArrayChar *) ( type->tp_alloc(type, 0) ); return (PyObject *)self; } static PyObject *callbackmcdataarrayint32___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - auto *self = (PyCallBackDataArrayInt32 *) ( type->tp_alloc(type, 0) ); + PyCallBackDataArrayInt32 *self = (PyCallBackDataArrayInt32 *) ( type->tp_alloc(type, 0) ); return (PyObject *)self; } static PyObject *callbackmcdataarrayint64___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - auto *self = (PyCallBackDataArrayInt64 *) ( type->tp_alloc(type, 0) ); + PyCallBackDataArrayInt64 *self = (PyCallBackDataArrayInt64 *) ( type->tp_alloc(type, 0) ); return (PyObject *)self; } static PyObject *callbackmcdataarrayfloat___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - auto *self = (PyCallBackDataArrayFloat *) ( type->tp_alloc(type, 0) ); + PyCallBackDataArrayFloat *self = (PyCallBackDataArrayFloat *) ( type->tp_alloc(type, 0) ); return (PyObject *)self; } static PyObject *callbackmcdataarraydouble___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - auto *self = (PyCallBackDataArrayDouble *) ( type->tp_alloc(type, 0) ); + PyCallBackDataArrayDouble *self = (PyCallBackDataArrayDouble *) ( type->tp_alloc(type, 0) ); return (PyObject *)self; } diff --git a/src/MEDLoader/MEDFileBasis.cxx b/src/MEDLoader/MEDFileBasis.cxx index 70dc4e82b..b421a5a07 100644 --- a/src/MEDLoader/MEDFileBasis.cxx +++ b/src/MEDLoader/MEDFileBasis.cxx @@ -20,9 +20,7 @@ #include "MEDFileBasis.hxx" -#include #include -#include using namespace MEDCoupling; diff --git a/src/MEDLoader/MEDFileBasis.hxx b/src/MEDLoader/MEDFileBasis.hxx index bca01e897..f92907503 100644 --- a/src/MEDLoader/MEDFileBasis.hxx +++ b/src/MEDLoader/MEDFileBasis.hxx @@ -21,10 +21,9 @@ #ifndef __MEDFILEBASIS_HXX__ #define __MEDFILEBASIS_HXX__ -#include "MCAuto.hxx" +#include "InterpKernelException.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingTraits.hxx" -#include "MEDCouplingRefCountObject.hxx" +#include "MEDCouplingMemArray.txx" #include #include diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index 6faa24af8..3e87d2004 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -19,38 +19,11 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileBlowStrEltUp.hxx" -#include "MCAuto.hxx" -#include "MCAuto.txx" -#include "MCType.hxx" -#include "MEDCoupling1GTUMesh.hxx" -#include "MCIdType.hxx" -#include "InterpKernelAutoPtr.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDFileField.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MEDFileFieldMultiTS.hxx" -#include "MEDFileField1TS.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDFileFieldGlobs.hxx" -#include "MEDFileFieldInternal.hxx" #include "MEDFileFieldVisitor.hxx" #include "MEDCouplingPartDefinition.hxx" -#include "MEDFileMesh.hxx" -#include "MEDFileStructureElement.hxx" -#include -#include -#include "MEDFileMeshLL.hxx" -#include "MEDFileMeshElt.hxx" -#include "NormalizedGeometricTypes" -#include -#include -#include +#include "MCAuto.txx" #include -#include -#include -#include -#include using namespace MEDCoupling; @@ -63,12 +36,12 @@ MEDFileBlowStrEltUp::MEDFileBlowStrEltUp(const MEDFileFields *fsOnlyOnSE, const _ms.takeRef(ms); _ses.takeRef(ses); std::vector< std::pair > ps; fsOnlyOnSE->getMeshSENames(ps); - std::size_t const sz(ps.size()); + std::size_t sz(ps.size()); _elts.resize(sz); for(std::size_t i=0;i& p(ps[i]); - MCAuto const f(fsOnlyOnSE->partOfThisLyingOnSpecifiedMeshSEName(p.first,p.second)); + MCAuto f(fsOnlyOnSE->partOfThisLyingOnSpecifiedMeshSEName(p.first,p.second)); _elts[i]=f; } for(std::size_t i=0;igetMeshWithName(p.first)); if(!mesh) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp : NULL mesh !"); - auto *umesh(dynamic_cast(mesh)); + MEDFileUMesh *umesh(dynamic_cast(mesh)); if(!umesh) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp : Blow up of Stru Elt not managed yet for unstructured meshes !"); } @@ -94,7 +67,7 @@ MCAuto MEDFileBlowStrEltUp::dealWithSEInMesh(const std::s throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithSEInMesh : null pointer !"); if(seName==MED_BALL_STR) { - MCAuto const ret(dealWithMEDBALLInMesh(mesh,mOut,fsOut)); + MCAuto ret(dealWithMEDBALLInMesh(mesh,mOut,fsOut)); mesh->killStructureElements(); return ret; } @@ -106,11 +79,11 @@ MCAuto MEDFileBlowStrEltUp::dealWithMEDBALLInMesh(const M mOut=MEDFileUMesh::New(); fsOut=MEDFileFields::New(); const std::vector< MCAuto >& strs(mesh->getAccessOfUndergroundEltStrs()); MCAuto zeStr; - for(const auto & str : strs) + for(std::vector< MCAuto >::const_iterator it=strs.begin();it!=strs.end();it++) { - if(str->getGeoTypeName()==MED_BALL_STR) + if((*it)->getGeoTypeName()==MED_BALL_STR) { - zeStr=str; + zeStr=*it; break; } } @@ -153,13 +126,13 @@ MCAuto MEDFileBlowStrEltUp::dealWithMEDBALLInMesh(const M mOut->setRenumFieldArr(0,const_cast(nf0)); mOut->copyFamGrpMapsFrom(*mesh); const std::vector< MCAuto >& vars(zeStr->getVars()); - for(const auto & var : vars) + for(std::vector< MCAuto >::const_iterator it=vars.begin();it!=vars.end();it++) { - const DataArray *elt(var); + const DataArray *elt(*it); if(!elt) continue; { - const auto *eltC(dynamic_cast(elt)); + const DataArrayDouble *eltC(dynamic_cast(elt)); if(eltC) { MCAuto fmts(MEDFileFieldMultiTS::New()); @@ -195,9 +168,9 @@ void MEDFileBlowStrEltUp::dealWithSEInFields(const std::string& seName, const ME throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithSEInFields : only MED_BALL is managed for the moment, but if you are interested please send spec to anthony.geay@edf.fr !"); } -void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, const MEDFileEltStruct4Mesh * /*zeStr*/, const MEDFileFields *varAtt, MEDFileFields *zeOutputs) const +void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, const MEDFileEltStruct4Mesh *zeStr, const MEDFileFields *varAtt, MEDFileFields *zeOutputs) const { - int const nbf(fs->getNumberOfFields()); + int nbf(fs->getNumberOfFields()); std::vector< MCAuto > elts0; std::vector< MEDFileAnyTypeFieldMultiTS * > elts1; std::string zeMeshName; @@ -205,12 +178,12 @@ void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, cons { MCAuto elt(fs->getFieldAtPos(i)); MCAuto eltOut(elt->buildNewEmpty()); - int const nbTS(elt->getNumberOfTS()); + int nbTS(elt->getNumberOfTS()); for(int j=0;j eltt(elt->getTimeStepAtPos(j)); MCAuto elttOut(eltt->deepCopy()); - std::string const meshName(eltt->getMeshName()); + std::string meshName(eltt->getMeshName()); zeMeshName=BuildNewMeshName(meshName,MED_BALL_STR); elttOut->setMeshName(zeMeshName); elttOut->convertMedBallIntoClassic(); @@ -230,8 +203,8 @@ void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, cons std::size_t jj(0); for(std::vector< std::vector >::const_iterator it1=sp2.begin();it1!=sp2.end();it1++,jj++) { - for(auto it2 : *it1) - zeOutputs->pushField(it2); + for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) + zeOutputs->pushField(*it2); // The most exciting part. Users that put profiles on struct elements part of fields. Reduce var att. if((*it1).size()<1) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : take a deep breath !"); @@ -239,7 +212,7 @@ void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, cons { if(!(*it1)[0]) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : take a deep breath 2 !"); - int const pdm((*it1)[0]->getNumberOfTS()); + int pdm((*it1)[0]->getNumberOfTS()); if(pdm<1) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : take a deep breath 3 !"); zeGuideForPfl=(*it1)[0]->getTimeStepAtPos(0); @@ -255,12 +228,12 @@ void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, cons // Yeah we have pfls std::vector t2s; std::vector< std::pair > t1s((*it1)[0]->getTimeSteps(t2s)); - std::size_t const nbTS3(t2s.size()); - int const nbf2(varAtt->getNumberOfFields()); + std::size_t nbTS3(t2s.size()); + int nbf2(varAtt->getNumberOfFields()); for(int i=0;i elt(varAtt->getFieldAtPos(i)); - int const nbTS2(elt->getNumberOfTS()); + int nbTS2(elt->getNumberOfTS()); if(nbTS2!=1) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : internal error ! The dealWithMEDBALLInMesh is expected to return a single TS !"); MCAuto elt2(elt->getTimeStepAtPos(0)); @@ -282,20 +255,20 @@ void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, cons void MEDFileBlowStrEltUp::generate(MEDFileMeshes *msOut, MEDFileFields *allZeOutFields) { - for(auto & _elt : _elts) + for(std::vector< MCAuto >::iterator elt=_elts.begin();elt!=_elts.end();elt++) { std::vector< std::pair > ps; - _elt->getMeshSENames(ps); + (*elt)->getMeshSENames(ps); if(ps.size()!=1) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::generateMeshes : internal error !"); MEDFileMesh *mesh(_ms->getMeshWithName(ps[0].first)); if(!mesh) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::generateMeshes : NULL mesh !"); - auto *umesh(dynamic_cast(mesh)); + MEDFileUMesh *umesh(dynamic_cast(mesh)); if(!umesh) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::generateMeshes : Blow up of Stru Elt not managed yet for unstructured meshes !"); // - MCAuto classicalSEFields(splitFieldsPerLoc(_elt,umesh,msOut,allZeOutFields)); + MCAuto classicalSEFields(splitFieldsPerLoc(*elt,umesh,msOut,allZeOutFields)); if(classicalSEFields.isNotNull()) { MCAuto mOut; @@ -356,7 +329,7 @@ private: class LocInfo { public: - LocInfo() = default; + LocInfo() { } LocInfo(const std::vector& fw); bool operator==(const LocInfo& other) const { return _locs==other._locs && _pfl==other._pfl; } void push(const std::string& loc, const std::string& pfl) { checkUniqueLoc(loc); _locs.push_back(loc); _pfl.push_back(pfl); } @@ -392,7 +365,7 @@ const char LocInfo::EPAISSEUR[]="EPAISSEUR"; LocInfo::LocInfo(const std::vector& fw) { - std::size_t const sz(fw.size()); + std::size_t sz(fw.size()); _locs.resize(sz); _pfl.resize(sz); _cts.resize(sz); if(sz>0) _pd=fw[0].getPartDef()->deepCopy(); @@ -415,7 +388,7 @@ void LocInfo::checkUniqueLoc(const std::string& loc) const } } -MCAuto LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh * /*section*/, const MEDFileFieldGlobsReal *globs, MCAuto& ptsForLoc) +MCAuto LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs, MCAuto& ptsForLoc) { MCAuto conn(zeStr->getConn()); conn=conn->deepCopy(); conn->rearrange(1); @@ -457,12 +430,12 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali // MCAuto dir(geoMesh->buildDirectionVectorField()); MCAuto rot(dir->getArray()->fromCartToSpher()); - std::size_t const nbCompo(ptsForLoc->getNumberOfComponents()); + std::size_t nbCompo(ptsForLoc->getNumberOfComponents()); MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); mcIdType nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size())); { const int TAB[3]={2,0,1}; - std::vector const v(TAB,TAB+3); + std::vector v(TAB,TAB+3); secPts=secPts->keepSelectedComponents(v); } const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.}; @@ -471,10 +444,10 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali for(int j=0;j p(secPts->deepCopy()); - double const ang0(rot->getIJ(j,2)); + double ang0(rot->getIJ(j,2)); DataArrayDouble::Rotate3DAlg(CENTER,AX0,ang0,nbSecPts,p->begin(),p->getPointer()); AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ - double const ang1(M_PI/2.-rot->getIJ(j,1)); + double ang1(M_PI/2.-rot->getIJ(j,1)); DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer()); DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,angleVrille->getIJ(j,0),nbSecPts,p->begin(),p->getPointer()); for(int l=0;l LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali } } std::vector arrs2(VecAutoToVecOfCstPt(arrs)); - MCAuto const resu(DataArrayDouble::Aggregate(arrs2)); + MCAuto resu(DataArrayDouble::Aggregate(arrs2)); return resu; } @@ -508,7 +481,7 @@ MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::Normalize MCAuto ortho(geoMesh->buildOrthogonalField()); orthoArr.takeRef(ortho->getArray()); } - mcIdType const nbCompo(ToIdType(orthoArr->getNumberOfComponents())); + mcIdType nbCompo(ToIdType(orthoArr->getNumberOfComponents())); MCAuto secPts(section->getCoords()->duplicateEachTupleNTimes(nbCompo)); secPts->rearrange(nbCompo); std::vector< MCAuto > arrs(nbCells*nbg); @@ -531,7 +504,7 @@ MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::Normalize } } std::vector arrs2(VecAutoToVecOfCstPt(arrs)); - MCAuto const resu(DataArrayDouble::Aggregate(arrs2)); + MCAuto resu(DataArrayDouble::Aggregate(arrs2)); return resu; } @@ -562,11 +535,11 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, dir=geoMesh2->buildDirectionVectorField(); } MCAuto rot(dir->getArray()->fromCartToSpher()); - std::size_t const nbCompo(ptsForLoc->getNumberOfComponents()); + std::size_t nbCompo(ptsForLoc->getNumberOfComponents()); MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); { const int TAB[3]={2,0,1}; - std::vector const v(TAB,TAB+3); + std::vector v(TAB,TAB+3); secPts=secPts->keepSelectedComponents(v); } const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.}; @@ -576,7 +549,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, { constexpr int DIM=3; MCAuto p(secPts->deepCopy()); - double const ang0(rot->getIJ(j,2)); + double ang0(rot->getIJ(j,2)); double rmin(zeScale->getIJ(j,0)),rmax(zeScale->getIJ(j,1)); { auto pt(p->rwBegin()); @@ -590,7 +563,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, } DataArrayDouble::Rotate3DAlg(CENTER,AX0,ang0,nbSecPts,p->begin(),p->getPointer()); AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ - double const ang1(M_PI/2.-rot->getIJ(j,1)); + double ang1(M_PI/2.-rot->getIJ(j,1)); DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer()); for(int l=0;l<3;l++) { @@ -603,7 +576,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, } } std::vector arrs2(VecAutoToVecOfCstPt(arrs)); - MCAuto const resu(DataArrayDouble::Aggregate(arrs2)); + MCAuto resu(DataArrayDouble::Aggregate(arrs2)); return resu; } @@ -634,11 +607,11 @@ MCAuto LocInfo::BuildMeshPipeSEG4(const DataArrayDouble *angle, dir=geoMesh2->buildDirectionVectorField(); } MCAuto rot(dir->getArray()->fromCartToSpher()); - std::size_t const nbCompo(ptsForLoc->getNumberOfComponents()); + std::size_t nbCompo(ptsForLoc->getNumberOfComponents()); MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); { const int TAB[3]={2,0,1}; - std::vector const v(TAB,TAB+3); + std::vector v(TAB,TAB+3); secPts=secPts->keepSelectedComponents(v); } const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.}; @@ -648,7 +621,7 @@ MCAuto LocInfo::BuildMeshPipeSEG4(const DataArrayDouble *angle, { constexpr int DIM=3; MCAuto p(secPts->deepCopy()); - double const ang0(rot->getIJ(j,2)); + double ang0(rot->getIJ(j,2)); double rmin(zeScale->getIJ(j,0)),rmax(zeScale->getIJ(j,1)); { auto pt(p->rwBegin()); @@ -662,7 +635,7 @@ MCAuto LocInfo::BuildMeshPipeSEG4(const DataArrayDouble *angle, } DataArrayDouble::Rotate3DAlg(CENTER,AX0,ang0,nbSecPts,p->begin(),p->getPointer()); AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ - double const ang1(M_PI/2.-rot->getIJ(j,1)); + double ang1(M_PI/2.-rot->getIJ(j,1)); DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer()); for(int l=0;l<3;l++) { @@ -675,7 +648,7 @@ MCAuto LocInfo::BuildMeshPipeSEG4(const DataArrayDouble *angle, } } std::vector arrs2(VecAutoToVecOfCstPt(arrs)); - MCAuto const resu(DataArrayDouble::Aggregate(arrs2)); + MCAuto resu(DataArrayDouble::Aggregate(arrs2)); return resu; } @@ -739,13 +712,13 @@ MCAuto LocInfo::generateNonClassicalData(int zePos, const MEDFileU { const MEDFileFieldLoc& loc(globs->getLocalization(_locs[i])); const MEDFileGTKeeper *gtk(loc.getUndergroundGTKeeper()); - const auto *gtk2(dynamic_cast(gtk)); + const MEDFileGTKeeperDyn *gtk2(dynamic_cast(gtk)); if(!gtk2) throw INTERP_KERNEL::Exception("LocInfo::generateNonClassicalData : internal error !"); const MEDFileUMesh *meshLoc(gtk2->getMesh()),*section(gtk2->getSection()); const MEDFileStructureElement *se(gtk2->getSE()); MCAuto um(meshLoc->getMeshAtLevel(0)); - INTERP_KERNEL::NormalizedCellType const gt(_cts[i]); + INTERP_KERNEL::NormalizedCellType gt(_cts[i]); { std::vector nel(meshLoc->getNonEmptyLevels()); if(nel.size()!=1) @@ -760,18 +733,18 @@ MCAuto LocInfo::generateNonClassicalData(int zePos, const MEDFileU throw INTERP_KERNEL::Exception(MSG1); std::vector v; um->getNodeIdsOfCell(zePos,v); - std::size_t const sz2(v.size()); + std::size_t sz2(v.size()); for(std::size_t j=0;j >& strs(mesh->getAccessOfUndergroundEltStrs()); MCAuto zeStr; - for(const auto & str : strs) + for(std::vector< MCAuto >::const_iterator it=strs.begin();it!=strs.end();it++) { - if(str->getGeoTypeName()==se->getName()) + if((*it)->getGeoTypeName()==se->getName()) { - zeStr=str; + zeStr=*it; break; } } @@ -812,14 +785,14 @@ bool FieldWalker2::operator==(const FieldWalker2& other) const std::string tmp; ret2=_pd->isEqual(other._pd,tmp); } - bool const ret(_loc==other._loc && _pfl==other._pfl && _is_classic==other._is_classic && ret2); + bool ret(_loc==other._loc && _pfl==other._pfl && _is_classic==other._is_classic && ret2); return ret; } class FieldWalker1 { public: - FieldWalker1(const MEDFileAnyTypeField1TSWithoutSDA *ts):_ts(ts) { } + FieldWalker1(const MEDFileAnyTypeField1TSWithoutSDA *ts):_ts(ts),_pm_pt(0),_nb_mesh(0) { } void newMeshEntry(const MEDFileFieldPerMesh *fpm); void endMeshEntry(const MEDFileFieldPerMesh *fpm) { } void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); @@ -830,12 +803,12 @@ public: std::vector getNonClassicalData() const { return _fw; } private: const MEDFileAnyTypeField1TSWithoutSDA *_ts; - const MEDFileFieldPerMeshPerTypeDyn *_pm_pt{nullptr}; + const MEDFileFieldPerMeshPerTypeDyn *_pm_pt; std::vector _fw; - int _nb_mesh{0}; + int _nb_mesh; }; -void FieldWalker1::newMeshEntry(const MEDFileFieldPerMesh * /*fpm*/) +void FieldWalker1::newMeshEntry(const MEDFileFieldPerMesh *fpm) { if(_nb_mesh++==1) throw INTERP_KERNEL::Exception("FieldWalker1::newMeshEntry : multi mesh not supported !"); @@ -845,7 +818,7 @@ void FieldWalker1::newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon { if(_pm_pt) throw INTERP_KERNEL::Exception("FieldWalker1::newPerMeshPerTypeEntry : multi SE loc not managed yet !"); - const auto *pmpt2(dynamic_cast(pmpt)); + const MEDFileFieldPerMeshPerTypeDyn *pmpt2(dynamic_cast(pmpt)); if(!pmpt2) throw INTERP_KERNEL::Exception("newPerMeshPerTypeEntry : internal error !"); _pm_pt=pmpt2; @@ -863,7 +836,7 @@ void FieldWalker1::newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerD void FieldWalker1::checkOK(const FieldWalker1& other) const { - std::size_t const sz(_fw.size()); + std::size_t sz(_fw.size()); if(other._fw.size()!=sz) throw INTERP_KERNEL::Exception("checkOK : not OK because size are not the same !"); for(std::size_t i=0;i::const_iterator it=_fw.begin();it!=_fw.end();it++) { - if(it.isClassic()) + if((*it).isClassic()) ic++; else inc++; @@ -925,13 +898,13 @@ void FieldWalker::newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) _fw=new FieldWalker1(ts); } -void FieldWalker::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA * /*ts*/) +void FieldWalker::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) { if(_fw_prev.isNull()) _fw_prev=new FieldWalker1(*_fw); else _fw_prev->checkOK(*_fw); - _fw=nullptr; + _fw=0; } void FieldWalker::newMeshEntry(const MEDFileFieldPerMesh *fpm) @@ -963,23 +936,23 @@ void FieldWalker::newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDi class LocSpliter : public MEDFileFieldVisitor { public: - LocSpliter(const MEDFileFieldGlobsReal *globs):_globs(globs),_fw(nullptr) { } + LocSpliter(const MEDFileFieldGlobsReal *globs):_globs(globs),_fw(0) { } MCAuto getClassical() const { return _classical; } void generateNonClassicalData(const MEDFileUMesh *mesh, std::vector< MCAuto >& outFields, std::vector< MCAuto >& outMeshes) const; private: - void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) override; - void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) override; + void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field); + void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field); // - void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) override; - void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) override; + void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts); + void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts); // - void newMeshEntry(const MEDFileFieldPerMesh *fpm) override; - void endMeshEntry(const MEDFileFieldPerMesh *fpm) override; + void newMeshEntry(const MEDFileFieldPerMesh *fpm); + void endMeshEntry(const MEDFileFieldPerMesh *fpm); // - void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) override; - void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) override; + void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); + void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); // - void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) override; + void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); private: const MEDFileFieldGlobsReal *_globs; std::vector< LocInfo > _locs; @@ -1010,9 +983,9 @@ void LocSpliter::endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field } else { - std::vector const fw2(_fw->getNonClassicalData()); - LocInfo const elt(fw2); - auto const it(std::find(_locs.begin(),_locs.end(),elt)); + std::vector fw2(_fw->getNonClassicalData()); + LocInfo elt(fw2); + std::vector< LocInfo >::iterator it(std::find(_locs.begin(),_locs.end(),elt)); if(it==_locs.end()) { _locs.push_back(elt); @@ -1032,7 +1005,7 @@ void LocSpliter::endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field void LocSpliter::generateNonClassicalData(const MEDFileUMesh *mesh, std::vector< MCAuto >& outFields, std::vector< MCAuto >& outMeshes) const { int i(0); - for(auto it=_locs.begin();it!=_locs.end();it++,i++) + for(std::vector::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) { MCAuto m((*it).generateNonClassicalData(i,mesh,_globs)); outMeshes.push_back(m); @@ -1050,7 +1023,7 @@ void LocSpliter::generateNonClassicalData(const MEDFileUMesh *mesh, std::vector< MCAuto outF1t(MEDFileField1TS::New()); MCAuto f1ts(fmts->getTimeStepAtPos(k)); int t2,t3; - double const t1(f1ts->getTime(t2,t3)); + double t1(f1ts->getTime(t2,t3)); MCAuto mcf(MEDCouplingFieldDouble::New(ON_NODES)); MCAuto arr,arr2; arr.takeRef(f1ts->getUndergroundDataArray()); @@ -1127,16 +1100,16 @@ MCAuto MEDFileBlowStrEltUp::splitFieldsPerLoc(const MEDFileFields std::vector< MCAuto > outFields; std::vector< MCAuto > outMeshes; ls.generateNonClassicalData(mesh,outFields,outMeshes); - for(auto & outField : outFields) + for(std::vector< MCAuto >::iterator it=outFields.begin();it!=outFields.end();it++) { - for(int j=0;jgetNumberOfFields();j++) + for(int j=0;j<(*it)->getNumberOfFields();j++) { - MCAuto fmts(outField->getFieldAtPos(j)); + MCAuto fmts((*it)->getFieldAtPos(j)); //DealWithConflictNames(fmts,allZeOutFields);// uncomment to have a writable data structure allZeOutFields->pushField(fmts); } } - for(auto & outMeshe : outMeshes) - msOut->pushMesh(outMeshe); + for(std::vector< MCAuto >::iterator it=outMeshes.begin();it!=outMeshes.end();it++) + msOut->pushMesh(*it); return ls.getClassical(); } diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.hxx b/src/MEDLoader/MEDFileBlowStrEltUp.hxx index 4e7a262e1..1043d56d9 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.hxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.hxx @@ -21,16 +21,13 @@ #ifndef __MEDFILEBLOWSTRELTUP_HXX__ #define __MEDFILEBLOWSTRELTUP_HXX__ -#include "MCAuto.hxx" -#include "MEDFileMeshLL.hxx" -#include "MEDFileFieldMultiTS.hxx" +#include "MEDLoaderDefines.hxx" +#include "MEDFileUtilities.txx" #include "MEDFileMesh.hxx" #include "MEDFileField.hxx" #include "MEDFileStructureElement.hxx" -#include -#include -#include +#include "MEDCouplingRefCountObject.hxx" namespace MEDCoupling { diff --git a/src/MEDLoader/MEDFileData.cxx b/src/MEDLoader/MEDFileData.cxx index bc9b90caa..87a09baa5 100644 --- a/src/MEDLoader/MEDFileData.cxx +++ b/src/MEDLoader/MEDFileData.cxx @@ -19,36 +19,17 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDFileData.hxx" -#include "MEDFileUtilities.hxx" -#include "MCAuto.hxx" -#include "MEDFileField.hxx" -#include "MEDFileMesh.hxx" -#include "MEDFileParameter.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDFileMeshSupport.hxx" -#include "MEDFileStructureElement.hxx" -#include "MCType.hxx" -#include "MEDFileFieldMultiTS.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileSafeCaller.txx" #include "MEDFileBlowStrEltUp.hxx" #include "InterpKernelAutoPtr.hxx" -#include -#include "med.h" -#include -#include -#include -#include -#include -#include -#include "medfile.h" using namespace MEDCoupling; MEDFileData *MEDFileData::New(const std::string& fileName) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid); } @@ -203,7 +184,7 @@ bool MEDFileData::changeMeshNames(const std::vector< std::pair > v(1); v[0].first=oldName; v[0].second=newMeshName; return changeMeshNames(v); @@ -231,8 +212,8 @@ bool MEDFileData::unPolyzeMeshes() if(m) { std::vector oldCode,newCode; - DataArrayIdType *o2nRenumCell=nullptr; - bool const modif=m->unPolyze(oldCode,newCode,o2nRenumCell); + DataArrayIdType *o2nRenumCell=0; + bool modif=m->unPolyze(oldCode,newCode,o2nRenumCell); if(!modif) continue; renumParamsOfMeshImpacted.push_back(o2nRenumCell); memSaverIfThrow.push_back(o2nRenumCell); @@ -272,7 +253,7 @@ MCAuto MEDFileData::Aggregate(const std::vector ret(MEDFileData::New()); std::vector ms(sz); std::vector< std::vector< std::pair > > dts(sz); - for(auto it=mfds.begin();it!=mfds.end();it++,i++) + for(std::vector::const_iterator it=mfds.begin();it!=mfds.end();it++,i++) { const MEDFileData *elt(*it); if(!elt) @@ -285,7 +266,7 @@ MCAuto MEDFileData::Aggregate(const std::vectorgetMeshAtPos(0)); if(!mesh) throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : presence of null mesh in a MEDFileData instance among input vector !"); - const auto *umesh(dynamic_cast(mesh)); + const MEDFileUMesh *umesh(dynamic_cast(mesh)); if(!umesh) throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : works only for unstructured meshes !"); ms[i]=umesh; @@ -296,22 +277,22 @@ MCAuto MEDFileData::Aggregate(const std::vectorsetMeshes(mss); // fields std::vector fieldNames(mfds[0]->getFields()->getFieldsNames()); - std::set const fieldNamess(fieldNames.begin(),fieldNames.end()); + std::set fieldNamess(fieldNames.begin(),fieldNames.end()); if(fieldNames.size()!=fieldNamess.size()) throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : field names must be different each other !"); std::vector< std::vector > vectOfFields(fieldNames.size()); std::vector< std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > > vectOfFields2(fieldNames.size()); MCAuto fss(MEDFileFields::New()); - for(auto mfd : mfds) + for(std::vector::const_iterator it=mfds.begin();it!=mfds.end();it++) { - std::vector fieldNames0(mfd->getFields()->getFieldsNames()); - std::set const fieldNamess0(fieldNames0.begin(),fieldNames0.end()); + std::vector fieldNames0((*it)->getFields()->getFieldsNames()); + std::set fieldNamess0(fieldNames0.begin(),fieldNames0.end()); if(fieldNamess!=fieldNamess0) throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : field names must be the same for all input instances !"); i=0; for(std::vector::const_iterator it1=fieldNames.begin();it1!=fieldNames.end();it1++,i++) { - MCAuto fmts(mfd->getFields()->getFieldWithName(*it1)); + MCAuto fmts((*it)->getFields()->getFieldWithName(*it1)); if(fmts.isNull()) throw INTERP_KERNEL::Exception("MEDFileData::Aggregate : internal error 1 !"); vectOfFields2[i].push_back(fmts); vectOfFields[i].push_back(fmts); @@ -329,7 +310,8 @@ MCAuto MEDFileData::Aggregate(const std::vector header(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); - int const ret(MEDfileCommentRd(fid,header)); + int ret(MEDfileCommentRd(fid,header)); if(ret==0) _header=MEDLoaderBase::buildStringFromFortran(header,MED_COMMENT_SIZE); } diff --git a/src/MEDLoader/MEDFileData.hxx b/src/MEDLoader/MEDFileData.hxx index 08f180fed..200a2b4a6 100644 --- a/src/MEDLoader/MEDFileData.hxx +++ b/src/MEDLoader/MEDFileData.hxx @@ -22,20 +22,11 @@ #define __MEDFILEDATA_HXX__ #include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDFileParameter.hxx" #include "MEDFileField.hxx" #include "MEDFileMesh.hxx" #include "MEDFileMeshSupport.hxx" #include "MEDFileStructureElement.hxx" -#include "MEDFileUtilities.txx" -#include "MEDLoaderDefines.hxx" -#include -#include "med.h" -#include -#include -#include namespace MEDCoupling { @@ -51,8 +42,8 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileData *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileData"); } MEDLOADER_EXPORT MEDFileData *deepCopy() const; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileFields *getFields() const; MEDLOADER_EXPORT MEDFileMeshes *getMeshes() const; MEDLOADER_EXPORT MEDFileParameters *getParams() const; @@ -73,7 +64,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void dealWithStructureElements(); MEDLOADER_EXPORT static MCAuto Aggregate(const std::vector& mfds); // - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; private: MEDFileData(); MEDFileData(med_idt fid); diff --git a/src/MEDLoader/MEDFileEntities.cxx b/src/MEDLoader/MEDFileEntities.cxx index 8a42e01a9..97865a24a 100644 --- a/src/MEDLoader/MEDFileEntities.cxx +++ b/src/MEDLoader/MEDFileEntities.cxx @@ -19,13 +19,6 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileEntities.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDFileStructureElement.hxx" -#include "MEDFileMesh.hxx" -#include "NormalizedGeometricTypes" -#include -#include -#include using namespace MEDCoupling; @@ -46,7 +39,8 @@ MEDFileEntities *MEDFileEntities::BuildFrom(const MEDFileStructureElements& se) } MEDFileEntities::~MEDFileEntities() -= default; +{ +} ////////////// diff --git a/src/MEDLoader/MEDFileEntities.hxx b/src/MEDLoader/MEDFileEntities.hxx index bc65ea0c5..b9ac6350f 100644 --- a/src/MEDLoader/MEDFileEntities.hxx +++ b/src/MEDLoader/MEDFileEntities.hxx @@ -21,16 +21,12 @@ #ifndef __MEDFILEENTITIES_HXX__ #define __MEDFILEENTITIES_HXX__ -#include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDLoaderDefines.hxx" #include "MEDFileStructureElement.hxx" -#include "NormalizedGeometricTypes" -#include -#include -#include +#include "MEDCouplingRefCountObject.hxx" +#include "NormalizedGeometricTypes" namespace MEDCoupling { @@ -50,8 +46,8 @@ namespace MEDCoupling public: MEDFileStaticEntities(const std::vector< std::pair >& entities):_entities(entities) { } const std::vector< std::pair >& getEntries() const { return _entities; } - std::vector getDynGTAvail() const override; - bool areAllStaticTypesPresent() const override; + std::vector getDynGTAvail() const; + bool areAllStaticTypesPresent() const; bool areAllStaticPresentAndNoDyn() const override; private: std::vector< std::pair > _entities; @@ -60,9 +56,9 @@ namespace MEDCoupling class MEDLOADER_EXPORT MEDFileAllStaticEntites : public MEDFileEntities { public: - MEDFileAllStaticEntites() = default; - std::vector getDynGTAvail() const override; - bool areAllStaticTypesPresent() const override; + MEDFileAllStaticEntites() { } + std::vector getDynGTAvail() const; + bool areAllStaticTypesPresent() const; bool areAllStaticPresentAndNoDyn() const override; }; @@ -70,8 +66,8 @@ namespace MEDCoupling { public: MEDFileAllStaticEntitiesPlusDyn(const MEDFileStructureElements *se); - std::vector getDynGTAvail() const override; - bool areAllStaticTypesPresent() const override; + std::vector getDynGTAvail() const; + bool areAllStaticTypesPresent() const; bool areAllStaticPresentAndNoDyn() const override; const MEDFileStructureElement *getWithGT(int idGT) const; const MEDFileUMesh *getSupMeshWithName(const std::string& name) const; diff --git a/src/MEDLoader/MEDFileEquivalence.cxx b/src/MEDLoader/MEDFileEquivalence.cxx index 2a07c1d55..462e0d812 100644 --- a/src/MEDLoader/MEDFileEquivalence.cxx +++ b/src/MEDLoader/MEDFileEquivalence.cxx @@ -19,25 +19,12 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileEquivalence.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDFileBasis.hxx" -#include "CellModel.hxx" -#include "MCType.hxx" #include "MEDFileSafeCaller.txx" +#include "MEDCouplingMemArray.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDLoaderBase.hxx" #include "MEDFileMesh.hxx" #include "InterpKernelAutoPtr.hxx" -#include "med.h" -#include "NormalizedGeometricTypes" -#include -#include "medequivalence.h" -#include -#include -#include -#include -#include -#include // From MEDLOader.cxx TU extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO]; @@ -58,7 +45,7 @@ MEDFileEquivalencePair *MEDFileEquivalencePair::Load(MEDFileEquivalences *father void MEDFileEquivalencePair::writeLL(med_idt fid) const { - std::string const meshName(getFather()->getMeshName()); + std::string meshName(getFather()->getMeshName()); INTERP_KERNEL::AutoPtr meshName2(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr desc(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); @@ -172,7 +159,7 @@ void MEDFileEquivalencePair::setArray(int meshDimRelToMaxExt, DataArrayInt *da) MEDFileEquivalenceNode *node(_node); if(!node) { - _node=new MEDFileEquivalenceNode(this,nullptr); + _node=new MEDFileEquivalenceNode(this,0); node=_node; } node->setArray(da); @@ -203,7 +190,7 @@ MEDFileEquivalenceCell *MEDFileEquivalencePair::initCell() */ MEDFileEquivalenceNode *MEDFileEquivalencePair::initNode() { - _node=new MEDFileEquivalenceNode(this,nullptr); + _node=new MEDFileEquivalenceNode(this,0); return _node; } @@ -214,7 +201,7 @@ std::size_t MEDFileEquivalencePair::getHeapMemorySizeWithoutChildren() const void MEDFileEquivalencePair::load(med_idt fid) { - std::string const meshName(_father->getMeshName()); + std::string meshName(_father->getMeshName()); int dt,it; _father->getDtIt(dt,it); med_int ncor; @@ -226,7 +213,7 @@ void MEDFileEquivalencePair::load(med_idt fid) MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,da->getPointer())); da->applyLin(1,-1); da->rearrange(2); - MCAuto const node(new MEDFileEquivalenceNode(this,FromMedIntArray(da))); + MCAuto node(new MEDFileEquivalenceNode(this,FromMedIntArray(da))); _node=node; } _cell=MEDFileEquivalenceCell::Load(fid,this); @@ -234,7 +221,7 @@ void MEDFileEquivalencePair::load(med_idt fid) std::vector MEDFileEquivalences::getDirectChildrenWithNull() const { - std::size_t const sz(_equ.size()); + std::size_t sz(_equ.size()); std::vector ret(sz); for(std::size_t i=0;i const elta(elt); + MCAuto elta(elt); if(elt) elt->incrRef(); _equ.push_back(elta); @@ -266,7 +253,7 @@ void MEDFileEquivalences::pushEquivalence(MEDFileEquivalencePair *elt) MEDFileEquivalencePair *MEDFileEquivalences::getEquivalence(int i) { - int const sz(size()); + int sz(size()); if(i<0 || i>=sz) { std::ostringstream oss; oss << "MEDFileEquivalences::getEquivalence : invalid id ! Must be in [0," << sz << ") !"; @@ -277,9 +264,9 @@ MEDFileEquivalencePair *MEDFileEquivalences::getEquivalence(int i) MEDFileEquivalencePair *MEDFileEquivalences::getEquivalenceWithName(const std::string& name) { - for(auto & it : _equ) + for(std::vector< MCAuto >::iterator it=_equ.begin();it!=_equ.end();it++) { - MEDFileEquivalencePair *elt(it); + MEDFileEquivalencePair *elt(*it); if(elt) { if(elt->getName()==name) @@ -301,9 +288,9 @@ int MEDFileEquivalences::size() const std::vector MEDFileEquivalences::getEquivalenceNames() const { std::vector ret; - for(const auto & it : _equ) + for(std::vector< MCAuto >::const_iterator it=_equ.begin();it!=_equ.end();it++) { - const MEDFileEquivalencePair *elt(it); + const MEDFileEquivalencePair *elt(*it); if(elt) { ret.push_back(elt->getName()); @@ -328,7 +315,7 @@ MEDFileEquivalences *MEDFileEquivalences::deepCopy(MEDFileMesh *owner) const bool MEDFileEquivalences::isEqual(const MEDFileEquivalences *other, std::string& what) const { - std::size_t const sz(_equ.size()); + std::size_t sz(_equ.size()); if(sz!=other->_equ.size()) { what="Equivalences differs : not same number !"; @@ -361,7 +348,7 @@ bool MEDFileEquivalences::isEqual(const MEDFileEquivalences *other, std::string& void MEDFileEquivalences::getRepr(std::ostream& oss) const { std::size_t ii(0); - for(auto it=_equ.begin();it!=_equ.end();it++,ii++) + for(std::vector< MCAuto >::const_iterator it=_equ.begin();it!=_equ.end();it++,ii++) { const MEDFileEquivalencePair *elt(*it); oss << "Equivalence #" << ii << " : " ; @@ -374,7 +361,7 @@ void MEDFileEquivalences::getRepr(std::ostream& oss) const void MEDFileEquivalences::killEquivalenceWithName(const std::string& name) { - auto it(_equ.begin()); + std::vector< MCAuto >::iterator it(_equ.begin()); for(;it!=_equ.end();it++) { const MEDFileEquivalencePair *elt(*it); @@ -391,13 +378,13 @@ void MEDFileEquivalences::killEquivalenceWithName(const std::string& name) void MEDFileEquivalences::killEquivalenceAt(int i) { - int const sz(size()); + int sz(size()); if(i<0 || i>=sz) { std::ostringstream oss; oss << "MEDFileEquivalences::killEquivalenceAt : Id must be in [0," << sz << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - auto it(_equ.begin()); + std::vector< MCAuto >::iterator it(_equ.begin()); for(int j=0;j >::const_iterator it=_equ.begin();it!=_equ.end();it++) { - const MEDFileEquivalencePair *elt(it); + const MEDFileEquivalencePair *elt(*it); if(elt) elt->writeLL(fid); } @@ -419,7 +406,7 @@ void MEDFileEquivalences::writeLL(med_idt fid) const int MEDFileEquivalences::PresenceOfEquivalences(med_idt fid, const std::string& meshName) { - med_int const nequ(MEDnEquivalence(fid,meshName.c_str())); + med_int nequ(MEDnEquivalence(fid,meshName.c_str())); return FromMedInt(nequ); } @@ -428,7 +415,7 @@ MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileM MCAuto ret(new MEDFileEquivalences(owner)); if(!owner) throw INTERP_KERNEL::Exception("MEDFileEquivalences::Load : owner is NULL !"); - std::string const meshName(owner->getName()); + std::string meshName(owner->getName()); for(int i=0;i equ(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); @@ -456,9 +443,9 @@ void MEDFileEquivalences::CheckDataArray(const DataArrayInt *data) void MEDFileEquivalences::deepCpyFrom(const MEDFileEquivalences& other) { - for(const auto & it : other._equ) + for(std::vector< MCAuto >::const_iterator it=other._equ.begin();it!=other._equ.end();it++) { - const MEDFileEquivalencePair *elt(it); + const MEDFileEquivalencePair *elt(*it); MCAuto eltCpy; if(elt) { @@ -519,8 +506,8 @@ void MEDFileEquivalenceData::writeAdvanced(med_idt fid, med_entity_type medtype, const MEDFileMesh *mesh(getFather()->getMesh()); int dt,it; mesh->getTime(dt,it); - std::string const meshName(mesh->getName()); - std::string const equName(getFather()->getName()); + std::string meshName(mesh->getName()); + std::string equName(getFather()->getName()); INTERP_KERNEL::AutoPtr meshName2(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy()); @@ -571,7 +558,7 @@ void MEDFileEquivalenceCellType::writeLL(med_idt fid) const std::vector MEDFileEquivalenceCell::getDirectChildrenWithNull() const { - std::size_t const sz(_types.size()); + std::size_t sz(_types.size()); std::vector ret(sz); for(std::size_t i=0;isize()>0) return ret.retn(); else - return nullptr; + return 0; } void MEDFileEquivalenceCell::writeLL(med_idt fid) const { - for(const auto & _type : _types) + for(std::vector< MCAuto >::const_iterator it=_types.begin();it!=_types.end();it++) { - const MEDFileEquivalenceCellType *ct(_type); + const MEDFileEquivalenceCellType *ct(*it); if(ct) ct->writeLL(fid); } @@ -606,9 +593,9 @@ void MEDFileEquivalenceCell::writeLL(med_idt fid) const MEDFileEquivalenceCell *MEDFileEquivalenceCell::deepCopy(MEDFileEquivalencePair *owner) const { MCAuto ret(new MEDFileEquivalenceCell(owner)); - for(const auto & _type : _types) + for(std::vector< MCAuto >::const_iterator it=_types.begin();it!=_types.end();it++) { - const MEDFileEquivalenceCellType *elt(_type); + const MEDFileEquivalenceCellType *elt(*it); MCAuto eltCpy; if(elt) eltCpy=elt->deepCopy(owner); @@ -619,7 +606,7 @@ MEDFileEquivalenceCell *MEDFileEquivalenceCell::deepCopy(MEDFileEquivalencePair bool MEDFileEquivalenceCell::isEqual(const MEDFileEquivalenceCell *other, std::string& what) const { - std::size_t const sz(_types.size()); + std::size_t sz(_types.size()); if(sz!=other->_types.size()) { std::ostringstream oss; oss << "Nb of geo types differs : " << sz << " != " << other->_types.size(); @@ -650,9 +637,9 @@ bool MEDFileEquivalenceCell::isEqual(const MEDFileEquivalenceCell *other, std::s void MEDFileEquivalenceCell::getRepr(std::ostream& oss) const { - for(const auto & _type : _types) + for(std::vector< MCAuto >::const_iterator it=_types.begin();it!=_types.end();it++) { - const MEDFileEquivalenceCellType *elt(_type); + const MEDFileEquivalenceCellType *elt(*it); if(elt) elt->getRepr(oss); } @@ -660,9 +647,9 @@ void MEDFileEquivalenceCell::getRepr(std::ostream& oss) const DataArrayInt *MEDFileEquivalenceCell::getArray(INTERP_KERNEL::NormalizedCellType type) { - for(auto & _type : _types) + for(std::vector< MCAuto >::iterator it=_types.begin();it!=_types.end();it++) { - MEDFileEquivalenceCellType *elt(_type); + MEDFileEquivalenceCellType *elt(*it); if(elt && elt->getType()==type) return elt->getArray(); } @@ -676,7 +663,7 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) return ; MEDFileEquivalences::CheckDataArray(da); MEDFileMesh *mm(getMesh()); - mcIdType const totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax)); + mcIdType totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax)); // MCAuto tmp(da->deepCopy()); tmp->rearrange(1); int maxv,minv; @@ -687,42 +674,42 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) throw INTERP_KERNEL::Exception(oss.str().c_str()); } // - std::vector const gts(mm->getGeoTypesAtLevel(meshDimRelToMax)); + std::vector gts(mm->getGeoTypesAtLevel(meshDimRelToMax)); int startId(0),endId; - std::vector const compS(1,0); - for(auto gt : gts) + std::vector compS(1,0); + for(std::vector::const_iterator it=gts.begin();it!=gts.end();it++) { - endId=startId+(int)mm->getNumberOfCellsWithType(gt); + endId=startId+(int)mm->getNumberOfCellsWithType(*it); MCAuto da0(da->keepSelectedComponents(compS)); MCAuto ids(da0->findIdsInRange(startId,endId)); MCAuto da1(da->selectByTupleIdSafe(ids->begin(),ids->end())); da1->applyLin(1,-startId); - setArrayForType(gt,da1); + setArrayForType(*it,da1); startId=endId; } } void MEDFileEquivalenceCell::setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) { - for(auto & _type : _types) + for(std::vector< MCAuto >::iterator it=_types.begin();it!=_types.end();it++) { - MEDFileEquivalenceCellType *elt(_type); + MEDFileEquivalenceCellType *elt(*it); if(elt && elt->getType()==type) { elt->setArray(da); return ; } } - MCAuto const newElt(new MEDFileEquivalenceCellType(getFather(),type,da)); + MCAuto newElt(new MEDFileEquivalenceCellType(getFather(),type,da)); _types.push_back(newElt); } std::vector MEDFileEquivalenceCell::getTypes() const { std::vector ret; - for(const auto & _type : _types) + for(std::vector< MCAuto >::const_iterator it=_types.begin();it!=_types.end();it++) { - const MEDFileEquivalenceCellType *elt(_type); + const MEDFileEquivalenceCellType *elt(*it); if(elt) ret.push_back(elt->getType()); } @@ -745,7 +732,7 @@ void MEDFileEquivalenceCell::load(med_idt fid) MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],da->getPointer())); da->applyLin(1,-1); da->rearrange(2); - MCAuto const ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],FromMedIntArray(da))); + MCAuto ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],FromMedIntArray(da))); _types.push_back(ct); } } diff --git a/src/MEDLoader/MEDFileEquivalence.hxx b/src/MEDLoader/MEDFileEquivalence.hxx index 877ca7c24..bc09280b9 100644 --- a/src/MEDLoader/MEDFileEquivalence.hxx +++ b/src/MEDLoader/MEDFileEquivalence.hxx @@ -21,18 +21,14 @@ #ifndef __MEDFILEEQUIVALENCE_HXX__ #define __MEDFILEEQUIVALENCE_HXX__ -#include "MEDFileUtilities.hxx" -#include "MCType.hxx" #include "MEDLoaderDefines.hxx" #include "MEDCouplingRefCountObject.hxx" +#include "MEDCouplingMemArray.hxx" +#include "MEDFileUtilities.txx" #include "MCAuto.hxx" #include "NormalizedGeometricTypes" -#include "med.h" -#include -#include -#include #include namespace MEDCoupling @@ -47,7 +43,7 @@ namespace MEDCoupling public: static MEDFileEquivalencePair *Load(MEDFileEquivalences *father, med_idt fid, const std::string& name, const std::string &desc); std::string getClassName() const override { return std::string("MEDFileEquivalencePair"); } - void writeLL(med_idt fid) const override; + void writeLL(med_idt fid) const; const MEDFileEquivalences *getFather() const { return _father; } MEDFileEquivalences *getFather() { return _father; } const MEDFileMesh *getMesh() const; @@ -56,8 +52,8 @@ namespace MEDCoupling bool isEqual(const MEDFileEquivalencePair *other, std::string& what) const; void getRepr(std::ostream& oss) const; static MEDFileEquivalencePair *New(MEDFileEquivalences *father, const std::string& name); - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; public: MEDLOADER_EXPORT std::string getName() const { return _name; } MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } @@ -82,8 +78,8 @@ namespace MEDCoupling class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone { public: - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT const MEDFileMesh *getMesh() const { return _owner; } MEDLOADER_EXPORT MEDFileMesh *getMesh() { return _owner; } void getDtIt(int &dt, int &it) const; @@ -104,7 +100,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void killEquivalenceAt(int i); MEDLOADER_EXPORT void clear(); public: - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; static int PresenceOfEquivalences(med_idt fid, const std::string& meshName); static MEDFileEquivalences *Load(med_idt fid, int nbOfEq, MEDFileMesh *owner); static void CheckDataArray(const DataArrayInt *data); @@ -125,7 +121,7 @@ namespace MEDCoupling const MEDFileMesh *getMesh() const { return getFather()->getMesh(); } MEDFileMesh *getMesh() { return getFather()->getMesh(); } protected: - ~MEDFileEquivalenceBase() override = default; + ~MEDFileEquivalenceBase() { } private: MEDFileEquivalencePair *_father; }; @@ -138,12 +134,12 @@ namespace MEDCoupling MEDLOADER_EXPORT void setArray(DataArrayInt *data); MEDLOADER_EXPORT const DataArrayInt *getArray() const { return _data; } MEDLOADER_EXPORT DataArrayInt *getArray() { return _data; } - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; bool isEqual(const MEDFileEquivalenceData *other, std::string& what) const; protected: void writeAdvanced(med_idt fid, med_entity_type medtype, med_geometry_type medgt) const; protected: - ~MEDFileEquivalenceData() override = default; + ~MEDFileEquivalenceData() { } protected: MCAuto _data; }; @@ -153,15 +149,15 @@ namespace MEDCoupling public: MEDFileEquivalenceCellType(MEDFileEquivalencePair *owner, INTERP_KERNEL::NormalizedCellType type, DataArrayInt *data):MEDFileEquivalenceData(owner,data),_type(type) { } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileEquivalenceCellType"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; INTERP_KERNEL::NormalizedCellType getType() const { return _type; } MEDFileEquivalenceCellType *deepCopy(MEDFileEquivalencePair *owner) const; bool isEqual(const MEDFileEquivalenceCellType *other, std::string& what) const; void getRepr(std::ostream& oss) const; public: - void writeLL(med_idt fid) const override; + void writeLL(med_idt fid) const; protected: - ~MEDFileEquivalenceCellType() override = default; + ~MEDFileEquivalenceCellType() { } private: INTERP_KERNEL::NormalizedCellType _type; }; @@ -169,11 +165,11 @@ namespace MEDCoupling class MEDFileEquivalenceCell : public MEDFileEquivalenceBase { public: - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileEquivalenceCell"); } static MEDFileEquivalenceCell *Load(med_idt fid, MEDFileEquivalencePair *owner); - void writeLL(med_idt fid) const override; + void writeLL(med_idt fid) const; MEDFileEquivalenceCell *deepCopy(MEDFileEquivalencePair *owner) const; bool isEqual(const MEDFileEquivalenceCell *other, std::string& what) const; void getRepr(std::ostream& oss) const; @@ -187,7 +183,7 @@ namespace MEDCoupling public: MEDFileEquivalenceCell(MEDFileEquivalencePair *owner):MEDFileEquivalenceBase(owner) { } private: - ~MEDFileEquivalenceCell() override = default; + ~MEDFileEquivalenceCell() { } private: void load(med_idt fid); std::string getName() const { return getFather()->getName(); } @@ -200,13 +196,13 @@ namespace MEDCoupling public: MEDFileEquivalenceNode(MEDFileEquivalencePair *owner, DataArrayInt *data):MEDFileEquivalenceData(owner,data) { } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileEquivalenceNode"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + void writeLL(med_idt fid) const; MEDFileEquivalenceNode *deepCopy(MEDFileEquivalencePair *owner) const; bool isEqual(const MEDFileEquivalenceNode *other, std::string& what) const; void getRepr(std::ostream& oss) const; protected: - ~MEDFileEquivalenceNode() override = default; + ~MEDFileEquivalenceNode() { } }; } diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 797677324..3993ff919 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -19,18 +19,10 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileField.hxx" -#include "MEDFileEntities.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MEDCoupling1GTUMesh.hxx" -#include "MEDFileFieldInternal.hxx" -#include "InterpKernelException.hxx" #include "MEDFileMesh.hxx" -#include "MEDFileUtilities.hxx" +#include "MEDLoaderBase.hxx" #include "MEDLoaderTraits.hxx" +#include "MEDFileSafeCaller.txx" #include "MEDFileFieldOverView.hxx" #include "MEDFileBlowStrEltUp.hxx" #include "MEDFileFieldVisitor.hxx" @@ -38,20 +30,10 @@ #include "MEDCouplingFieldDiscretization.hxx" #include "InterpKernelAutoPtr.hxx" -#include "NormalizedGeometricTypes" -#include "med.h" -#include "medfield.h" +#include "CellModel.hxx" #include -#include #include -#include -#include -#include -#include -#include -#include -#include // From MEDLoader.cxx TU: extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO]; @@ -69,24 +51,24 @@ MEDFileFields *MEDFileFields::New() MEDFileFields *MEDFileFields::New(const std::string& fileName, bool loadAll) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,loadAll); } MEDFileFields *MEDFileFields::NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return NewAdv(fid,loadAll,entities); } MEDFileFields *MEDFileFields::NewAdv(med_idt fid, bool loadAll, const MEDFileEntities *entities) { - return new MEDFileFields(fid,loadAll,nullptr,entities); + return new MEDFileFields(fid,loadAll,0,entities); } MEDFileFields *MEDFileFields::NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return NewWithDynGT(fid,se,loadAll); } @@ -95,26 +77,26 @@ MEDFileFields *MEDFileFields::NewWithDynGT(med_idt fid, const MEDFileStructureEl if(!se) throw INTERP_KERNEL::Exception("MEDFileFields::NewWithDynGT : null struct element pointer !"); INTERP_KERNEL::AutoCppPtr entities(MEDFileEntities::BuildFrom(*se)); - return new MEDFileFields(fid,loadAll,nullptr,entities); + return new MEDFileFields(fid,loadAll,0,entities); } MEDFileFields *MEDFileFields::New(med_idt fid, bool loadAll) { - return new MEDFileFields(fid,loadAll,nullptr,nullptr); + return new MEDFileFields(fid,loadAll,0,0); } MEDFileFields *MEDFileFields::LoadPartOf(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); - return new MEDFileFields(fid,loadAll,ms,nullptr); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); + return new MEDFileFields(fid,loadAll,ms,0); } MEDFileFields *MEDFileFields::LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair >& entities, bool loadAll) { MEDFileUtilities::CheckFileForRead(fileName); INTERP_KERNEL::AutoCppPtr ent(new MEDFileStaticEntities(entities)); - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); - return new MEDFileFields(fid,loadAll,nullptr,ent); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); + return new MEDFileFields(fid,loadAll,0,ent); } std::size_t MEDFileFields::getHeapMemorySizeWithoutChildren() const @@ -127,8 +109,8 @@ std::size_t MEDFileFields::getHeapMemorySizeWithoutChildren() const std::vector MEDFileFields::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _field : _fields) - ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_field); + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) + ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)*it); return ret; } @@ -136,7 +118,7 @@ MEDFileFields *MEDFileFields::deepCopy() const { MCAuto ret(shallowCpy()); std::size_t i(0); - for(auto it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { if((const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it) ret->_fields[i]=(*it)->deepCopy(); @@ -165,11 +147,11 @@ std::vector< std::pair > MEDFileFields::getCommonIterations(bool& areTh std::set< std::pair > s; bool firstShot=true; areThereSomeForgottenTS=false; - for(const auto & _field : _fields) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - if(!(const MEDFileAnyTypeFieldMultiTSWithoutSDA*)_field) + if(!(const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it) continue; - std::vector< std::pair > v=_field->getIterations(); + std::vector< std::pair > v=(*it)->getIterations(); std::set< std::pair > s1; std::copy(v.begin(),v.end(),std::inserter(s1,s1.end())); if(firstShot) { s=s1; firstShot=false; } @@ -195,7 +177,7 @@ std::vector MEDFileFields::getFieldsNames() const { std::vector ret(_fields.size()); int i(0); - for(auto it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *f=(*it); if(f) @@ -214,9 +196,9 @@ std::vector MEDFileFields::getFieldsNames() const std::vector MEDFileFields::getMeshesNames() const { std::vector ret; - for(const auto & _field : _fields) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field); + const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); if(cur) ret.push_back(cur->getMeshName()); } @@ -233,11 +215,11 @@ std::string MEDFileFields::simpleRepr() const void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const { - int const nbOfFields(getNumberOfFields()); - std::string const startLine(bkOffset,' '); + int nbOfFields(getNumberOfFields()); + std::string startLine(bkOffset,' '); oss << startLine << "There are " << nbOfFields << " fields in this :" << std::endl; int i=0; - for(auto it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); if(cur) @@ -250,10 +232,10 @@ void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const } } i=0; - for(auto it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); - std::string const chapter(17,(char)('0'+i)); + std::string chapter(17,(char)('0'+i)); oss << startLine << chapter << std::endl; if(cur) { @@ -269,7 +251,8 @@ void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const } MEDFileFields::MEDFileFields() -= default; +{ +} MEDFileFields::MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) try:MEDFileFieldGlobsReal(fid) @@ -330,7 +313,7 @@ void MEDFileFields::writeLL(med_idt fid) const { int i=0; writeGlobals(fid,*this); - for(auto it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt=*it; if(!elt) @@ -353,10 +336,10 @@ void MEDFileFields::loadArrays() { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileFields::loadArrays : the structure does not come from a file !"); - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName())); - for(auto & _field : _fields) + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName())); + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { - MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(_field); + MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) elt->loadBigArraysRecursively(fid,*elt); } @@ -373,10 +356,10 @@ void MEDFileFields::loadArraysIfNecessary() { if(!getFileName().empty()) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName())); - for(auto & _field : _fields) + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName())); + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { - MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(_field); + MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) elt->loadBigArraysRecursivelyIfNecessary(fid,*elt); } @@ -392,9 +375,9 @@ void MEDFileFields::loadArraysIfNecessary() */ void MEDFileFields::unloadArrays() { - for(auto & _field : _fields) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { - MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(_field); + MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) elt->unloadArrays(); } @@ -417,14 +400,14 @@ std::vector MEDFileFields::getPflsReallyUsed() const { std::vector ret; std::set ret2; - for(const auto & _field : _fields) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - std::vector const tmp=_field->getPflsReallyUsed2(); - for(const auto & it2 : tmp) - if(ret2.find(it2)==ret2.end()) + std::vector tmp=(*it)->getPflsReallyUsed2(); + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + if(ret2.find(*it2)==ret2.end()) { - ret.push_back(it2); - ret2.insert(it2); + ret.push_back(*it2); + ret2.insert(*it2); } } return ret; @@ -434,14 +417,14 @@ std::vector MEDFileFields::getLocsReallyUsed() const { std::vector ret; std::set ret2; - for(const auto & _field : _fields) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - std::vector const tmp(_field->getLocsReallyUsed2()); - for(const auto & it2 : tmp) - if(ret2.find(it2)==ret2.end()) + std::vector tmp((*it)->getLocsReallyUsed2()); + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + if(ret2.find(*it2)==ret2.end()) { - ret.push_back(it2); - ret2.insert(it2); + ret.push_back(*it2); + ret2.insert(*it2); } } return ret; @@ -450,9 +433,9 @@ std::vector MEDFileFields::getLocsReallyUsed() const std::vector MEDFileFields::getPflsReallyUsedMulti() const { std::vector ret; - for(const auto & _field : _fields) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - std::vector tmp(_field->getPflsReallyUsedMulti2()); + std::vector tmp((*it)->getPflsReallyUsedMulti2()); ret.insert(ret.end(),tmp.begin(),tmp.end()); } return ret; @@ -461,9 +444,9 @@ std::vector MEDFileFields::getPflsReallyUsedMulti() const std::vector MEDFileFields::getLocsReallyUsedMulti() const { std::vector ret; - for(const auto & _field : _fields) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - std::vector tmp(_field->getLocsReallyUsed2()); + std::vector tmp((*it)->getLocsReallyUsed2()); ret.insert(ret.end(),tmp.begin(),tmp.end()); } return ret; @@ -471,14 +454,14 @@ std::vector MEDFileFields::getLocsReallyUsedMulti() const void MEDFileFields::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & _field : _fields) - _field->changePflsRefsNamesGen2(mapOfModif); + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) + (*it)->changePflsRefsNamesGen2(mapOfModif); } void MEDFileFields::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & _field : _fields) - _field->changeLocsRefsNamesGen2(mapOfModif); + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) + (*it)->changeLocsRefsNamesGen2(mapOfModif); } void MEDFileFields::resize(int newSize) @@ -488,8 +471,8 @@ void MEDFileFields::resize(int newSize) void MEDFileFields::pushFields(const std::vector& fields) { - for(auto field : fields) - pushField(field); + for(std::vector::const_iterator it=fields.begin();it!=fields.end();it++) + pushField(*it); } void MEDFileFields::pushField(MEDFileAnyTypeFieldMultiTS *field) @@ -538,7 +521,7 @@ void MEDFileFields::destroyFieldsAtPos(const int *startIds, const int *endIds) void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step) { static const char msg[]="MEDFileFields::destroyFieldsAtPos2"; - mcIdType const nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg)); + mcIdType nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg)); std::vector b(_fields.size(),true); int k=bg; for(int i=0;i >& modifTab) { bool ret(false); - for(auto & _field : _fields) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { - MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field); + MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); if(cur) ret=cur->changeMeshNames(modifTab) || ret; } @@ -582,9 +565,9 @@ bool MEDFileFields::changeMeshNames(const std::vector< std::pair& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N) { bool ret(false); - for(auto & _field : _fields) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { - MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts(_field); + MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts(*it); if(fmts) { ret=fmts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,*this) || ret; @@ -604,7 +587,7 @@ MEDFileFields *MEDFileFields::extractPart(const std::map fsOut(MEDFileFields::New()); - int const nbFields(getNumberOfFields()); + int nbFields(getNumberOfFields()); for(int i=0;i fmts(getFieldAtPos(i)); @@ -621,12 +604,12 @@ MEDFileFields *MEDFileFields::extractPart(const std::map >::const_iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) { - visitor.newFieldEntry(_field); - _field->accept(visitor); - visitor.endFieldEntry(_field); + visitor.newFieldEntry(*it); + (*it)->accept(visitor); + visitor.endFieldEntry(*it); } } @@ -648,20 +631,20 @@ private: class MEDFileFieldLin2QuadVisitor : public MEDFileFieldVisitor { public: - MEDFileFieldLin2QuadVisitor(const MEDFileUMesh *lin, const MEDFileUMesh *quad, const MEDFileFieldGlobsReal *linGlobs, MEDFileFields* outFs):_lin(lin),_quad(quad),_lin_globs(linGlobs),_out_fs(outFs) { } - void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) override { if(field->getMeshName()!=_lin->getName()) return; _cur_fmts=MEDFileFieldMultiTS::New(); } - void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA * /*field*/) override { if(_cur_fmts.isNotNull()) { if(_cur_fmts->getNumberOfTS()>0) _out_fs->pushField(_cur_fmts); } } + MEDFileFieldLin2QuadVisitor(const MEDFileUMesh *lin, const MEDFileUMesh *quad, const MEDFileFieldGlobsReal *linGlobs, MEDFileFields* outFs):_lin(lin),_quad(quad),_lin_globs(linGlobs),_out_fs(outFs),_gt(INTERP_KERNEL::NORM_ERROR),_1ts_update_requested(false) { } + void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) { if(field->getMeshName()!=_lin->getName()) return; _cur_fmts=MEDFileFieldMultiTS::New(); } + void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) { if(_cur_fmts.isNotNull()) { if(_cur_fmts->getNumberOfTS()>0) _out_fs->pushField(_cur_fmts); } } // - void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) override; - void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) override; + void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts); + void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts); // - void newMeshEntry(const MEDFileFieldPerMesh *fpm) override; - void endMeshEntry(const MEDFileFieldPerMesh *fpm) override { } + void newMeshEntry(const MEDFileFieldPerMesh *fpm); + void endMeshEntry(const MEDFileFieldPerMesh *fpm) { } // - void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) override; - void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) override { } + void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); + void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) { } // - void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) override; + void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); private: void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes); private: @@ -671,9 +654,9 @@ private: MEDFileFields *_out_fs; MCAuto _cur_fmts; MCAuto _cur_f1ts; - INTERP_KERNEL::NormalizedCellType _gt{INTERP_KERNEL::NORM_ERROR}; + INTERP_KERNEL::NormalizedCellType _gt; // Info on 1TS modification - bool _1ts_update_requested{false}; + bool _1ts_update_requested; // Cache of matrix to compute faster the values on newly created points std::map< std::string, PFLData > _cache; std::vector _pfls_to_be_updated; @@ -687,11 +670,11 @@ void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc(const MEDFileFieldPer throw INTERP_KERNEL::Exception("Not managed yet for ON_CELLS ON_GAUSS_NE and ON_GAUSS_PT"); _1ts_update_requested=true; MEDFileAnyTypeField1TSWithoutSDA *ct(_cur_f1ts->contentNotNullBase()); - int const locId(pmptpd->getFather()->locIdOfLeaf(pmptpd)); + int locId(pmptpd->getFather()->locIdOfLeaf(pmptpd)); MEDFileFieldPerMeshPerTypePerDisc *pmtdToModify(ct->getLeafGivenMeshAndTypeAndLocId(_lin->getName(),_gt,locId)); - std::string const pflName(pmptpd->getProfile()); + std::string pflName(pmptpd->getProfile()); _pfls_to_be_updated.push_back(pflName); - auto const itCache(_cache.find(pflName)); + std::map< std::string, PFLData >::iterator itCache(_cache.find(pflName)); if(itCache!=_cache.end()) { updateData(pmtdToModify,(*itCache).second.getNbOfAddPtsInPfl()); @@ -722,7 +705,7 @@ void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc(const MEDFileFieldPer DataArrayIdType *nodeConn(allSeg3->getNodalConnectivity()); nodeConn->rearrange(3); { - std::vector const v(1,2); + std::vector v(1,2); midPts=nodeConn->keepSelectedComponents(v); } cellSeg3Ids=DataArrayIdType::FindPermutationFromFirstToSecond(midPts,newPtsIds); @@ -741,7 +724,7 @@ void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc(const MEDFileFieldPer pflq=DataArrayIdType::Aggregate(vs); pflq->setName(pflName); } - PFLData const pdata(matrix,pflq,newPtsIds->getNumberOfTuples()); + PFLData pdata(matrix,pflq,newPtsIds->getNumberOfTuples()); _cache[pflName]=pdata; updateData(pmtdToModify,pdata.getNbOfAddPtsInPfl()); } @@ -753,7 +736,7 @@ void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc * void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) { - const auto *pmpt2(dynamic_cast(pmpt)); + const MEDFileFieldPerMeshPerType *pmpt2(dynamic_cast(pmpt)); if(!pmpt2) throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newPerMeshPerTypeEntry : not managed for structure elements !"); if(pmpt2->getNumberOfLoc()!=1) @@ -772,7 +755,7 @@ void MEDFileFieldLin2QuadVisitor::newTimeStepEntry(const MEDFileAnyTypeField1TSW _1ts_update_requested=false; _pfls_to_be_updated.clear(); if(!ts) return ; - const auto *tsd(dynamic_cast(ts)); + const MEDFileField1TSWithoutSDA *tsd(dynamic_cast(ts)); if(!tsd) return ; MCAuto contentCpy(ts->deepCopy()); @@ -783,25 +766,25 @@ void MEDFileFieldLin2QuadVisitor::newTimeStepEntry(const MEDFileAnyTypeField1TSW _cur_f1ts->deepCpyGlobs(*_lin_globs); } -void MEDFileFieldLin2QuadVisitor::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA * /*ts*/) +void MEDFileFieldLin2QuadVisitor::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) { if(_cur_f1ts.isNull()) return ; if(_1ts_update_requested) { MCAuto matrix,oldPfl; - for(const auto & it : _pfls_to_be_updated) + for(std::vector::const_iterator it=_pfls_to_be_updated.begin();it!=_pfls_to_be_updated.end();it++) { - std::map< std::string, PFLData >::const_iterator const it2(_cache.find(it)); + std::map< std::string, PFLData >::const_iterator it2(_cache.find(*it)); if(it2==_cache.end()) throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::endTimeStepEntry : invalid situation !"); matrix=(*it2).second.getMatrix(); - if(it.empty()) + if((*it).empty()) continue; - int const locId(_cur_f1ts->getProfileId(it)); - oldPfl.takeRef(_cur_f1ts->getProfile(it)); + int locId(_cur_f1ts->getProfileId(*it)); + oldPfl.takeRef(_cur_f1ts->getProfile(*it)); { - std::vector const locToKill(1,locId); + std::vector locToKill(1,locId); _cur_f1ts->killProfileIds(locToKill); } _cur_f1ts->appendProfile((*it2).second.getProfile()); @@ -843,11 +826,11 @@ MCAuto MEDFileFields::linearToQuadratic(const MEDFileMeshes *oldL MEDFileMesh *mm(oldLin->getMeshAtPos(i)); if(!mm) continue; - auto *mmu(dynamic_cast(mm)); + MEDFileUMesh *mmu(dynamic_cast(mm)); if(!mmu) continue; MEDFileMesh *mmq(newQuad->getMeshWithName(mmu->getName())); - auto *mmqu(dynamic_cast(mmq)); + MEDFileUMesh *mmqu(dynamic_cast(mmq)); if(!mmqu) { std::ostringstream oss; oss << "MEDFileFields::linearToQuadratic : mismatch of name between input meshes for name \"" << mmu->getName() << "\""; @@ -868,12 +851,12 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const } const MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts=_fields[i]; if(!fmts) - return nullptr; + return 0; MCAuto ret; - const auto *fmtsC(dynamic_cast(fmts)); - const auto *fmtsC2(dynamic_cast(fmts)); - const auto *fmtsC4(dynamic_cast(fmts)); - const auto *fmtsC3(dynamic_cast(fmts)); + const MEDFileFieldMultiTSWithoutSDA *fmtsC(dynamic_cast(fmts)); + const MEDFileInt32FieldMultiTSWithoutSDA *fmtsC2(dynamic_cast(fmts)); + const MEDFileInt64FieldMultiTSWithoutSDA *fmtsC4(dynamic_cast(fmts)); + const MEDFileFloatFieldMultiTSWithoutSDA *fmtsC3(dynamic_cast(fmts)); if(fmtsC) ret=MEDFileFieldMultiTS::New(*fmtsC,false); else if(fmtsC2) @@ -899,7 +882,7 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endIds) const { MCAuto ret=shallowCpy(); - std::size_t const sz=std::distance(startIds,endIds); + std::size_t sz=std::distance(startIds,endIds); std::vector< MCAuto > fields(sz); int j=0; for(const int *i=startIds;i!=endIds;i++,j++) @@ -929,13 +912,13 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const std::string& f bool MEDFileFields::removeFieldsWithoutAnyTimeStep() { std::vector > newFields; - for(const auto & _field : _fields) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(_field); + const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) { if(elt->getNumberOfTS()>0) - newFields.push_back(_field); + newFields.push_back(*it); } } if(_fields.size()==newFields.size()) @@ -956,15 +939,15 @@ bool MEDFileFields::removeFieldsWithoutAnyTimeStep() MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const { MCAuto ret(MEDFileFields::New()); - for(const auto & _field : _fields) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field); + const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); if(!cur) continue; if(cur->getMeshName()==meshName) { cur->incrRef(); - MCAuto const cur2(const_cast(cur)); + MCAuto cur2(const_cast(cur)); ret->_fields.push_back(cur2); } } @@ -988,12 +971,12 @@ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::stri MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { MCAuto ret(MEDFileFields::New()); - for(const auto & _field : _fields) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field); + const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); if(!cur) continue; - MCAuto const elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps); + MCAuto elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps); ret->_fields.push_back(elt); } ret->shallowCpyOnlyUsedGlobs(*this); @@ -1006,9 +989,9 @@ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vec MEDFileFields *MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { MCAuto ret=MEDFileFields::New(); - for(const auto & _field : _fields) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { - const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(_field); + const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); if(!cur) continue; MCAuto elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps); @@ -1021,9 +1004,9 @@ MEDFileFields *MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps(const std:: bool MEDFileFields::presenceOfStructureElements() const { - for(const auto & _field : _fields) - if(_field.isNotNull()) - if(_field->presenceOfStructureElements()) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) + if((*it)->presenceOfStructureElements()) return true; return false; } @@ -1031,20 +1014,20 @@ bool MEDFileFields::presenceOfStructureElements() const void MEDFileFields::killStructureElements() { std::vector< MCAuto > ret; - for(auto & _field : _fields) - if(_field.isNotNull()) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) { - if(_field->presenceOfStructureElements()) + if((*it)->presenceOfStructureElements()) { - if(!_field->onlyStructureElements()) + if(!(*it)->onlyStructureElements()) { - _field->killStructureElements(); - ret.push_back(_field); + (*it)->killStructureElements(); + ret.push_back(*it); } } else { - ret.push_back(_field); + ret.push_back(*it); } } _fields=ret; @@ -1053,14 +1036,14 @@ void MEDFileFields::killStructureElements() void MEDFileFields::keepOnlyStructureElements() { std::vector< MCAuto > ret; - for(auto & _field : _fields) - if(_field.isNotNull()) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) { - if(_field->presenceOfStructureElements()) + if((*it)->presenceOfStructureElements()) { - if(!_field->onlyStructureElements()) - _field->keepOnlyStructureElements(); - ret.push_back(_field); + if(!(*it)->onlyStructureElements()) + (*it)->keepOnlyStructureElements(); + ret.push_back(*it); } } _fields=ret; @@ -1069,26 +1052,26 @@ void MEDFileFields::keepOnlyStructureElements() void MEDFileFields::keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName) { std::vector< MCAuto > ret; - for(auto & _field : _fields) - if(_field.isNotNull()) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) { - if(_field->getMeshName()!=meshName) + if((*it)->getMeshName()!=meshName) continue; std::vector< std::pair > ps; - _field->getMeshSENames(ps); - std::pair const p(meshName,seName); + (*it)->getMeshSENames(ps); + std::pair p(meshName,seName); if(std::find(ps.begin(),ps.end(),p)!=ps.end()) - _field->keepOnlyOnSE(seName); - ret.push_back(_field); + (*it)->keepOnlyOnSE(seName); + ret.push_back(*it); } _fields=ret; } void MEDFileFields::getMeshSENames(std::vector< std::pair >& ps) const { - for(const auto & _field : _fields) - if(_field.isNotNull()) - _field->getMeshSENames(ps); + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) + (*it)->getMeshSENames(ps); } void MEDFileFields::blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses) @@ -1111,7 +1094,7 @@ void MEDFileFields::aggregateFieldsOnSameMeshes(MEDFileMeshes *ms) THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : ms is nullptr !"); // std::vector msNames(ms->getMeshesNames()); - std::set const msNamesSet(msNames.begin(),msNames.end()); + std::set msNamesSet(msNames.begin(),msNames.end()); if(msNames.size() == msNamesSet.size()) return ; // @@ -1133,7 +1116,7 @@ void MEDFileFields::aggregateFieldsOnSameMeshes(MEDFileMeshes *ms) zeMeshNames.insert(fmtsWithSameName->getMeshName()); if(zeMeshNames.size()!=1) THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : Presence of multiple MultiTS instances with same name but lying on same meshName. Looks bad !"); - std::string const meshNameToMerge = *zeMeshNames.begin(); + std::string meshNameToMerge = *zeMeshNames.begin(); if(expectedMeshNamesToMerge.find(meshNameToMerge) != expectedMeshNamesToMerge.end()) THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : unexpected situation ! Error in implementation !"); expectedMeshNamesToMerge.insert(*zeMeshNames.begin()); @@ -1163,7 +1146,7 @@ void MEDFileFields::aggregateFieldsOnSameMeshes(MEDFileMeshes *ms) for(auto entry : entries) dtsToPush.push_back({entry.first.first,entry.second.second-entry.second.first}); dtsToAggregate.push_back(dtsToPush); - MCAuto const eltToAggregate = MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(fieldToBeAggregated); + MCAuto eltToAggregate = MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(fieldToBeAggregated); eltsToAggregate.push_back(eltToAggregate); } MCAuto gg = MEDFileAnyTypeFieldMultiTS::Aggregate(FromVecAutoToVecOfConst(eltsToAggregate),dtsToAggregate); @@ -1197,7 +1180,7 @@ void MEDFileFields::aggregateFieldsOnSameMeshes(MEDFileMeshes *ms) { if(!curMesh->getNonEmptyLevels().empty()) THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : only meshes without cells supported."); - auto *curMeshU(dynamic_cast(curMesh)); + MEDFileUMesh *curMeshU(dynamic_cast(curMesh)); if(!curMeshU) THROW_IK_EXCEPTION("MEDFileFields::aggregateFieldsOnSameMeshes : only unstructured mesh supported."); coos.push_back(curMeshU->getCoords()); @@ -1231,12 +1214,12 @@ MCAuto MEDFileFields::partOfThisLyingOnSpecifiedMeshSEName(const void MEDFileFields::aggregate(const MEDFileFields& other) { - int const nbFieldsToAdd(other.getNumberOfFields()); + int nbFieldsToAdd(other.getNumberOfFields()); std::vector fsn(getFieldsNames()); for(int i=0;i elt(other.getFieldAtPos(i)); - std::string const name(elt->getName()); + std::string name(elt->getName()); if(std::find(fsn.begin(),fsn.end(),name)!=fsn.end()) { std::ostringstream oss; oss << "MEDFileFields::aggregate : name \"" << name << "\" already appears !"; @@ -1253,14 +1236,14 @@ MEDFileFieldsIterator *MEDFileFields::iterator() int MEDFileFields::getPosFromFieldName(const std::string& fieldName) const { - std::string const tmp(fieldName); + std::string tmp(fieldName); std::vector poss; for(unsigned int i=0;i<_fields.size();i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *f(_fields[i]); if(f) { - std::string const fname(f->getName()); + std::string fname(f->getName()); if(tmp==fname) return i; else @@ -1283,7 +1266,8 @@ MEDFileFieldsIterator::MEDFileFieldsIterator(MEDFileFields *fs):_fs(fs),_iter_id } MEDFileFieldsIterator::~MEDFileFieldsIterator() -= default; +{ +} MEDFileAnyTypeFieldMultiTS *MEDFileFieldsIterator::nextt() { @@ -1293,8 +1277,8 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFieldsIterator::nextt() if(fs) return fs->getFieldAtPos(_iter_id++); else - return nullptr; + return 0; } else - return nullptr; + return 0; } diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 83415546b..d0a9e880f 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -20,8 +20,6 @@ #pragma once -#include "MEDFileUtilities.hxx" -#include "MCType.hxx" #include "MEDLoaderDefines.hxx" #include "MEDFileFieldInternal.hxx" @@ -30,21 +28,23 @@ #include "MEDFileFieldMultiTS.hxx" #include "MEDFileFieldOverView.hxx" +#include "MEDFileUtilities.txx" #include "MEDFileEntities.hxx" #include "MCAuto.hxx" +#include "MEDLoaderTraits.hxx" #include "MEDCouplingTraits.hxx" #include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingMemArray.hxx" +#include "MEDCouplingPartDefinition.hxx" -#include "NormalizedGeometricTypes" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelException.hxx" -#include -#include -#include -#include #include #include +#include +#include #include "med.h" @@ -76,13 +76,13 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileFields *NewWithDynGT(med_idt fid, const MEDFileStructureElements *se, bool loadAll=true); MEDLOADER_EXPORT static MEDFileFields *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFields"); } - MEDLOADER_EXPORT static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=nullptr); + MEDLOADER_EXPORT static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0); MEDLOADER_EXPORT static MEDFileFields *LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair >& entities, bool loadAll=true); - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileFields *deepCopy() const; MEDLOADER_EXPORT MEDFileFields *shallowCpy() const; - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT void loadArrays(); MEDLOADER_EXPORT void loadArraysIfNecessary(); MEDLOADER_EXPORT void unloadArrays(); @@ -127,14 +127,14 @@ namespace MEDCoupling public: MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const; public: - MEDLOADER_EXPORT std::vector getPflsReallyUsed() const override; - MEDLOADER_EXPORT std::vector getLocsReallyUsed() const override; - MEDLOADER_EXPORT std::vector getPflsReallyUsedMulti() const override; - MEDLOADER_EXPORT std::vector getLocsReallyUsedMulti() const override; - MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) override; - MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) override; + MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; + MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; + MEDLOADER_EXPORT std::vector getPflsReallyUsedMulti() const; + MEDLOADER_EXPORT std::vector getLocsReallyUsedMulti() const; + MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); + MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); private: - ~MEDFileFields() override = default; + ~MEDFileFields() { } MEDFileFields(); MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); private: diff --git a/src/MEDLoader/MEDFileField.txx b/src/MEDLoader/MEDFileField.txx index 69cfd3b8b..a6814f4b4 100644 --- a/src/MEDLoader/MEDFileField.txx +++ b/src/MEDLoader/MEDFileField.txx @@ -20,12 +20,6 @@ #pragma once -#include "MEDCouplingMemArray.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDFileEntities.hxx" -#include "InterpKernelAutoPtr.hxx" #include "MEDFileField.hxx" #include "MEDCouplingTraits.hxx" #include "MEDCouplingFieldInt32.hxx" @@ -33,19 +27,6 @@ #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" -#include "MEDFileField1TS.hxx" -#include -#include -#include "NormalizedGeometricTypes" -#include "MEDLoaderTraits.hxx" -#include -#include "MEDFileFieldInternal.hxx" -#include -#include "MEDFileUtilities.hxx" -#include "med.h" -#include -#include -#include "MEDFileFieldMultiTS.hxx" namespace MEDCoupling { @@ -58,7 +39,7 @@ namespace MEDCoupling _arr=0; return ; } - auto *arrC=dynamic_cast::ArrayType *>(arr); + typename Traits::ArrayType *arrC=dynamic_cast::ArrayType *>(arr); if(!arrC) throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::setArray : the input not null array is not of type DataArrayDouble !"); else @@ -210,11 +191,11 @@ namespace MEDCoupling _arr=Traits::ArrayType::New(); _arr->alloc(start,nbCompo); _arr->copyStringInfoFrom(*arr); start=0; - for(const auto & it : extractInfo) + for(std::vector > >::const_iterator it=extractInfo.begin();it!=extractInfo.end();it++) { - const DataArray *zeArr(das[it.first]); - _arr->setContigPartOfSelectedValuesSlice(start,zeArr,it.second.first,it.second.second,1); - start+=it.second.second-it.second.first; + const DataArray *zeArr(das[(*it).first]); + _arr->setContigPartOfSelectedValuesSlice(start,zeArr,(*it).second.first,(*it).second.second,1); + start+=(*it).second.second-(*it).second.first; } // see definition of _nb_of_tuples_to_be_allocated. array is built from scratch and allocated. _nb_of_tuples_to_be_allocated=-3; @@ -369,7 +350,7 @@ namespace MEDCoupling const MEDFileAnyTypeField1TSWithoutSDA *pt(_content); if(!pt) throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS::contentNotNull : the content pointer is null !"); - const auto *ret(dynamic_cast::F1TSWSDAType *>(pt)); + const typename MLFieldTraits::F1TSWSDAType *ret(dynamic_cast::F1TSWSDAType *>(pt)); if(!ret) { std::ostringstream oss; oss << "MEDFileTemplateField1TS::contentNotNull : the content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type " << MLFieldTraits::F1TSWSDAType::TYPE_STR; @@ -384,7 +365,7 @@ namespace MEDCoupling MEDFileAnyTypeField1TSWithoutSDA *pt(_content); if(!pt) throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS::contentNotNull : the non const content pointer is null !"); - auto *ret(dynamic_cast::F1TSWSDAType *>(pt)); + typename MLFieldTraits::F1TSWSDAType *ret(dynamic_cast::F1TSWSDAType *>(pt)); if(!ret) { std::ostringstream oss; oss << "MEDFileTemplateField1TS::contentNotNull : the non const content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type " << MLFieldTraits::F1TSWSDAType::TYPE_STR; @@ -454,8 +435,8 @@ namespace MEDCoupling if(arr.isNull()) throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS::SetDataArrayInField : no array !"); int t1,t2; - double const t0(f->getTime(t1,t2)); - std::string const tu(f->getTimeUnit()); + double t0(f->getTime(t1,t2)); + std::string tu(f->getTimeUnit()); MCAuto::ArrayType> arr2(DynamicCastSafe::ArrayType>(arr)); MCAuto ft(MEDCouplingFieldTemplate::New(*f)); MCAuto::FieldType> ret(Traits::FieldType::New(*ft)); @@ -742,22 +723,22 @@ namespace MEDCoupling if(!mm) throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !"); MCAuto::F1TSType> ret(MLFieldTraits::F1TSType::New()); - std::vector const tof(getTypesOfFieldAvailable()); - for(auto it0 : tof) + std::vector tof(getTypesOfFieldAvailable()); + for(std::vector::const_iterator it0=tof.begin();it0!=tof.end();it0++) { - if(it0!=ON_NODES) + if((*it0)!=ON_NODES) { std::vector levs; getNonEmptyLevels(mm->getName(),levs); - for(int const lev : levs) + for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { - auto const it2(extractDef.find(lev)); + std::map >::const_iterator it2(extractDef.find(*lev)); if(it2!=extractDef.end()) { MCAuto t((*it2).second); if(t.isNull()) throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !"); - MCAuto::FieldType> f(getFieldOnMeshAtLevel(ON_CELLS,lev,mm)); + MCAuto::FieldType> f(getFieldOnMeshAtLevel(ON_CELLS,(*lev),mm)); MCAuto::FieldType> fOut(f->buildSubPart(t)); ret->setFieldNoProfileSBT(fOut); } @@ -765,7 +746,7 @@ namespace MEDCoupling } else { - auto const it2(extractDef.find(1)); + std::map >::const_iterator it2(extractDef.find(1)); if(it2==extractDef.end()) throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a NODE field and no extract array available for NODE !"); MCAuto t((*it2).second); @@ -830,7 +811,7 @@ namespace MEDCoupling { if(!f1ts) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !"); - const auto *f1tsC(dynamic_cast::F1TSWSDAType *>(f1ts)); + const typename MLFieldTraits::F1TSWSDAType *f1tsC(dynamic_cast::F1TSWSDAType *>(f1ts)); if(!f1tsC) { std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : the input field1TS is not a " << MLFieldTraits::F1TSWSDAType::TYPE_STR << " type !"; @@ -864,7 +845,7 @@ namespace MEDCoupling MCAuto ret(new MEDFileFieldMultiTSWithoutSDA); ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this); int i=0; - for(auto it=this->_time_steps.begin();it!=this->_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=this->_time_steps.begin();it!=this->_time_steps.end();it++,i++) { const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it); if(eltToConv) @@ -914,7 +895,7 @@ namespace MEDCoupling if(!mm) throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS::extractPart : mesh is null !"); MCAuto::FMTSType> fmtsOut(MLFieldTraits::FMTSType::New()); - int const nbTS(getNumberOfTS()); + int nbTS(getNumberOfTS()); for(int i=0;i f1ts(getTimeStepAtPos(i)); @@ -1291,7 +1272,7 @@ namespace MEDCoupling const MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content); if(!pt) throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS::contentNotNull : the content pointer is null !"); - const auto *ret=dynamic_cast::FMTSWSDAType *>(pt); + const typename MLFieldTraits::FMTSWSDAType *ret=dynamic_cast::FMTSWSDAType *>(pt); if(!ret) throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS::contentNotNull : the content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !"); return ret; @@ -1325,7 +1306,7 @@ namespace MEDCoupling std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !"; throw INTERP_KERNEL::Exception(oss.str()); } - const auto *itemC=dynamic_cast::F1TSWSDAType *>(item); + const typename MLFieldTraits::F1TSWSDAType *itemC=dynamic_cast::F1TSWSDAType *>(item); if(itemC) { MCAuto::F1TSType> ret(MLFieldTraits::F1TSType::New(*itemC,false)); @@ -1377,7 +1358,7 @@ namespace MEDCoupling { if(!f1ts) throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !"); - const auto *f1tsC=dynamic_cast::F1TSType *>(f1ts); + const typename MLFieldTraits::F1TSType *f1tsC=dynamic_cast::F1TSType *>(f1ts); if(!f1tsC) { std::ostringstream oss; oss << "MEDFileTemplateFieldMultiTS::checkCoherencyOfType : the input field1TS is not a " << MLFieldTraits::F1TSWSDAType::TYPE_STR << " type !"; @@ -1402,7 +1383,7 @@ namespace MEDCoupling const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(this->_content); if(content) { - const auto *contc=dynamic_cast::FMTSWSDAType *>(content); + const typename MLFieldTraits::FMTSWSDAType *contc=dynamic_cast::FMTSWSDAType *>(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::convertToInt : the content inside this is not INT32 ! This is incoherent !"); MCAuto newc(contc->convertToDouble()); diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index 1927a5f91..8628c2592 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -19,45 +19,13 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileField1TS.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDFileFieldGlobs.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCIdType.hxx" -#include "CellModel.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDFileEntities.hxx" -#include "InterpKernelAutoPtr.hxx" -#include "MEDFileBasis.hxx" -#include "MEDCouplingPartDefinition.hxx" -#include "MEDCouplingFieldDiscretization.hxx" -#include "MEDFileFieldInternal.hxx" #include "MEDFileFieldVisitor.hxx" -#include "MEDFileMesh.hxx" #include "MEDFileSafeCaller.txx" -#include "MEDFileUtilities.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileField.txx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingFieldInt32.hxx" -#include "MEDCouplingFieldInt64.hxx" -#include "NormalizedGeometricTypes" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "med.h" -#include "medfield.h" -#include using namespace MEDCoupling; @@ -89,7 +57,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::deepCpyLeavesFrom(const MEDFileAnyTypeFie { _field_per_mesh.resize(other._field_per_mesh.size()); std::size_t i=0; - for(auto it=other._field_per_mesh.begin();it!=other._field_per_mesh.end();it++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=other._field_per_mesh.begin();it!=other._field_per_mesh.end();it++,i++) { if((const MEDFileFieldPerMesh *)*it) _field_per_mesh[i]=(*it)->deepCopy(this); @@ -98,12 +66,12 @@ void MEDFileAnyTypeField1TSWithoutSDA::deepCpyLeavesFrom(const MEDFileAnyTypeFie void MEDFileAnyTypeField1TSWithoutSDA::accept(MEDFileFieldVisitor& visitor) const { - for(const auto & it : _field_per_mesh) - if(it.isNotNull()) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) { - visitor.newMeshEntry(it); - it->accept(visitor); - visitor.endMeshEntry(it); + visitor.newMeshEntry(*it); + (*it)->accept(visitor); + visitor.endMeshEntry(*it); } } @@ -117,7 +85,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::accept(MEDFileFieldVisitor& visitor) cons */ void MEDFileAnyTypeField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const { - std::string const startOfLine(bkOffset,' '); + std::string startOfLine(bkOffset,' '); oss << startOfLine << "Field "; if(bkOffset==0) oss << "[Type=" << getTypeStr() << "] with name \"" << getName() << "\" "; @@ -133,8 +101,8 @@ void MEDFileAnyTypeField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& os if(f1tsId<0) { oss << startOfLine << "Field has " << comps.size() << " components with the following infos :" << std::endl; - for(const auto & comp : comps) - oss << startOfLine << " - \"" << comp << "\"" << std::endl; + for(std::vector::const_iterator it=comps.begin();it!=comps.end();it++) + oss << startOfLine << " - \"" << (*it) << "\"" << std::endl; } if(arr->isAllocated()) { @@ -151,7 +119,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& os if(!_field_per_mesh.empty()) { int i=0; - for(auto it2=_field_per_mesh.begin();it2!=_field_per_mesh.end();it2++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it2=_field_per_mesh.begin();it2!=_field_per_mesh.end();it2++,i++) { const MEDFileFieldPerMesh *cur=(*it2); if(cur) @@ -172,12 +140,12 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi const DataArray *arr(getUndergroundDataArray()); if(!arr) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitComponents : no array defined !"); - std::size_t const nbOfCompo=arr->getNumberOfComponents(); + std::size_t nbOfCompo=arr->getNumberOfComponents(); std::vector< MCAuto > ret(nbOfCompo); for(std::size_t i=0;i const v(1,i); + std::vector v(1,i); MCAuto arr2=arr->keepSelectedComponents(v); ret[i]->setArray(arr2); } @@ -200,17 +168,17 @@ MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA():_iteration( int MEDFileAnyTypeField1TSWithoutSDA::getDimension() const { int ret=-2; - for(const auto & it : _field_per_mesh) - it->getDimension(ret); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + (*it)->getDimension(ret); return ret; } bool MEDFileAnyTypeField1TSWithoutSDA::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(auto & it : _field_per_mesh) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { - MEDFileFieldPerMesh *cur(it); + MEDFileFieldPerMesh *cur(*it); if(cur) ret=cur->changeMeshNames(modifTab) || ret; } @@ -286,11 +254,11 @@ void MEDFileAnyTypeField1TSWithoutSDA::fillIteration(std::pair& p) cons void MEDFileAnyTypeField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector& types) const { std::set types2; - for(const auto & it : _field_per_mesh) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { - it->fillTypesOfFieldAvailable(types2); + (*it)->fillTypesOfFieldAvailable(types2); } - std::back_insert_iterator< std::vector > const bi(types); + std::back_insert_iterator< std::vector > bi(types); std::copy(types2.begin(),types2.end(),bi); } @@ -310,14 +278,14 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsed2() { std::vector ret; std::set ret2; - for(const auto & it : _field_per_mesh) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { - std::vector const tmp=it->getPflsReallyUsed(); - for(const auto & it2 : tmp) - if(ret2.find(it2)==ret2.end()) + std::vector tmp=(*it)->getPflsReallyUsed(); + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + if(ret2.find(*it2)==ret2.end()) { - ret.push_back(it2); - ret2.insert(it2); + ret.push_back(*it2); + ret2.insert(*it2); } } return ret; @@ -327,14 +295,14 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsed2() { std::vector ret; std::set ret2; - for(const auto & it : _field_per_mesh) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { - std::vector const tmp=it->getLocsReallyUsed(); - for(const auto & it2 : tmp) - if(ret2.find(it2)==ret2.end()) + std::vector tmp=(*it)->getLocsReallyUsed(); + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + if(ret2.find(*it2)==ret2.end()) { - ret.push_back(it2); - ret2.insert(it2); + ret.push_back(*it2); + ret2.insert(*it2); } } return ret; @@ -343,9 +311,9 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsed2() std::vector MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsedMulti2() const { std::vector ret; - for(const auto & it : _field_per_mesh) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { - std::vector tmp=it->getPflsReallyUsedMulti(); + std::vector tmp=(*it)->getPflsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); } return ret; @@ -354,10 +322,10 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsedMult std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsedMulti2() const { std::vector ret; - std::set const ret2; - for(const auto & it : _field_per_mesh) + std::set ret2; + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { - std::vector tmp=it->getLocsReallyUsedMulti(); + std::vector tmp=(*it)->getLocsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); } return ret; @@ -365,14 +333,14 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsedMult void MEDFileAnyTypeField1TSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & it : _field_per_mesh) - it->changePflsRefsNamesGen(mapOfModif); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + (*it)->changePflsRefsNamesGen(mapOfModif); } void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & it : _field_per_mesh) - it->changeLocsRefsNamesGen(mapOfModif); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + (*it)->changeLocsRefsNamesGen(mapOfModif); } /*! @@ -405,7 +373,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector * Length of this and of nested sequences is the same as that of \a typesF. * \throw If no field is lying on \a mname. */ -std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& /*mname*/, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { if(_field_per_mesh.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !"); @@ -453,7 +421,7 @@ std::vector< std::vector< std::pair > > MEDFileAnyTypeField1T * \return int - the maximal absolute dimension of elements \a this fields lies on. * \throw If no field is lying on \a mname. */ -int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& /*mname*/, std::vector& levs) const +int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& mname, std::vector& levs) const { levs.clear(); std::vector types; @@ -469,12 +437,12 @@ int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& /*mn return -1; st.erase(INTERP_KERNEL::NORM_ERROR); std::set ret1; - for(auto it : st) + for(std::set::const_iterator it=st.begin();it!=st.end();it++) { - const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(it); + const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*it); ret1.insert((int)cm.getDimension()); } - int const ret=*std::max_element(ret1.begin(),ret1.end()); + int ret=*std::max_element(ret1.begin(),ret1.end()); std::copy(ret1.rbegin(),ret1.rend(),std::back_insert_iterator >(levs)); std::transform(levs.begin(),levs.end(),levs.begin(),std::bind(std::plus(),std::placeholders::_1,-ret)); return ret; @@ -482,7 +450,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& /*mn void MEDFileAnyTypeField1TSWithoutSDA::convertMedBallIntoClassic() { - for(auto it=_field_per_mesh.begin();it<_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it<_field_per_mesh.end();it++) if((*it).isNotNull()) (*it)->convertMedBallIntoClassic(); } @@ -491,7 +459,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCe { if(!pfl) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : null pfl !"); - std::string const name(pfl->getName()); + std::string name(pfl->getName()); pfl->checkAllocated(); if(pfl->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : non mono compo array !"); @@ -529,7 +497,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCe * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0. */ -MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& /*mName*/, INTERP_KERNEL::NormalizedCellType typ, int locId) +MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) { if(_field_per_mesh.empty()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId : This is empty !"); @@ -542,7 +510,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGive * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0. */ -const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& /*mName*/, INTERP_KERNEL::NormalizedCellType typ, int locId) const +const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const { if(_field_per_mesh.empty()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId : This is empty !"); @@ -558,18 +526,18 @@ int MEDFileAnyTypeField1TSWithoutSDA::getMeshIdFromMeshName(const std::string& m throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No field set !"); if(mName.empty()) return 0; - std::string const mName2(mName); + std::string mName2(mName); int ret=0; std::vector msg; - for(auto it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++) if(mName2==(*it)->getMeshName()) return ret; else msg.push_back((*it)->getMeshName()); std::ostringstream oss; oss << "MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No such mesh \"" << mName2 << "\" as underlying mesh of field \"" << getName() << "\" !\n"; oss << "Possible meshes are : "; - for(const auto & it2 : msg) - oss << "\"" << it2 << "\" "; + for(std::vector::const_iterator it2=msg.begin();it2!=msg.end();it2++) + oss << "\"" << (*it2) << "\" "; throw INTERP_KERNEL::Exception(oss.str()); } @@ -577,7 +545,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe { if(!mesh) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary : input mesh is NULL !"); - std::string const tmp(mesh->getName()); + std::string tmp(mesh->getName()); if(tmp.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::addNewEntryIfNecessary : empty mesh name ! unsupported by MED file !"); setMeshName(tmp); @@ -588,7 +556,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe if((*it)->getMeshName()==tmp) return i; } - std::size_t const sz=_field_per_mesh.size(); + std::size_t sz=_field_per_mesh.size(); _field_per_mesh.resize(sz+1); _field_per_mesh[sz]=MEDFileFieldPerMesh::New(this,mesh); return (int)sz; @@ -598,9 +566,9 @@ bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::st MEDFileFieldGlobsReal& glob) { bool ret=false; - for(auto & it : _field_per_mesh) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { - MEDFileFieldPerMesh *fpm(it); + MEDFileFieldPerMesh *fpm(*it); if(fpm) ret=fpm->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret; } @@ -618,18 +586,18 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::vector types; std::vector< std::vector > typesF; std::vector< std::vector > pfls,locs; - std::vector< std::vector > > const bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs)); + std::vector< std::vector > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs)); std::set allEnt; - for(const auto & it1 : typesF) - for(auto it2 : it1) - allEnt.insert(it2); + for(std::vector< std::vector >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++) + for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) + allEnt.insert(*it2); std::vector< MCAuto > ret(allEnt.size()); - auto it3(allEnt.begin()); + std::set::const_iterator it3(allEnt.begin()); for(std::size_t i=0;i > its; ret[i]=shallowCpy(); - mcIdType const newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its)); + mcIdType newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its)); ret[i]->updateData(newLgth,its); } return ret; @@ -646,14 +614,14 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::vector types; std::vector< std::vector > typesF; std::vector< std::vector > pfls,locs; - std::vector< std::vector > > const bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs)); + std::vector< std::vector > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs)); std::set allEnt; std::size_t nbOfMDPGT(0),ii(0); for(std::vector< std::vector >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++,ii++) { nbOfMDPGT=std::max(nbOfMDPGT,locs[ii].size()); - for(auto it2 : *it1) - allEnt.insert(it2); + for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) + allEnt.insert(*it2); } if(allEnt.size()!=1) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes : this field is expected to be defined only on one spatial discretization !"); @@ -670,7 +638,7 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi { std::vector< std::pair > its; ret[i]=shallowCpy(); - mcIdType const newLgth(ret[i]->keepOnlyGaussDiscretization(i,its)); + mcIdType newLgth(ret[i]->keepOnlyGaussDiscretization(i,its)); ret[i]->updateData(newLgth,its); } return ret; @@ -679,16 +647,16 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its) { mcIdType globalCounter(0); - for(auto & it : _field_per_mesh) - it->keepOnlySpatialDiscretization(tof,globalCounter,its); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + (*it)->keepOnlySpatialDiscretization(tof,globalCounter,its); return globalCounter; } mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its) { mcIdType globalCounter(0); - for(auto & it : _field_per_mesh) - it->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + (*it)->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its); return globalCounter; } @@ -719,12 +687,12 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(mcIdType newLgth, const std::v if(oldArr) newArr->copyStringInfoFrom(*oldArr); mcIdType pos=0; - for(const auto & oldStartStop : oldStartStops) + for(std::vector< std::pair >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++) { - if(oldStartStop.secondsetContigPartOfSelectedValuesSlice(pos,oldArr,oldStartStop.first,oldStartStop.second,1); - pos+=oldStartStop.second-oldStartStop.first; + newArr->setContigPartOfSelectedValuesSlice(pos,oldArr,(*it).first,(*it).second,1); + pos+=(*it).second-(*it).first; } setArray(newArr); return ; @@ -747,7 +715,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::writeLL(med_idt fid, const MEDFileWritabl */ std::string MEDFileAnyTypeField1TSWithoutSDA::FieldNameToMEDFileConvention(const std::string& nonCorrectFieldName) { - std::string::size_type const pos0(nonCorrectFieldName.find_last_not_of(' ')); + std::string::size_type pos0(nonCorrectFieldName.find_last_not_of(' ')); if(pos0==std::string::npos) return nonCorrectFieldName; if(pos0+1==nonCorrectFieldName.length()) @@ -793,7 +761,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_id throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively : unexpected exception internal error !"); _field_per_mesh.resize(1); // - MEDFileMesh *mm(nullptr); + MEDFileMesh *mm(0); if(ms) { mm=ms->getMeshWithName(getMeshName()); @@ -828,27 +796,27 @@ void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_id void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { allocIfNecessaryTheArrayToReceiveDataFromFile(); - for(auto & it : _field_per_mesh) - it->loadBigArraysRecursively(fid,nasc); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + (*it)->loadBigArraysRecursively(fid,nasc); } void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc) { if(allocIfNecessaryTheArrayToReceiveDataFromFile()) - for(auto & it : _field_per_mesh) - it->loadBigArraysRecursively(fid,nasc); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + (*it)->loadBigArraysRecursively(fid,nasc); } void MEDFileAnyTypeField1TSWithoutSDA::loadStructureAndBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities) { - MEDFileCapability const cap(fid); + MEDFileCapability cap(fid); loadOnlyStructureOfDataRecursively(fid,nasc,ms,entities,&cap); loadBigArraysRecursively(fid,nasc); } void MEDFileAnyTypeField1TSWithoutSDA::loadStructureAndBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const PartDefinition *pd, const MEDFileEntities *entities) { - MEDFileCapability const cap(fid); + MEDFileCapability cap(fid); loadOnlyStructureOfDataRecursively(fid,nasc,pd,entities,&cap); loadBigArraysRecursively(fid,nasc); } @@ -873,8 +841,8 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getDirect std::vector ret; if(getUndergroundDataArray()) ret.push_back(getUndergroundDataArray()); - for(const auto & it : _field_per_mesh) - ret.push_back((const MEDFileFieldPerMesh *)it); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + ret.push_back((const MEDFileFieldPerMesh *)*it); return ret; } @@ -897,15 +865,15 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const TimeHolder *th { const MEDCouplingMesh *mesh(field->getMesh()); // - TypeOfField const type(field->getTypeOfField()); - std::vector const dummy; + TypeOfField type(field->getTypeOfField()); + std::vector dummy; if(mesh) setMeshName(mesh->getName()); mcIdType start(copyTinyInfoFrom(th,field,arr)); - int const pos(addNewEntryIfNecessary(mesh)); + int pos(addNewEntryIfNecessary(mesh)); if(type!=ON_NODES) { - std::vector const code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh); + std::vector code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh); _field_per_mesh[pos]->assignFieldNoProfileNoRenum(start,code,field,arr,glob,nasc); } else @@ -943,7 +911,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, con throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input field is null !"); if(!arrOfVals || !arrOfVals->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input array is null or not allocated !"); - TypeOfField const type=field->getTypeOfField(); + TypeOfField type=field->getTypeOfField(); std::vector idsInPflPerType; std::vector idsPerType; std::vector code,code2; @@ -956,7 +924,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, con std::vector idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin()); // start of check MCAuto field2=field->clone(false); - mcIdType const nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3); + mcIdType nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3); if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : The array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !"; @@ -966,7 +934,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, con mcIdType start(copyTinyInfoFrom(th,field,arrOfVals)); code2=m->getDistributionOfTypes(); // - mcIdType const pos=addNewEntryIfNecessary(m); + mcIdType pos=addNewEntryIfNecessary(m); _field_per_mesh[pos]->assignFieldProfile(start,profile,code,code2,idsInPflPerType,idsPerType,field,arrOfVals,m,glob,nasc); } else @@ -975,14 +943,14 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, con throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input profile is null, not allocated or with number of components != 1 !"); std::vector v(3); v[0]=-1; v[1]=profile->getNumberOfTuples(); v[2]=0; std::vector idsPerType3(1); idsPerType3[0]=profile; - mcIdType const nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3); + mcIdType nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3); if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : For node field, the array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } mcIdType start(copyTinyInfoFrom(th,field,arrOfVals)); - mcIdType const pos(addNewEntryIfNecessary(m)); + mcIdType pos(addNewEntryIfNecessary(m)); _field_per_mesh[pos]->assignNodeFieldProfile(start,profile,field,arrOfVals,glob,nasc); } } @@ -1015,7 +983,7 @@ mcIdType MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th { if(!field) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !"); - std::string const name(field->getName()); + std::string name(field->getName()); setName(name.c_str()); if(field->getMesh()) setMeshName(field->getMesh()->getName()); @@ -1035,8 +1003,8 @@ mcIdType MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th } else { - mcIdType const oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples(); - mcIdType const newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples(); + mcIdType oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples(); + mcIdType newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples(); getOrCreateAndGetArray()->reAlloc(newNbOfTuples); _nb_of_tuples_to_be_allocated=-3; return oldNbOfTuples; @@ -1086,9 +1054,9 @@ std::vector& MEDFileAnyTypeField1TSWithoutSDA::getInfo() bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfMultiDiscPerGeoType() const { - for(const auto & it : _field_per_mesh) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { - const MEDFileFieldPerMesh *fpm(it); + const MEDFileFieldPerMesh *fpm(*it); if(!fpm) continue; if(fpm->presenceOfMultiDiscPerGeoType()) @@ -1099,48 +1067,48 @@ bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfMultiDiscPerGeoType() const bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfStructureElements() const { - for(const auto & it : _field_per_mesh) - if(it.isNotNull()) - if(it->presenceOfStructureElements()) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + if((*it)->presenceOfStructureElements()) return true; return false; } bool MEDFileAnyTypeField1TSWithoutSDA::onlyStructureElements() const { - for(const auto & it : _field_per_mesh) - if(it.isNotNull()) - if(!it->onlyStructureElements()) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + if(!(*it)->onlyStructureElements()) return false; return true; } void MEDFileAnyTypeField1TSWithoutSDA::killStructureElements() { - for(auto & it : _field_per_mesh) - if(it.isNotNull()) - it->killStructureElements(); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + (*it)->killStructureElements(); } void MEDFileAnyTypeField1TSWithoutSDA::keepOnlyStructureElements() { - for(auto & it : _field_per_mesh) - if(it.isNotNull()) - it->keepOnlyStructureElements(); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + (*it)->keepOnlyStructureElements(); } void MEDFileAnyTypeField1TSWithoutSDA::keepOnlyOnSE(const std::string& seName) { - for(auto & it : _field_per_mesh) - if(it.isNotNull()) - it->keepOnlyOnSE(seName); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + (*it)->keepOnlyOnSE(seName); } void MEDFileAnyTypeField1TSWithoutSDA::getMeshSENames(std::vector< std::pair >& ps) const { - for(const auto & it : _field_per_mesh) - if(it.isNotNull()) - it->getMeshSENames(ps); + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + (*it)->getMeshSENames(ps); } MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::fieldOnMesh(const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const @@ -1157,14 +1125,14 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::fieldOnMesh(const MEDF pm->fillTypesOfFieldAvailable(types); if(types.size()!=1) throw INTERP_KERNEL::Exception(MSG0); - TypeOfField const type(*types.begin()); + TypeOfField type(*types.begin()); int meshDimRelToMax(0); if(type==ON_NODES) meshDimRelToMax=0; else { int myDim(std::numeric_limits::max()); - bool const isUnique(pm->isUniqueLevel(myDim)); + bool isUnique(pm->isUniqueLevel(myDim)); if(!isUnique) throw INTERP_KERNEL::Exception(MSG0); meshDimRelToMax=myDim-mesh->getMeshDimension(); @@ -1261,8 +1229,8 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(Typ mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder()); else mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder()); - int const absDim=getDimension(); - int const meshDimRelToMax=absDim-mm->getMeshDimension(); + int absDim=getDimension(); + int meshDimRelToMax=absDim-mm->getMeshDimension(); return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm,arrOut,nasc); } @@ -1316,7 +1284,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( } MEDCouplingFieldDiscretization *disc=ret->getDiscretization(); if(!disc) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel : internal error, no discretization on field !"); - std::vector const arrOut2(1,arrOut); + std::vector arrOut2(1,arrOut); // 2 following lines replace ret->renumberCells(cellRenum->getConstPointer()) if not DataArrayDouble disc->renumberArraysForCell(ret->getMesh(),arrOut2,cellRenum->getConstPointer(),true); (const_cast(ret->getMesh()))->renumberCells(cellRenum->getConstPointer(),true); @@ -1403,13 +1371,13 @@ std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingM { if(!mesh) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !"); - std::set const geoTypes=mesh->getAllGeoTypes(); - std::size_t const nbOfTypes=geoTypes.size(); + std::set geoTypes=mesh->getAllGeoTypes(); + std::size_t nbOfTypes=geoTypes.size(); std::vector code(3*nbOfTypes); MCAuto arr1=DataArrayIdType::New(); arr1->alloc(nbOfTypes,1); mcIdType *arrPtr=arr1->getPointer(); - auto it=geoTypes.begin(); + std::set::const_iterator it=geoTypes.begin(); for(std::size_t i=0;i arr2=arr1->checkAndPreparePermutation(); @@ -1417,13 +1385,13 @@ std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingM int i=0; for(it=geoTypes.begin();it!=geoTypes.end();it++,i++) { - mcIdType const pos=arrPtr2[i]; - mcIdType const nbCells=mesh->getNumberOfCellsWithType(*it); + mcIdType pos=arrPtr2[i]; + mcIdType nbCells=mesh->getNumberOfCellsWithType(*it); code[3*pos]=(mcIdType)(*it); code[3*pos+1]=nbCells; code[3*pos+2]=-1;//no profiles } - std::vector const idsPerType;//no profiles + std::vector idsPerType;//no profiles DataArrayIdType *da=mesh->checkTypeConsistencyAndContig(code,idsPerType); if(da) { @@ -1478,12 +1446,12 @@ std::vector< std::vector > MEDFileField1TSWithoutSDA::getFiel if(_field_per_mesh.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !"); std::vector< std::vector< std::pair > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs); - std::size_t const nbOfRet=ret0.size(); + std::size_t nbOfRet=ret0.size(); std::vector< std::vector > ret(nbOfRet); for(std::size_t i=0;i >& p=ret0[i]; - std::size_t const nbOfRet1=p.size(); + std::size_t nbOfRet1=p.size(); ret[i].resize(nbOfRet1); for(std::size_t j=0;j& infos):MEDFileField1TSNDTemplateWithoutSDA(fieldName,meshName,csit,iteration,order,infos) @@ -1636,7 +1605,7 @@ DataArrayInt32 *MEDFileInt32Field1TSWithoutSDA::getUndergroundDataArrayIntExt(st { if(_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); - if(_field_per_mesh[0]==nullptr) + if(_field_per_mesh[0]==0) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !"); _field_per_mesh[0]->getUndergroundDataArrayExt(entries); return getUndergroundDataArrayTemplate(); @@ -1665,7 +1634,8 @@ MEDFileInt64Field1TSWithoutSDA *MEDFileInt64Field1TSWithoutSDA::New(const std::s } MEDFileInt64Field1TSWithoutSDA::MEDFileInt64Field1TSWithoutSDA() -= default; +{ +} MEDFileInt64Field1TSWithoutSDA::MEDFileInt64Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos):MEDFileField1TSNDTemplateWithoutSDA(fieldName,meshName,csit,iteration,order,infos) @@ -1720,7 +1690,7 @@ DataArrayInt64 *MEDFileInt64Field1TSWithoutSDA::getUndergroundDataArrayIntExt(st { if(_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); - if(_field_per_mesh[0]==nullptr) + if(_field_per_mesh[0]==0) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !"); _field_per_mesh[0]->getUndergroundDataArrayExt(entries); return getUndergroundDataArrayTemplate(); @@ -1749,7 +1719,8 @@ MEDFileFloatField1TSWithoutSDA *MEDFileFloatField1TSWithoutSDA::New(const std::s } MEDFileFloatField1TSWithoutSDA::MEDFileFloatField1TSWithoutSDA() -= default; +{ +} MEDFileFloatField1TSWithoutSDA::MEDFileFloatField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos):MEDFileField1TSNDTemplateWithoutSDA(fieldName,meshName,csit,iteration,order,infos) @@ -1804,7 +1775,7 @@ DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt( { if(_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); - if(_field_per_mesh[0]==nullptr) + if(_field_per_mesh[0]==0) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !"); _field_per_mesh[0]->getUndergroundDataArrayExt(entries); return getUndergroundDataArrayTemplate(); @@ -1828,7 +1799,8 @@ MEDFileFloatField1TSWithoutSDA *MEDFileFloatField1TSWithoutSDA::deepCopy() const //= MEDFileAnyTypeField1TS MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS() -= default; +{ +} MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::AllocateContentFrom(med_idt fid, const std::string& fieldName, int iteration, int order) { @@ -1912,8 +1884,8 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::AllocateContentFrom(me if(!found) { std::ostringstream oss; oss << "No such iteration (" << iteration << "," << order << ") in existing field '" << fName << "' in file '" << FileNameFromFID(fid) << "' ! Available iterations are : "; - for(const auto & dtit : dtits) - oss << "(" << dtit.first << "," << dtit.second << "), "; + for(std::vector< std::pair >::const_iterator iter=dtits.begin();iter!=dtits.end();iter++) + oss << "(" << (*iter).first << "," << (*iter).second << "), "; throw INTERP_KERNEL::Exception(oss.str()); } @@ -1923,7 +1895,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::AllocateContentFrom(me MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) { - std::string const useless; + std::string useless; MCAuto ret(AllocateContentFrom(fid,useless)); if(loadAll) ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,entities); @@ -2033,13 +2005,13 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDF MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, bool loadAll) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,loadAll); } MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(med_idt fid, bool loadAll) { - MCAuto c(BuildContentFrom(fid,loadAll,nullptr,nullptr)); + MCAuto c(BuildContentFrom(fid,loadAll,0,0)); MCAuto ret(BuildNewInstanceFromContent(c,fid)); ret->loadGlobals(fid); return ret.retn(); @@ -2048,13 +2020,13 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(med_idt fid, bool loadAll) MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,fieldName,loadAll); } MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(med_idt fid, const std::string& fieldName, bool loadAll) { - MCAuto c(BuildContentFrom(fid,fieldName,loadAll,nullptr,nullptr)); + MCAuto c(BuildContentFrom(fid,fieldName,loadAll,0,0)); MCAuto ret(BuildNewInstanceFromContent(c,fid)); ret->loadGlobals(fid); return ret.retn(); @@ -2062,13 +2034,13 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(med_idt fid, const std::stri MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,fieldName,iteration,order,loadAll); } MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll) { - MCAuto c(BuildContentFrom(fid,fieldName,iteration,order,loadAll,(const MEDFileMeshes *)nullptr,nullptr)); + MCAuto c(BuildContentFrom(fid,fieldName,iteration,order,loadAll,(const MEDFileMeshes *)0,0)); MCAuto ret(BuildNewInstanceFromContent(c,fid)); ret->loadGlobals(fid); return ret.retn(); @@ -2076,13 +2048,13 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(med_idt fid, const std::stri MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return NewAdv(fid,fieldName,iteration,order,loadAll,entities); } MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::NewAdv(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities) { - MCAuto c(BuildContentFrom(fid,fieldName,iteration,order,loadAll,(const MEDFileMeshes *)nullptr,entities)); + MCAuto c(BuildContentFrom(fid,fieldName,iteration,order,loadAll,(const MEDFileMeshes *)0,entities)); MCAuto ret(BuildNewInstanceFromContent(c,fid)); ret->loadGlobals(fid); return ret.retn(); @@ -2125,14 +2097,14 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool c { if(checkFieldId) { - med_int const nbFields=MEDnField(fid); + med_int nbFields=MEDnField(fid); if(fieldIdCFormat>=nbFields) { std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::LocateField2(fileName) : in file \'" << FileNameFromFID(fid) << "\' number of fields is " << nbFields << " ! Trying to request for id " << fieldIdCFormat << " !"; throw INTERP_KERNEL::Exception(oss.str()); } } - med_int const ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1)); + med_int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1)); INTERP_KERNEL::AutoPtr comp(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE)); INTERP_KERNEL::AutoPtr unit(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE)); INTERP_KERNEL::AutoPtr dtunit(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE)); @@ -2157,7 +2129,7 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool c */ int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut, std::string& meshName) { - med_int const nbFields=MEDnField(fid); + med_int nbFields=MEDnField(fid); bool found=false; std::vector fns(nbFields); int nbOfStep2(-1); @@ -2176,8 +2148,8 @@ int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fieldNam if(!found) { std::ostringstream oss; oss << "No such field '" << fieldName << "' in file '" << FileNameFromFID(fid) << "' ! Available fields are : "; - for(const auto & fn : fns) - oss << "\"" << fn << "\" "; + for(std::vector::const_iterator it=fns.begin();it!=fns.end();it++) + oss << "\"" << *it << "\" "; throw INTERP_KERNEL::Exception(oss.str()); } return nbOfStep2; @@ -2204,9 +2176,9 @@ int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fieldNam void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob) { MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); - std::string const oldPflName=disc->getProfile(); + std::string oldPflName=disc->getProfile(); std::vector vv=getPflsReallyUsedMulti(); - std::size_t const nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName); + std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName); if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1)) { disc->setProfile(newPflName); @@ -2242,9 +2214,9 @@ void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTE void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob) { MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); - std::string const oldLocName=disc->getLocalization(); + std::string oldLocName=disc->getLocalization(); std::vector vv=getLocsReallyUsedMulti(); - std::size_t const nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName); + std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName); if(forceRenameOnGlob || (!existsLoc(newLocName) && nbOfOcc==1)) { disc->setLocalization(newLocName); @@ -2286,7 +2258,7 @@ void MEDFileAnyTypeField1TS::loadArrays() { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::loadArrays : the structure does not come from a file !"); - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName())); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName())); contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase()); } @@ -2301,7 +2273,7 @@ void MEDFileAnyTypeField1TS::loadArraysIfNecessary() { if(!getFileName().empty()) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName())); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName())); contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase()); } } @@ -2333,12 +2305,12 @@ void MEDFileAnyTypeField1TS::unloadArraysWithoutDataLoss() void MEDFileAnyTypeField1TS::writeLL(med_idt fid) const { - std::size_t const nbComp(getNumberOfComponents()); + std::size_t nbComp(getNumberOfComponents()); INTERP_KERNEL::AutoPtr comp(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE)); INTERP_KERNEL::AutoPtr unit(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE)); for(std::size_t i=0;i > MEDFileAnyTypeField1TS::splitCom if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitComponents : no content in this ! Unable to split components !"); std::vector< MCAuto > contentsSplit=content->splitComponents(); - std::size_t const sz(contentsSplit.size()); + std::size_t sz(contentsSplit.size()); std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz); for(std::size_t i=0;i > MEDFileAnyTypeField1TS::splitDis if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitDiscretizations : no content in this ! Unable to split discretization !"); std::vector< MCAuto > contentsSplit(content->splitDiscretizations()); - std::size_t const sz(contentsSplit.size()); + std::size_t sz(contentsSplit.size()); std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz); for(std::size_t i=0;i > MEDFileAnyTypeField1TS::splitMul if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretization !"); std::vector< MCAuto > contentsSplit(content->splitMultiDiscrPerGeoTypes()); - std::size_t const sz(contentsSplit.size()); + std::size_t sz(contentsSplit.size()); std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz); for(std::size_t i=0;i(content); + const MEDFileField1TSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !"); MCAuto newc(contc->convertToInt()); @@ -2703,7 +2675,7 @@ MEDFileInt64Field1TS *MEDFileField1TS::convertToInt64(bool isDeepCpyGlobs) const const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(content) { - const auto *contc=dynamic_cast(content); + const MEDFileField1TSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !"); MCAuto newc(contc->convertToInt64()); @@ -2780,8 +2752,8 @@ MCAuto MEDFileInt32Field1TS::ConvertFieldIntToFieldDoubl if(!f) throw INTERP_KERNEL::Exception("MEDFileInt32Field1TS::ConvertFieldIntToFieldDouble : null input field !"); int t1,t2; - double const t0(f->getTime(t1,t2)); - std::string const tu(f->getTimeUnit()); + double t0(f->getTime(t1,t2)); + std::string tu(f->getTimeUnit()); MCAuto ft(MEDCouplingFieldTemplate::New(*f)); MCAuto ret(MEDCouplingFieldDouble::New(*ft)); ret->setTime(t0,t1,t2); ret->setTimeUnit(tu); @@ -2800,8 +2772,8 @@ MCAuto MEDFileInt64Field1TS::ConvertFieldIntToFieldDoubl if(!f) throw INTERP_KERNEL::Exception("MEDFileInt64Field1TS::ConvertFieldIntToFieldDouble : null input field !"); int t1,t2; - double const t0(f->getTime(t1,t2)); - std::string const tu(f->getTimeUnit()); + double t0(f->getTime(t1,t2)); + std::string tu(f->getTimeUnit()); MCAuto ft(MEDCouplingFieldTemplate::New(*f)); MCAuto ret(MEDCouplingFieldDouble::New(*ft)); ret->setTime(t0,t1,t2); ret->setTimeUnit(tu); diff --git a/src/MEDLoader/MEDFileField1TS.hxx b/src/MEDLoader/MEDFileField1TS.hxx index 394ab88d0..007239a91 100644 --- a/src/MEDLoader/MEDFileField1TS.hxx +++ b/src/MEDLoader/MEDFileField1TS.hxx @@ -21,25 +21,12 @@ #ifndef __MEDFILEFIELD1TS_HXX__ #define __MEDFILEFIELD1TS_HXX__ -#include "MEDCouplingRefCountObject.hxx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingTraits.hxx" -#include "MEDFileUtilities.txx" #include "MEDLoaderDefines.hxx" #include "MEDFileFieldGlobs.hxx" #include "MEDFileFieldInternal.hxx" #include "MEDLoaderTraits.hxx" -#include "NormalizedGeometricTypes" #include "med.h" -#include -#include -#include -#include -#include -#include namespace MEDCoupling { @@ -97,8 +84,8 @@ namespace MEDCoupling MEDLOADER_EXPORT void keepOnlyOnSE(const std::string& seName); MEDLOADER_EXPORT void getMeshSENames(std::vector< std::pair >& ps) const; MEDLOADER_EXPORT void setInfo(const std::vector& infos); - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr); MEDLOADER_EXPORT void setFieldNoProfileSBT(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true); @@ -166,15 +153,15 @@ namespace MEDCoupling MEDFileField1TSTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order):MEDFileAnyTypeField1TSWithoutSDA(fieldName,meshName,csit,iteration,order) { } MEDFileField1TSTemplateWithoutSDA() { } public: - MEDLOADER_EXPORT void setArray(DataArray *arr) override; - MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const override; + MEDLOADER_EXPORT void setArray(DataArray *arr); + MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const; MEDLOADER_EXPORT typename Traits::ArrayType *getOrCreateAndGetArrayTemplate(); MEDLOADER_EXPORT typename Traits::ArrayType const *getOrCreateAndGetArrayTemplate() const; MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayTemplate() const; MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray() override; - MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const override; - MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const override; + MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray(); + MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const; MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair > >& dts); MEDLOADER_EXPORT void copyTimeInfoFrom(const typename Traits::FieldType *mcf); protected: @@ -187,9 +174,9 @@ namespace MEDCoupling class MEDFileField1TSWithoutSDA : public MEDFileField1TSTemplateWithoutSDA { public: - MEDLOADER_EXPORT const char *getTypeStr() const override; + MEDLOADER_EXPORT const char *getTypeStr() const; MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileField1TSWithoutSDA"); } - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const override; + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax); MEDLOADER_EXPORT static std::vector CheckSBTMesh(const MEDCouplingMesh *mesh); @@ -197,8 +184,8 @@ namespace MEDCoupling public: MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(); MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); - MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const override; - MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const override; + MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const; + MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *convertToInt() const; MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *convertToInt64() const; MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *convertToFloat() const; @@ -213,7 +200,7 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *convertToDouble() const; protected: MEDFileField1TSNDTemplateWithoutSDA() { } - MEDFileField1TSNDTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& /*infos*/):MEDFileField1TSTemplateWithoutSDA(fieldName,meshName,csit,iteration,order) { } + MEDFileField1TSNDTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos):MEDFileField1TSTemplateWithoutSDA(fieldName,meshName,csit,iteration,order) { } }; /*! @@ -225,10 +212,10 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA(); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32Field1TSWithoutSDA"); } MEDLOADER_EXPORT static MEDFileInt32Field1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); - MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *deepCopy() const override; - MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *shallowCpy() const override; - MEDLOADER_EXPORT const char *getTypeStr() const override; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const override; + MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *deepCopy() const; + MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *shallowCpy() const; + MEDLOADER_EXPORT const char *getTypeStr() const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT DataArrayInt32 *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; protected: MEDFileInt32Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); @@ -245,10 +232,10 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA(); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64Field1TSWithoutSDA"); } MEDLOADER_EXPORT static MEDFileInt64Field1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); - MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *deepCopy() const override; - MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *shallowCpy() const override; - MEDLOADER_EXPORT const char *getTypeStr() const override; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const override; + MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *deepCopy() const; + MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *shallowCpy() const; + MEDLOADER_EXPORT const char *getTypeStr() const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT DataArrayInt64 *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; protected: MEDFileInt64Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); @@ -265,10 +252,10 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA(); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFloatField1TSWithoutSDA"); } MEDLOADER_EXPORT static MEDFileFloatField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); - MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *deepCopy() const override; - MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *shallowCpy() const override; - MEDLOADER_EXPORT const char *getTypeStr() const override; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const override; + MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *deepCopy() const; + MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *shallowCpy() const; + MEDLOADER_EXPORT const char *getTypeStr() const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT DataArrayFloat *getUndergroundDataArrayFloatExt(std::vector< std::pair,std::pair > >& entries) const; protected: MEDFileFloatField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); @@ -283,9 +270,9 @@ namespace MEDCoupling { protected: MEDLOADER_EXPORT MEDFileAnyTypeField1TS(); - MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr); - MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr); - MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr); + MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); + MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); + MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileAnyTypeField1TS"); } MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c); @@ -295,7 +282,7 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, int iteration, int order, const PartDefinition *pd, const MEDFileEntities *entities); MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *AllocateContentFrom(med_idt fid, const std::string& fieldName, int iteration=-1, int order=-1); - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; // direct forwarding to MEDFileAnyTypeField1TSWithoutSDA instance _content public: MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true); @@ -360,14 +347,14 @@ namespace MEDCoupling MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false); //! underground method see MEDFileField1TSWithoutSDA::setLocNameOnLeaf MEDLOADER_EXPORT void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false); - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT std::vector getPflsReallyUsed() const override; - MEDLOADER_EXPORT std::vector getLocsReallyUsed() const override; - MEDLOADER_EXPORT std::vector getPflsReallyUsedMulti() const override; - MEDLOADER_EXPORT std::vector getLocsReallyUsedMulti() const override; - MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) override; - MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; + MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; + MEDLOADER_EXPORT std::vector getPflsReallyUsedMulti() const; + MEDLOADER_EXPORT std::vector getLocsReallyUsedMulti() const; + MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); + MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); public: MEDLOADER_EXPORT static int LocateField2(med_idt fid, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut, std::string& meshName); MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut, std::string& meshName); @@ -415,9 +402,9 @@ namespace MEDCoupling MEDLOADER_EXPORT void setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDLOADER_EXPORT typename MLFieldTraits::F1TSType *extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const; - MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const override { return this->extractPartImpl(extractDef,mm); } + MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); } protected: - ~MEDFileTemplateField1TS() override = default; + ~MEDFileTemplateField1TS() { } MEDFileTemplateField1TS(); MEDFileTemplateField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileAnyTypeField1TS(fid,loadAll,ms) { } MEDFileTemplateField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileAnyTypeField1TS(fid,fieldName,loadAll,ms) { } @@ -438,16 +425,16 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const; MEDLOADER_EXPORT MEDFileInt64Field1TS *convertToInt64(bool isDeepCpyGlobs=true) const; public: - MEDLOADER_EXPORT MCAuto buildNewEmpty() const override; - MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const override; + MEDLOADER_EXPORT MCAuto buildNewEmpty() const; + MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const; MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileField1TS"); } public: private: - med_field_type getMEDFileFieldType() const override { return MED_FLOAT64; } + med_field_type getMEDFileFieldType() const { return MED_FLOAT64; } private: - ~MEDFileField1TS() override = default; + ~MEDFileField1TS() { } MEDFileField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); MEDFileField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); MEDFileField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); @@ -463,7 +450,7 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileField1TS *convertToInt(bool isDeepCpyGlobs=true) const; MEDLOADER_EXPORT MEDFileField1TS *convertToInt64(bool isDeepCpyGlobs=true) const; protected: - ~MEDFileNDTemplateField1TS() override = default; + ~MEDFileNDTemplateField1TS() { } MEDFileNDTemplateField1TS() { } MEDFileNDTemplateField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateField1TS(fid,loadAll,ms) { } MEDFileNDTemplateField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateField1TS(fid,fieldName,loadAll,ms) { } @@ -475,15 +462,15 @@ namespace MEDCoupling { friend class MEDFileTemplateField1TS; public: - MEDLOADER_EXPORT MCAuto buildNewEmpty() const override; - MEDLOADER_EXPORT MEDFileInt32Field1TS *shallowCpy() const override { return new MEDFileInt32Field1TS(*this); } + MEDLOADER_EXPORT MCAuto buildNewEmpty() const; + MEDLOADER_EXPORT MEDFileInt32Field1TS *shallowCpy() const { return new MEDFileInt32Field1TS(*this); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32Field1TS"); } public: MEDLOADER_EXPORT static MCAuto ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt32 *f); private: - med_field_type getMEDFileFieldType() const override { return MED_INT32; } + med_field_type getMEDFileFieldType() const { return MED_INT32; } private: - ~MEDFileInt32Field1TS() override = default; + ~MEDFileInt32Field1TS() { } MEDFileInt32Field1TS() { } MEDFileInt32Field1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,loadAll,ms) { } MEDFileInt32Field1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,fieldName,loadAll,ms) { } @@ -501,15 +488,15 @@ namespace MEDCoupling { friend class MEDFileTemplateField1TS; public: - MEDLOADER_EXPORT MCAuto buildNewEmpty() const override; - MEDLOADER_EXPORT MEDFileInt64Field1TS *shallowCpy() const override { return new MEDFileInt64Field1TS(*this); } + MEDLOADER_EXPORT MCAuto buildNewEmpty() const; + MEDLOADER_EXPORT MEDFileInt64Field1TS *shallowCpy() const { return new MEDFileInt64Field1TS(*this); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64Field1TS"); } public: MEDLOADER_EXPORT static MCAuto ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt64 *f); private: - med_field_type getMEDFileFieldType() const override { return MED_INT64; } + med_field_type getMEDFileFieldType() const { return MED_INT64; } private: - ~MEDFileInt64Field1TS() override = default; + ~MEDFileInt64Field1TS() { } MEDFileInt64Field1TS() { } MEDFileInt64Field1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,loadAll,ms) { } MEDFileInt64Field1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,fieldName,loadAll,ms) { } @@ -527,12 +514,12 @@ namespace MEDCoupling { friend class MEDFileTemplateField1TS; private: - med_field_type getMEDFileFieldType() const override { return MED_FLOAT32; } - MEDLOADER_EXPORT MEDFileFloatField1TS *shallowCpy() const override { return new MEDFileFloatField1TS(*this); } + med_field_type getMEDFileFieldType() const { return MED_FLOAT32; } + MEDLOADER_EXPORT MEDFileFloatField1TS *shallowCpy() const { return new MEDFileFloatField1TS(*this); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFloatField1TS"); } - MEDLOADER_EXPORT MCAuto buildNewEmpty() const override; + MEDLOADER_EXPORT MCAuto buildNewEmpty() const; private: - ~MEDFileFloatField1TS() override = default; + ~MEDFileFloatField1TS() { } MEDFileFloatField1TS() { } MEDFileFloatField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,loadAll,ms) { } MEDFileFloatField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,fieldName,loadAll,ms) { } diff --git a/src/MEDLoader/MEDFileFieldGlobs.cxx b/src/MEDLoader/MEDFileFieldGlobs.cxx index f3772e81d..f8e2a9bc1 100644 --- a/src/MEDLoader/MEDFileFieldGlobs.cxx +++ b/src/MEDLoader/MEDFileFieldGlobs.cxx @@ -19,33 +19,24 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileFieldGlobs.hxx" -#include "MCAuto.hxx" -#include "MEDFileBasis.hxx" -#include "MEDCouplingRefCountObject.hxx" +#include "MEDFileField.txx" #include "MEDFileMesh.hxx" #include "MEDLoaderBase.hxx" +#include "MEDLoaderTraits.hxx" #include "MEDFileSafeCaller.txx" #include "MEDFileFieldOverView.hxx" -#include "MEDFileFieldInternal.hxx" +#include "MEDFileBlowStrEltUp.hxx" +#include "MEDFileFieldVisitor.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDCouplingFieldDiscretization.hxx" #include "MCType.hxx" #include "InterpKernelAutoPtr.hxx" -#include "med.h" -#include "medprofile.h" -#include "medlocalization.h" -#include "NormalizedGeometricTypes" +#include "CellModel.hxx" #include -#include #include -#include -#include -#include -#include -#include -#include using namespace MEDCoupling; @@ -54,7 +45,7 @@ void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int id, const std::string if(id>=(int)_pfls.size()) _pfls.resize(id+1); MCAuto miPfl=DataArrayMedInt::New(); - med_int const lgth(MEDprofileSizeByName(fid,pflName.c_str())); + med_int lgth(MEDprofileSizeByName(fid,pflName.c_str())); miPfl->setName(pflName); miPfl->alloc(lgth,1); MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),miPfl->getPointer())); @@ -67,7 +58,7 @@ void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int i) INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); med_int sz; MEDFILESAFECALLERRD0(MEDprofileInfo,(fid,i+1,pflName,&sz)); - std::string const pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE); + std::string pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE); if(i>=(int)_pfls.size()) _pfls.resize(i+1); MCAuto miPfl=DataArrayMedInt::New(); @@ -80,7 +71,7 @@ void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int i) void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) const { - std::size_t const nbOfPfls=_pfls.size(); + std::size_t nbOfPfls=_pfls.size(); for(std::size_t i=0;i cpy=DataArrayMedInt_Copy((const DataArrayIdType*)_pfls[i]); @@ -90,7 +81,7 @@ void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) co MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,ToMedInt(_pfls[i]->getNumberOfTuples()),cpy->getConstPointer())); } // - std::size_t const nbOfLocs=_locs.size(); + std::size_t nbOfLocs=_locs.size(); for(std::size_t i=0;iwriteLL(fid); } @@ -98,37 +89,37 @@ void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) co void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) { std::vector pfls=getPfls(); - for(const auto & _pfl : other._pfls) + for(std::vector< MCAuto >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++) { - auto const it2=std::find(pfls.begin(),pfls.end(),_pfl->getName()); + std::vector::iterator it2=std::find(pfls.begin(),pfls.end(),(*it)->getName()); if(it2==pfls.end()) { - _pfls.push_back(_pfl); + _pfls.push_back(*it); } else { - std::size_t const id=std::distance(pfls.begin(),it2); - if(!_pfl->isEqual(*_pfls[id])) + std::size_t id=std::distance(pfls.begin(),it2); + if(!(*it)->isEqual(*_pfls[id])) { - std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Profile \"" << _pfl->getName() << "\" already exists and is different from those expecting to be append !"; + std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Profile \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !"; throw INTERP_KERNEL::Exception(oss.str()); } } } std::vector locs=getLocs(); - for(const auto & _loc : other._locs) + for(std::vector< MCAuto >::const_iterator it=other._locs.begin();it!=other._locs.end();it++) { - auto const it2=std::find(locs.begin(),locs.end(),_loc->getName()); + std::vector::iterator it2=std::find(locs.begin(),locs.end(),(*it)->getName()); if(it2==locs.end()) { - _locs.push_back(_loc); + _locs.push_back(*it); } else { - std::size_t const id=std::distance(locs.begin(),it2); - if(!_loc->isEqual(*_locs[id],eps)) + std::size_t id=std::distance(locs.begin(),it2); + if(!(*it)->isEqual(*_locs[id],eps)) { - std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Localization \"" << _loc->getName() << "\" already exists and is different from those expecting to be append !"; + std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Localization \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !"; throw INTERP_KERNEL::Exception(oss.str()); } } @@ -137,14 +128,14 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) void MEDFileFieldGlobs::checkGlobsPflsPartCoherency(const std::vector& pflsUsed) const { - for(const auto & it : pflsUsed) - getProfile(it.c_str()); + for(std::vector::const_iterator it=pflsUsed.begin();it!=pflsUsed.end();it++) + getProfile((*it).c_str()); } void MEDFileFieldGlobs::checkGlobsLocsPartCoherency(const std::vector& locsUsed) const { - for(const auto & it : locsUsed) - getLocalization(it.c_str()); + for(std::vector::const_iterator it=locsUsed.begin();it!=locsUsed.end();it++) + getLocalization((*it).c_str()); } void MEDFileFieldGlobs::loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real) @@ -155,7 +146,7 @@ void MEDFileFieldGlobs::loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& re for(unsigned int i=0;i const locs=real.getLocsReallyUsed(); + std::vector locs=real.getLocsReallyUsed(); sz=locs.size(); _locs.resize(sz); for(std::size_t i=0;i MEDFileFieldGlobs::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _pfl : _pfls) - ret.push_back((const DataArrayIdType *)_pfl); - for(const auto & _loc : _locs) - ret.push_back((const MEDFileFieldLoc *)_loc); + for(std::vector< MCAuto< DataArrayIdType > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) + ret.push_back((const DataArrayIdType *)*it); + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++) + ret.push_back((const MEDFileFieldLoc *)*it); return ret; } @@ -204,13 +195,13 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCopy() const { MCAuto ret=new MEDFileFieldGlobs(*this); std::size_t i=0; - for(auto it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { if((const DataArrayIdType *)*it) ret->_pfls[i]=(*it)->deepCopy(); } i=0; - for(auto it=_locs.begin();it!=_locs.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) { if((const MEDFileFieldLoc*)*it) ret->_locs[i]=(*it)->deepCopy(); @@ -226,22 +217,22 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCopy() const MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector& pfls, const std::vector& locs) const { MCAuto ret=MEDFileFieldGlobs::New(); - for(const auto & it1 : pfls) + for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { - DataArrayIdType *pfl=const_cast(getProfile(it1.c_str())); + DataArrayIdType *pfl=const_cast(getProfile((*it1).c_str())); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! pfl null !"); pfl->incrRef(); - MCAuto const pfl2(pfl); + MCAuto pfl2(pfl); ret->_pfls.push_back(pfl2); } - for(const auto & it2 : locs) + for(std::vector::const_iterator it2=locs.begin();it2!=locs.end();it2++) { - MEDFileFieldLoc *loc=const_cast(&getLocalization(it2.c_str())); + MEDFileFieldLoc *loc=const_cast(&getLocalization((*it2).c_str())); if(!loc) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! loc null !"); loc->incrRef(); - MCAuto const loc2(loc); + MCAuto loc2(loc); ret->_locs.push_back(loc2); } ret->setFileName(getFileName()); @@ -256,16 +247,16 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector& pfls, const std::vector& locs) const { MCAuto ret=MEDFileFieldGlobs::New(); - for(const auto & it1 : pfls) + for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { - DataArrayIdType *pfl=const_cast(getProfile(it1.c_str())); + DataArrayIdType *pfl=const_cast(getProfile((*it1).c_str())); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! pfl null !"); ret->_pfls.push_back(pfl->deepCopy()); } - for(const auto & it2 : locs) + for(std::vector::const_iterator it2=locs.begin();it2!=locs.end();it2++) { - MEDFileFieldLoc *loc=const_cast(&getLocalization(it2.c_str())); + MEDFileFieldLoc *loc=const_cast(&getLocalization((*it2).c_str())); if(!loc) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! loc null !"); ret->_locs.push_back(loc->deepCopy()); @@ -279,10 +270,12 @@ MEDFileFieldGlobs::MEDFileFieldGlobs(med_idt fid):_file_name(MEDFileWritable::Fi } MEDFileFieldGlobs::MEDFileFieldGlobs() -= default; +{ +} MEDFileFieldGlobs::~MEDFileFieldGlobs() -= default; +{ +} void MEDFileFieldGlobs::simpleRepr(std::ostream& oss) const { @@ -312,17 +305,17 @@ void MEDFileFieldGlobs::simpleRepr(std::ostream& oss) const void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & _pfl : _pfls) + for(std::vector< MCAuto >::iterator it=_pfls.begin();it!=_pfls.end();it++) { - DataArrayIdType *elt(_pfl); + DataArrayIdType *elt(*it); if(elt) { - std::string const name(elt->getName()); - for(const auto & it2 : mapOfModif) + std::string name(elt->getName()); + for(std::vector< std::pair, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++) { - if(std::find(it2.first.begin(),it2.first.end(),name)!=it2.first.end()) + if(std::find((*it2).first.begin(),(*it2).first.end(),name)!=(*it2).first.end()) { - elt->setName(it2.second.c_str()); + elt->setName((*it2).second.c_str()); return; } } @@ -332,17 +325,17 @@ void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & _loc : _locs) + for(std::vector< MCAuto >::iterator it=_locs.begin();it!=_locs.end();it++) { - MEDFileFieldLoc *elt(_loc); + MEDFileFieldLoc *elt(*it); if(elt) { - std::string const name(elt->getName()); - for(const auto & it2 : mapOfModif) + std::string name(elt->getName()); + for(std::vector< std::pair, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++) { - if(std::find(it2.first.begin(),it2.first.end(),name)!=it2.first.end()) + if(std::find((*it2).first.begin(),(*it2).first.end(),name)!=(*it2).first.end()) { - elt->setName(it2.second.c_str()); + elt->setName((*it2).second.c_str()); return; } } @@ -394,7 +387,7 @@ namespace MEDCouplingImpl int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const { - auto it=std::find_if(_locs.begin(),_locs.end(),MEDCouplingImpl::LocFinder(loc)); + std::vector< MCAuto >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),MEDCouplingImpl::LocFinder(loc)); if(it==_locs.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getLocalisationId : no such localisation name : \"" << loc << "\" Possible localizations are : "; @@ -407,7 +400,7 @@ int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const { - auto it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl)); + std::vector< MCAuto >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl)); if(it==_pfls.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfileId : no such profile name : \"" << pfl << "\" Possible localizations are : "; @@ -450,8 +443,8 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const std::string& locName) */ DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName) { - std::string const pflNameCpp(pflName); - auto it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); + std::string pflNameCpp(pflName); + std::vector< MCAuto >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); if(it==_pfls.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : "; @@ -496,19 +489,19 @@ void MEDFileFieldGlobs::killLocalizationIds(const std::vector& locIds) void MEDFileFieldGlobs::killStructureElementsInGlobs() { std::vector< MCAuto > newLocs; - for(auto & _loc : _locs) + for(std::vector< MCAuto >::iterator it=_locs.begin();it!=_locs.end();it++) { - if(_loc.isNull()) + if((*it).isNull()) continue; - if(!_loc->isOnStructureElement()) - newLocs.push_back(_loc); + if(!(*it)->isOnStructureElement()) + newLocs.push_back(*it); } _locs=newLocs; } std::vector MEDFileFieldGlobs::getPfls() const { - std::size_t const sz=_pfls.size(); + std::size_t sz=_pfls.size(); std::vector ret(sz); for(std::size_t i=0;igetName(); @@ -517,7 +510,7 @@ std::vector MEDFileFieldGlobs::getPfls() const std::vector MEDFileFieldGlobs::getLocs() const { - std::size_t const sz=_locs.size(); + std::size_t sz=_locs.size(); std::vector ret(sz); for(std::size_t i=0;igetName(); @@ -527,14 +520,14 @@ std::vector MEDFileFieldGlobs::getLocs() const bool MEDFileFieldGlobs::existsPfl(const std::string& pflName) const { std::vector v=getPfls(); - std::string const s(pflName); + std::string s(pflName); return std::find(v.begin(),v.end(),s)!=v.end(); } bool MEDFileFieldGlobs::existsLoc(const std::string& locName) const { std::vector v=getLocs(); - std::string const s(locName); + std::string s(locName); return std::find(v.begin(),v.end(),s)!=v.end(); } @@ -542,7 +535,7 @@ std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualProfiles() const { std::map > m; int i=0; - for(auto it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { const DataArrayIdType *tmp=(*it); if(tmp) @@ -557,9 +550,9 @@ std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualProfiles() const { std::vector ret0; bool equalityOrNot=false; - for(auto it3=(*it2).second.begin();it3!=(*it2).second.end();it3++) + for(std::vector::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++) { - auto it4=it3; it4++; + std::vector::const_iterator it4=it3; it4++; for(;it4!=(*it2).second.end();it4++) { if(_pfls[*it3]->isEqualWithoutConsideringStr(*_pfls[*it4])) @@ -578,20 +571,20 @@ std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualProfiles() const return ret; } -std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualLocs(double /*eps*/) const +std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualLocs(double eps) const { throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::whichAreEqualLocs : no implemented yet ! Sorry !"); } void MEDFileFieldGlobs::appendProfile(DataArrayIdType *pfl) { - std::string const name(pfl->getName()); + std::string name(pfl->getName()); if(name.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendProfile : unsupported profiles with no name !"); - for(const auto & _pfl : _pfls) - if(name==_pfl->getName()) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) + if(name==(*it)->getName()) { - if(!pfl->isEqual(*_pfl)) + if(!pfl->isEqual(*(*it))) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendProfile : profile \"" << name << "\" already exists and is different from existing !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -603,14 +596,14 @@ void MEDFileFieldGlobs::appendProfile(DataArrayIdType *pfl) void MEDFileFieldGlobs::appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) { - std::string const name(locName); + std::string name(locName); if(name.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendLoc : unsupported localizations with no name !"); MCAuto obj=MEDFileFieldLoc::New(locName,geoType,refCoo,gsCoo,w); - for(const auto & _loc : _locs) - if(_loc->isName(locName)) + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++) + if((*it)->isName(locName)) { - if(!_loc->isEqual(*obj,1e-12)) + if(!(*it)->isEqual(*obj,1e-12)) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendLoc : localization \"" << name << "\" already exists and is different from existing !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -621,13 +614,13 @@ void MEDFileFieldGlobs::appendLoc(const std::string& locName, INTERP_KERNEL::Nor std::string MEDFileFieldGlobs::createNewNameOfPfl() const { - std::vector const names=getPfls(); + std::vector names=getPfls(); return CreateNewNameNotIn("NewPfl_",names); } std::string MEDFileFieldGlobs::createNewNameOfLoc() const { - std::vector const names=getLocs(); + std::vector names=getLocs(); return CreateNewNameNotIn("NewLoc_",names); } @@ -678,7 +671,7 @@ void MEDFileFieldGlobsReal::simpleReprGlobs(std::ostream& oss) const { const MEDFileFieldGlobs *glob=_globals; std::ostringstream oss2; oss2 << glob; - std::string const stars(oss2.str().length(),'*'); + std::string stars(oss2.str().length(),'*'); oss << "Globals information on fields (at " << oss2.str() << "):" << "\n************************************" << stars << "\n\n"; if(glob) glob->simpleRepr(oss); @@ -697,7 +690,8 @@ void MEDFileFieldGlobsReal::killStructureElementsInGlobs() } MEDFileFieldGlobsReal::~MEDFileFieldGlobsReal() -= default; +{ +} /*! * Copies references to profiles and Gauss points from another MEDFileFieldGlobsReal. @@ -951,7 +945,7 @@ void MEDFileFieldGlobsReal::changeLocsNames(const std::vector< std::pair, std::string > > mapOfModif(1); - std::pair, std::string > const p(std::vector(1,std::string(oldName)),std::string(newName)); + std::pair, std::string > p(std::vector(1,std::string(oldName)),std::string(newName)); mapOfModif[0]=p; changePflsNames(mapOfModif); } @@ -965,7 +959,7 @@ void MEDFileFieldGlobsReal::changePflName(const std::string& oldName, const std: void MEDFileFieldGlobsReal::changeLocName(const std::string& oldName, const std::string& newName) { std::vector< std::pair, std::string > > mapOfModif(1); - std::pair, std::string > const p(std::vector(1,std::string(oldName)),std::string(newName)); + std::pair, std::string > p(std::vector(1,std::string(oldName)),std::string(newName)); mapOfModif[0]=p; changeLocsNames(mapOfModif); } @@ -989,11 +983,11 @@ std::vector< std::pair, std::string > > MEDFileFieldGlo { std::vector< std::string > tmp((*it).size()); int j=0; - for(auto it2=(*it).begin();it2!=(*it).end();it2++,j++) + for(std::vector::const_iterator it2=(*it).begin();it2!=(*it).end();it2++,j++) tmp[j]=std::string(getProfileFromId(*it2)->getName()); - std::pair, std::string > const p(tmp,tmp.front()); + std::pair, std::string > p(tmp,tmp.front()); ret[i]=p; - std::vector const tmp2((*it).begin()+1,(*it).end()); + std::vector tmp2((*it).begin()+1,(*it).end()); killProfileIds(tmp2); } changePflsRefsNamesGen(ret); @@ -1020,11 +1014,11 @@ std::vector< std::pair, std::string > > MEDFileFieldGlo { std::vector< std::string > tmp((*it).size()); int j=0; - for(auto it2=(*it).begin();it2!=(*it).end();it2++,j++) + for(std::vector::const_iterator it2=(*it).begin();it2!=(*it).end();it2++,j++) tmp[j]=std::string(getLocalizationFromId(*it2).getName()); - std::pair, std::string > const p(tmp,tmp.front()); + std::pair, std::string > p(tmp,tmp.front()); ret[i]=p; - std::vector const tmp2((*it).begin()+1,(*it).end()); + std::vector tmp2((*it).begin()+1,(*it).end()); killLocalizationIds(tmp2); } changeLocsRefsNamesGen(ret); @@ -1229,7 +1223,8 @@ const MEDFileFieldGlobs *MEDFileFieldGlobsReal::contentNotNull() const //= MEDFileFieldNameScope MEDFileFieldNameScope::MEDFileFieldNameScope() -= default; +{ +} MEDFileFieldNameScope::MEDFileFieldNameScope(const std::string& fieldName, const std::string& meshName):_name(fieldName),_mesh_name(meshName) { diff --git a/src/MEDLoader/MEDFileFieldGlobs.hxx b/src/MEDLoader/MEDFileFieldGlobs.hxx index ef148b440..a4d509cd3 100644 --- a/src/MEDLoader/MEDFileFieldGlobs.hxx +++ b/src/MEDLoader/MEDFileFieldGlobs.hxx @@ -21,19 +21,13 @@ #ifndef __MEDFILEFIELDGLOBS_HXX__ #define __MEDFILEFIELDGLOBS_HXX__ -#include "MEDCouplingRefCountObject.hxx" -#include "MCType.hxx" #include "MEDLoaderDefines.hxx" #include "NormalizedGeometricTypes" +#include "MEDCouplingMemArray.hxx" #include "MCAuto.hxx" #include "med.h" -#include -#include -#include -#include -#include namespace MEDCoupling { @@ -48,8 +42,8 @@ namespace MEDCoupling static MEDFileFieldGlobs *New(med_idt fid); static MEDFileFieldGlobs *New(); std::string getClassName() const override { return std::string("MEDFileFieldGlobs"); } - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileFieldGlobs *deepCopy() const; MEDFileFieldGlobs *shallowCpyPart(const std::vector& pfls, const std::vector& locs) const; MEDFileFieldGlobs *deepCpyPart(const std::vector& pfls, const std::vector& locs) const; @@ -96,7 +90,7 @@ namespace MEDCoupling protected: MEDFileFieldGlobs(med_idt fid); MEDFileFieldGlobs(); - ~MEDFileFieldGlobs() override; + ~MEDFileFieldGlobs(); protected: std::vector< MCAuto > _pfls; std::vector< MCAuto > _locs; @@ -134,7 +128,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id, const std::string& pflName); MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id); MEDLOADER_EXPORT void loadGlobals(med_idt fid); - MEDLOADER_EXPORT void loadAllGlobals(med_idt fid, const MEDFileEntities *entities=nullptr); + MEDLOADER_EXPORT void loadAllGlobals(med_idt fid, const MEDFileEntities *entities=0); MEDLOADER_EXPORT void writeGlobals(med_idt fid, const MEDFileWritable& opt) const; MEDLOADER_EXPORT std::vector getPfls() const; MEDLOADER_EXPORT std::vector getLocs() const; diff --git a/src/MEDLoader/MEDFileFieldInternal.cxx b/src/MEDLoader/MEDFileFieldInternal.cxx index 10d084714..84eb086ac 100644 --- a/src/MEDLoader/MEDFileFieldInternal.cxx +++ b/src/MEDLoader/MEDFileFieldInternal.cxx @@ -19,15 +19,6 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileFieldInternal.hxx" -#include "InterpKernelAutoPtr.hxx" -#include "MEDFileBasis.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingPartDefinition.hxx" #include "MEDFileField.hxx" #include "MEDFileFieldVisitor.hxx" #include "MEDFileStructureElement.hxx" @@ -42,23 +33,6 @@ #include "MEDFilterEntity.hxx" #include "CellModel.hxx" -#include "med.h" -#include "NormalizedGeometricTypes" -#include -#include -#include -#include "medlocalization.h" -#include -#include -#include "medmesh.h" -#include -#include -#include -#include "medfield.h" -#include -#include -#include -#include // From MEDLOader.cxx TU extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO]; @@ -68,7 +42,8 @@ extern med_geometry_type typmai3[INTERP_KERNEL::NORM_MAXTYPE]; using namespace MEDCoupling; MEDFileGTKeeper::~MEDFileGTKeeper() -= default; +{ +} MEDFileGTKeeper *MEDFileGTKeeperSta::deepCopy() const { @@ -87,7 +62,7 @@ std::string MEDFileGTKeeperSta::getRepr() const bool MEDFileGTKeeperSta::isEqual(const MEDFileGTKeeper *other) const { - const auto *otherC(dynamic_cast(other)); + const MEDFileGTKeeperSta *otherC(dynamic_cast(other)); if(!otherC) return false; return _geo_type==otherC->_geo_type; @@ -124,7 +99,7 @@ std::string MEDFileGTKeeperDyn::getRepr() const bool MEDFileGTKeeperDyn::isEqual(const MEDFileGTKeeper *other) const { - const auto *otherC(dynamic_cast(other)); + const MEDFileGTKeeperDyn *otherC(dynamic_cast(other)); if(!otherC) return false; return this==otherC; @@ -176,7 +151,7 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *ent _dim=FromMedInt(dim); _nb_gauss_pt=FromMedInt(nb_gauss_pt); _name=locName; - std::string const sectionName(MEDLoaderBase::buildStringFromFortran(sectionmeshname,MED_NAME_SIZE)); + std::string sectionName(MEDLoaderBase::buildStringFromFortran(sectionmeshname,MED_NAME_SIZE)); if(sectionName.empty()) { _gt=new MEDFileGTKeeperSta((INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+INTERP_KERNEL::NORM_MAXTYPE,geotype)))); @@ -185,7 +160,7 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *ent } else { - const auto *entities2(dynamic_cast(entities)); + const MEDFileAllStaticEntitiesPlusDyn *entities2(dynamic_cast(entities)); if(!entities2) { std::ostringstream oss; oss << "MEDFileFieldLoc cstr : for loc \"" << _name << "\" presence of non static type ! Expect entities !"; @@ -231,8 +206,8 @@ bool MEDFileFieldLoc::isOnStructureElement() const const MEDFileGTKeeper *gt(_gt); if(!gt) throw INTERP_KERNEL::Exception("MEDFileFieldLoc::isOnStructureElement : null pointer !"); - const auto *gt2(dynamic_cast(gt)); - return gt2!=nullptr; + const MEDFileGTKeeperDyn *gt2(dynamic_cast(gt)); + return gt2!=NULL; } std::size_t MEDFileFieldLoc::getHeapMemorySizeWithoutChildren() const @@ -301,7 +276,7 @@ std::string MEDFileFieldLoc::repr() const std::size_t sz=_ref_coo.size(); if(sz%_dim==0) { - std::size_t const nbOfTuples=sz/_dim; + std::size_t nbOfTuples=sz/_dim; for(std::size_t i=0;igetDiscretization()); const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(FromIdType(_loc_id))); - const auto *disc2(dynamic_cast(disc)); + const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !"); const DataArrayIdType *dai(disc2->getArrayOfDiscIds()); MCAuto dai2(disc2->getOffsetArr(field->getMesh())); const mcIdType *dai2Ptr(dai2->getConstPointer()); - mcIdType const nbi(ToIdType(gsLoc.getWeights().size())); + mcIdType nbi(ToIdType(gsLoc.getWeights().size())); MCAuto da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1)); MCAuto da3(da2->findIdsEqual(_loc_id)); const mcIdType *da3Ptr(da3->getConstPointer()); @@ -380,7 +355,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(mcIdType& start, mc mcIdType *da4Ptr(da4->getPointer()); for(mcIdType i=0;i<_nval;i++) { - mcIdType const ref=dai2Ptr[offset+da3Ptr[i]]; + mcIdType ref=dai2Ptr[offset+da3Ptr[i]]; for(mcIdType j=0;jgetTypeOfField(); - std::string const pflName(multiTypePfl->getName()); + std::string pflName(multiTypePfl->getName()); std::ostringstream oss; oss << pflName; if(_type!=ON_NODES) { @@ -455,7 +430,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, mcId MCAuto arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end()); arr3->computeOffsetsFull(); MCAuto tmp=idsInPfl->buildExplicitArrByRanges(arr3); - mcIdType const trueNval=tmp->getNumberOfTuples(); + mcIdType trueNval=tmp->getNumberOfTuples(); _nval=idsInPfl->getNumberOfTuples(); getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp); _end=_start+trueNval; @@ -463,7 +438,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, mcId } case ON_GAUSS_PT: { - const auto *disc2=dynamic_cast(field->getDiscretization()); + const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast(field->getDiscretization()); if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); const DataArrayIdType *da1=disc2->getArrayOfDiscIds(); @@ -516,7 +491,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, mcId start=_end; } -void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate * /*field*/, const DataArray *arrr, MEDFileFieldGlobsReal& /*glob*/) +void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob) { _start=start; _nval=arrr->getNumberOfTuples(); @@ -570,15 +545,15 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId, const std::string& /*dummy*/):_type(type),_father(fath),_loc_id(locId) +MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId, const std::string& dummy):_type(type),_father(fath),_loc_id(locId) { } -MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other):RefCountObject(other),_type(other._type),_father(nullptr),_start(other._start),_end(other._end),_nval(other._nval),_profile(other._profile),_localization(other._localization),_loc_id(other._loc_id),_profile_it(other._profile_it),_pd(other._pd),_tmp_work1(other._tmp_work1) +MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other):RefCountObject(other),_type(other._type),_father(0),_start(other._start),_end(other._end),_nval(other._nval),_profile(other._profile),_localization(other._localization),_loc_id(other._loc_id),_profile_it(other._profile_it),_pd(other._pd),_tmp_work1(other._tmp_work1) { } -MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(nullptr),_start(-std::numeric_limits::max()),_end(-std::numeric_limits::max()), +MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(0),_start(-std::numeric_limits::max()),_end(-std::numeric_limits::max()), _nval(-std::numeric_limits::max()),_loc_id(-std::numeric_limits::max()) { } @@ -617,7 +592,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile : not implemented !"); INTERP_KERNEL::AutoPtr pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_int profilesize,nbi; - med_int const overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + med_int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); {//TODO : manage int32 ! pd->checkConsistencyLight(); @@ -641,17 +616,17 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_i INTERP_KERNEL::AutoPtr pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); std::string fieldName(nasc.getName()),meshName(getMeshName()); med_int iteration(getIteration()),order(getOrder()),profilesize,nbi; - TypeOfField const type(getType()); + TypeOfField type(getType()); med_geometry_type mgeoti; med_entity_type menti; _father->entriesForMEDfile(type,mgeoti,menti); med_int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); if(zeNVal==0 && type==ON_CELLS) {//eheh maybe there's a surprise :) - med_int const zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + med_int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); if(zeNVal1==0) { - med_int const zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + med_int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); if(zeNVal2!=0) zeNVal=zeNVal2; } @@ -692,7 +667,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF { std::string fieldName(nasc.getName()),meshName(getMeshName()); int iteration(getIteration()),order(getOrder()); - TypeOfField const type(getType()); + TypeOfField type(getType()); med_geometry_type mgeoti; med_entity_type menti; _father->entriesForMEDfile(type,mgeoti,menti); @@ -711,29 +686,29 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : Invalid start ("<< _start << ") regarding admissible range of allocated array [0," << arr->getNumberOfTuples() << "] !"; throw INTERP_KERNEL::Exception(oss.str()); } - int const nbOfCompo((int)arr->getNumberOfComponents()); - auto *arrD(dynamic_cast(arr)); + int nbOfCompo((int)arr->getNumberOfComponents()); + DataArrayDouble *arrD(dynamic_cast(arr)); if(arrD) { double *startFeeding(arrD->getPointer()+_start*nbOfCompo); goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); return ; } - auto *arrI(dynamic_cast(arr)); + DataArrayInt32 *arrI(dynamic_cast(arr)); if(arrI) { Int32 *startFeeding(arrI->getPointer()+_start*nbOfCompo); goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); return ; } - auto *arrI64(dynamic_cast(arr)); + DataArrayInt64 *arrI64(dynamic_cast(arr)); if(arrI64) { Int64 *startFeeding(arrI64->getPointer()+_start*nbOfCompo); goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); return ; } - auto *arrF(dynamic_cast(arr)); + DataArrayFloat *arrF(dynamic_cast(arr)); if(arrF) { float *startFeeding(arrF->getPointer()+_start*nbOfCompo); @@ -749,7 +724,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF */ void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(mcIdType newValueOfStart) { - mcIdType const delta=_end-_start; + mcIdType delta=_end-_start; _start=newValueOfStart; _end=_start+delta; } @@ -824,7 +799,7 @@ mcIdType MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(mcIdType deltaNbVal) { - mcIdType const nbi((_end-_start)/_nval); + mcIdType nbi((_end-_start)/_nval); _nval+=deltaNbVal; _end+=nbi*deltaNbVal; } @@ -867,11 +842,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::setLocalization(const std::string& newLo void MEDFileFieldPerMeshPerTypePerDisc::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(const auto & it2 : mapOfModif) + for(std::vector< std::pair, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++) { - if(std::find(it2.first.begin(),it2.first.end(),_profile)!=it2.first.end()) + if(std::find((*it2).first.begin(),(*it2).first.end(),_profile)!=(*it2).first.end()) { - _profile=it2.second; + _profile=(*it2).second; return; } } @@ -879,11 +854,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::changePflsRefsNamesGen(const std::vector void MEDFileFieldPerMeshPerTypePerDisc::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(const auto & it2 : mapOfModif) + for(std::vector< std::pair, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++) { - if(std::find(it2.first.begin(),it2.first.end(),_localization)!=it2.first.end()) + if(std::find((*it2).first.begin(),(*it2).first.end(),_localization)!=(*it2).first.end()) { - _localization=it2.second; + _localization=(*it2).second; return; } } @@ -896,7 +871,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const dads.push_back(std::pair(_start,_end)); geoTypes.push_back(getGeoType()); if(_profile.empty()) - pfls.push_back(nullptr); + pfls.push_back(0); else { pfls.push_back(glob->getProfile(_profile.c_str())); @@ -925,11 +900,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldN throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : no array set !"); if(!arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !"); - const auto *arrD(dynamic_cast(arr)); - const auto *arrI(dynamic_cast(arr)); - const auto *arrI64(dynamic_cast(arr)); - const auto *arrF(dynamic_cast(arr)); - const unsigned char *locToWrite=nullptr; + const DataArrayDouble *arrD(dynamic_cast(arr)); + const DataArrayInt32 *arrI(dynamic_cast(arr)); + const DataArrayInt64 *arrI64(dynamic_cast(arr)); + const DataArrayFloat *arrF(dynamic_cast(arr)); + const unsigned char *locToWrite=0; if(arrD) locToWrite=reinterpret_cast(arrD->getConstPointer()+_start*arr->getNumberOfComponents()); else if(arrI) @@ -963,7 +938,7 @@ mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(mcIdType offset, { _loc_id=FromIdType(offset); std::ostringstream oss; - std::size_t const nbOfType=codeOfMesh.size()/3; + std::size_t nbOfType=codeOfMesh.size()/3; int found=-1; for(std::size_t i=0;igetNumberOfTuples() << " whereas the number of ids is set to " << _nval << " for this geometric type !"; throw INTERP_KERNEL::Exception(oss.str()); } - mcIdType const offset2=codeOfMesh[3*found+2]; - for(long const pflId : *pfl) + mcIdType offset2=codeOfMesh[3*found+2]; + for(const mcIdType *pflId=pfl->begin();pflId!=pfl->end();pflId++) { - if(pflId > MEDFileFi int id=0; std::map,int> m; std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > ret; - for(auto entrie : entries) - if(m.find(std::pair(entrie->getLocalization(),entrie->getType()))==m.end()) - m[std::pair(entrie->getLocalization(),entrie->getType())]=id++; + for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entries.begin();it!=entries.end();it++) + if(m.find(std::pair((*it)->getLocalization(),(*it)->getType()))==m.end()) + m[std::pair((*it)->getLocalization(),(*it)->getType())]=id++; ret.resize(id); - for(auto entrie : entries) - ret[m[std::pair(entrie->getLocalization(),entrie->getType())]].push_back(entrie); + for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entries.begin();it!=entries.end();it++) + ret[m[std::pair((*it)->getLocalization(),(*it)->getType())]].push_back(*it); return ret; } @@ -1064,11 +1039,11 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const st { if(entriesOnSameDisc.empty()) return false; - TypeOfField const type=entriesOnSameDisc[0]->getType(); + TypeOfField type=entriesOnSameDisc[0]->getType(); mcIdType szEntities=0,szTuples=0; - for(auto it : entriesOnSameDisc) - { szEntities+=it->_nval; szTuples+=it->_end-it->_start; } - mcIdType const nbi=szTuples/szEntities; + for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++) + { szEntities+=(*it)->_nval; szTuples+=(*it)->_end-(*it)->_start; } + mcIdType nbi=szTuples/szEntities; if(szTuples%szEntities!=0) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks : internal error the splitting into same dicretization failed !"); MCAuto renumTuples=DataArrayIdType::New(); renumTuples->alloc(szTuples,1); @@ -1079,9 +1054,9 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const st std::vector< const DataArrayIdType * > newGeoTypesPerChunk3(entriesOnSameDisc.size()); MCAuto newGeoTypesPerChunk4=DataArrayIdType::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi); int id=0; - for(auto it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++) + for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++) { - mcIdType const startOfEltIdOfChunk=(*it)->_start; + mcIdType startOfEltIdOfChunk=(*it)->_start; MCAuto newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); MCAuto rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); MCAuto idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); @@ -1095,7 +1070,7 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const st MCAuto newGeoTypesEltIdsAllGather=DataArrayIdType::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear(); MCAuto newGeoTypesEltIdsAllGather2=DataArrayIdType::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear(); MCAuto diffVals=newGeoTypesEltIdsAllGather->getDifferentValues(); - MCAuto const renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); + MCAuto renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); // MCAuto renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); // @@ -1110,9 +1085,9 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const st { MCAuto ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt); MCAuto subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end()); - mcIdType const nbEntityElts=subIds->getNumberOfTuples(); + mcIdType nbEntityElts=subIds->getNumberOfTuples(); bool ret2; - MCAuto const eltToAdd=MEDFileFieldPerMeshPerTypePerDisc:: + MCAuto eltToAdd=MEDFileFieldPerMeshPerTypePerDisc:: NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIota(newCode[3*(*idIt)+1]),nbi, offset+offset2, li,glob,ret2); @@ -1144,8 +1119,8 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectO MEDFileFieldGlobsReal& glob, bool ¬InExisting) { - mcIdType const nbMeshEntities=idsOfMeshElt->getNumberOfTuples(); - auto it=entriesOnSameDisc.begin(); + mcIdType nbMeshEntities=idsOfMeshElt->getNumberOfTuples(); + std::list< const MEDFileFieldPerMeshPerTypePerDisc *>::iterator it=entriesOnSameDisc.begin(); for(;it!=entriesOnSameDisc.end();it++) { if(((INTERP_KERNEL::NormalizedCellType)(*it)->_loc_id)==geoType && (*it)->_nval==nbMeshEntities) @@ -1167,7 +1142,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectO if(it==entriesOnSameDisc.end()) { notInExisting=true; - auto *ret=new MEDFileFieldPerMeshPerTypePerDisc; + MEDFileFieldPerMeshPerTypePerDisc *ret=new MEDFileFieldPerMeshPerTypePerDisc; ret->_type=typeF; ret->_loc_id=(int)geoType; ret->_nval=nbMeshEntities; @@ -1197,7 +1172,8 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectO //////////////////////////////////// MEDFileFieldPerMeshPerTypeCommon::~MEDFileFieldPerMeshPerTypeCommon() -= default; +{ +} void MEDFileFieldPerMeshPerTypeCommon::setFather(MEDFileFieldPerMesh *father) { @@ -1206,10 +1182,10 @@ void MEDFileFieldPerMeshPerTypeCommon::setFather(MEDFileFieldPerMesh *father) void MEDFileFieldPerMeshPerTypeCommon::accept(MEDFileFieldVisitor& visitor) const { - for(const auto & it : _field_pm_pt_pd) - if(it.isNotNull()) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + if((*it).isNotNull()) { - visitor.newPerMeshPerTypePerDisc(it); + visitor.newPerMeshPerTypePerDisc(*it); } } @@ -1231,16 +1207,16 @@ std::size_t MEDFileFieldPerMeshPerTypeCommon::getHeapMemorySizeWithoutChildren() std::vector MEDFileFieldPerMeshPerTypeCommon::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & it : _field_pm_pt_pd) - ret.push_back((const MEDFileFieldPerMeshPerTypePerDisc *)it); + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + ret.push_back((const MEDFileFieldPerMeshPerTypePerDisc *)*it); return ret; } void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - std::vector const pos=addNewEntryIfNecessary(field,offset,nbOfCells); - for(long const po : pos) - _field_pm_pt_pd[po]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc); + std::vector pos=addNewEntryIfNecessary(field,offset,nbOfCells); + for(std::vector::const_iterator it=pos.begin();it!=pos.end();it++) + _field_pm_pt_pd[*it]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc); } /*! @@ -1254,9 +1230,9 @@ void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(mcIdType& start, mcI */ void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - std::vector const pos=addNewEntryIfNecessary(field,idsInPfl); - for(long const po : pos) - _field_pm_pt_pd[po]->assignFieldProfile(isPflAlone,start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,arr,mesh,glob,nasc); + std::vector pos=addNewEntryIfNecessary(field,idsInPfl); + for(std::vector::const_iterator it=pos.begin();it!=pos.end();it++) + _field_pm_pt_pd[*it]->assignFieldProfile(isPflAlone,start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,arr,mesh,glob,nasc); } void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) @@ -1273,16 +1249,16 @@ void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(mcIdType& start, c throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile : input array is null, or not allocated !"); _field_pm_pt_pd.resize(1); _field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3); - _field_pm_pt_pd[0]->assignFieldProfile(true,start,pfl,pfl2,pfl2,-1,field,arr,nullptr,glob,nasc);//mesh is not requested so 0 is send. + _field_pm_pt_pd[0]->assignFieldProfile(true,start,pfl,pfl2,pfl2,-1,field,arr,0,glob,nasc);//mesh is not requested so 0 is send. } std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells) { - TypeOfField const type=field->getTypeOfField(); + TypeOfField type=field->getTypeOfField(); if(type!=ON_GAUSS_PT) { - int const locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0); - std::size_t const sz=_field_pm_pt_pd.size(); + int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0); + std::size_t sz=_field_pm_pt_pd.size(); bool found=false; for(std::size_t j=0;j MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(c else { std::vector ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells); - std::size_t const sz2=ret2.size(); + std::size_t sz2=ret2.size(); std::vector ret3(sz2); mcIdType k=0; for(std::size_t i=0;i MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(c std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells) { const MEDCouplingFieldDiscretization *disc=field->getDiscretization(); - const auto *disc2=dynamic_cast(disc); + const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast(disc); if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); const DataArrayIdType *da=disc2->getArrayOfDiscIds(); @@ -1350,11 +1326,11 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGa std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells) { - TypeOfField const type=field->getTypeOfField(); + TypeOfField type=field->getTypeOfField(); if(type!=ON_GAUSS_PT) { - int const locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0); - std::size_t const sz=_field_pm_pt_pd.size(); + int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0); + std::size_t sz=_field_pm_pt_pd.size(); bool found=false; for(std::size_t j=0;j MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(c else { std::vector ret2=addNewEntryIfNecessaryGauss(field,subCells); - std::size_t const sz2=ret2.size(); + std::size_t sz2=ret2.size(); std::vector ret3(sz2); mcIdType k=0; for(std::size_t i=0;i MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(c std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells) { const MEDCouplingFieldDiscretization *disc=field->getDiscretization(); - const auto *disc2=dynamic_cast(disc); + const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast(disc); if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); const DataArrayIdType *da=disc2->getArrayOfDiscIds(); @@ -1428,7 +1404,7 @@ const MEDFileFieldPerMesh *MEDFileFieldPerMeshPerTypeCommon::getFather() const bool MEDFileFieldPerMeshPerTypeCommon::isUniqueLevel(int& dim) const { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); - int const curDim((int)cm.getDimension()); + int curDim((int)cm.getDimension()); if(dim!=std::numeric_limits::max()) { if(dim!=curDim) @@ -1441,15 +1417,15 @@ bool MEDFileFieldPerMeshPerTypeCommon::isUniqueLevel(int& dim) const void MEDFileFieldPerMeshPerTypeCommon::fillTypesOfFieldAvailable(std::set& types) const { - for(const auto & it : _field_pm_pt_pd) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { - it->fillTypesOfFieldAvailable(types); + (*it)->fillTypesOfFieldAvailable(types); } } void MEDFileFieldPerMeshPerTypeCommon::fillFieldSplitedByType(std::vector< std::pair >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const { - std::size_t const sz=_field_pm_pt_pd.size(); + std::size_t sz=_field_pm_pt_pd.size(); dads.resize(sz); types.resize(sz); pfls.resize(sz); locs.resize(sz); for(std::size_t i=0;i >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { - globalSz+=it->getNumberOfTuples(); + globalSz+=(*it)->getNumberOfTuples(); } nbOfEntries+=(mcIdType)_field_pm_pt_pd.size(); } @@ -1494,9 +1470,9 @@ std::size_t MEDFileFieldPerMeshPerTypeCommon::getNumberOfComponents() const bool MEDFileFieldPerMeshPerTypeCommon::presenceOfMultiDiscPerGeoType() const { std::size_t nb(0); - for(const auto & it : _field_pm_pt_pd) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { - const MEDFileFieldPerMeshPerTypePerDisc *fmtd(it); + const MEDFileFieldPerMeshPerTypePerDisc *fmtd(*it); if(fmtd) nb++; } @@ -1530,9 +1506,9 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::getPflsReallyUsed() c { std::vector ret; std::set ret2; - for(const auto & it1 : _field_pm_pt_pd) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { - std::string const tmp=it1->getProfile(); + std::string tmp=(*it1)->getProfile(); if(!tmp.empty()) if(ret2.find(tmp)==ret2.end()) { @@ -1547,9 +1523,9 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::getLocsReallyUsed() c { std::vector ret; std::set ret2; - for(const auto & it1 : _field_pm_pt_pd) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { - std::string const tmp=it1->getLocalization(); + std::string tmp=(*it1)->getLocalization(); if(!tmp.empty() && tmp!=MED_GAUSS_ELNO) if(ret2.find(tmp)==ret2.end()) { @@ -1563,10 +1539,10 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::getLocsReallyUsed() c std::vector MEDFileFieldPerMeshPerTypeCommon::getPflsReallyUsedMulti() const { std::vector ret; - std::set const ret2; - for(const auto & it1 : _field_pm_pt_pd) + std::set ret2; + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { - std::string const tmp=it1->getProfile(); + std::string tmp=(*it1)->getProfile(); if(!tmp.empty()) ret.push_back(tmp); } @@ -1576,9 +1552,9 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::getPflsReallyUsedMult std::vector MEDFileFieldPerMeshPerTypeCommon::getLocsReallyUsedMulti() const { std::vector ret; - for(const auto & it1 : _field_pm_pt_pd) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { - std::string const tmp=it1->getLocalization(); + std::string tmp=(*it1)->getLocalization(); if(!tmp.empty() && tmp!=MED_GAUSS_ELNO) ret.push_back(tmp); } @@ -1587,14 +1563,14 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::getLocsReallyUsedMult void MEDFileFieldPerMeshPerTypeCommon::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & it1 : _field_pm_pt_pd) - it1->changePflsRefsNamesGen(mapOfModif); + for(std::vector< MCAuto >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + (*it1)->changePflsRefsNamesGen(mapOfModif); } void MEDFileFieldPerMeshPerTypeCommon::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & it1 : _field_pm_pt_pd) - it1->changeLocsRefsNamesGen(mapOfModif); + for(std::vector< MCAuto >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + (*it1)->changeLocsRefsNamesGen(mapOfModif); } MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId) @@ -1609,7 +1585,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGive std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no such locId available (" << locId; oss2 << ") for geometric type \"" << getGeoTypeRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !"; throw INTERP_KERNEL::Exception(oss2.str().c_str()); - return static_cast(nullptr); + return static_cast(0); } const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId) const @@ -1624,13 +1600,13 @@ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLe std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no such locId available (" << locId; oss2 << ") for geometric type \"" << getGeoTypeRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !"; throw INTERP_KERNEL::Exception(oss2.str().c_str()); - return static_cast(nullptr); + return static_cast(0); } int MEDFileFieldPerMeshPerTypeCommon::locIdOfLeaf(const MEDFileFieldPerMeshPerTypePerDisc *leaf) const { int ret(0); - for(auto it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,ret++) { const MEDFileFieldPerMeshPerTypePerDisc *cand(*it); if(cand==leaf) @@ -1642,7 +1618,7 @@ int MEDFileFieldPerMeshPerTypeCommon::locIdOfLeaf(const MEDFileFieldPerMeshPerTy void MEDFileFieldPerMeshPerTypeCommon::fillValues(mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const { int i=0; - for(auto it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { (*it)->fillValues(i,startEntryId,entries); } @@ -1651,8 +1627,8 @@ void MEDFileFieldPerMeshPerTypeCommon::fillValues(mcIdType& startEntryId, std::v void MEDFileFieldPerMeshPerTypeCommon::setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) { _field_pm_pt_pd=leaves; - for(auto & it : _field_pm_pt_pd) - it->setFather(this); + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + (*it)->setFather(this); } /*! @@ -1664,13 +1640,13 @@ bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField { bool ret(false); std::vector< MCAuto > newPmPtPd; - for(auto & it : _field_pm_pt_pd) - if(it->getType()==tof) + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + if((*it)->getType()==tof) { - newPmPtPd.push_back(it); - std::pair bgEnd; bgEnd.first=it->getStart(); bgEnd.second=it->getEnd(); - it->setNewStart(globalNum); - globalNum=it->getEnd(); + newPmPtPd.push_back(*it); + std::pair bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd(); + (*it)->setNewStart(globalNum); + globalNum=(*it)->getEnd(); its.push_back(bgEnd); ret=true; } @@ -1689,7 +1665,7 @@ bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t i if(_field_pm_pt_pd.size()<=idOfDisc) return false; MCAuto elt(_field_pm_pt_pd[idOfDisc]); - std::vector< MCAuto > const newPmPtPd(1,elt); + std::vector< MCAuto > newPmPtPd(1,elt); std::pair bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd(); elt->setNewStart(globalNum); globalNum=elt->getEnd(); @@ -1700,22 +1676,22 @@ bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t i void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc) { - for(auto & it : _field_pm_pt_pd) - it->loadOnlyStructureOfDataRecursively(fid,start,nasc); + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); } void MEDFileFieldPerMeshPerTypeCommon::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(auto & it : _field_pm_pt_pd) - it->loadBigArray(fid,nasc); + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + (*it)->loadBigArray(fid,nasc); } void MEDFileFieldPerMeshPerTypeCommon::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const { - for(const auto & it : _field_pm_pt_pd) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { - it->copyOptionsFrom(*this); - it->writeLL(fid,nasc); + (*it)->copyOptionsFrom(*this); + (*it)->writeLL(fid,nasc); } } @@ -1769,8 +1745,8 @@ void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, if(meshDim!=(int)cm.getDimension()) return ; } - for(const auto & it : _field_pm_pt_pd) - it->getFieldAtLevel(type,glob,dads,pfls,locs,geoTypes); + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + (*it)->getFieldAtLevel(type,glob,dads,pfls,locs,geoTypes); } INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerType::getGeoType() const @@ -1791,14 +1767,14 @@ void MEDFileFieldPerMeshPerType::entriesForMEDfile(TypeOfField mct, med_geometry void MEDFileFieldPerMeshPerType::getDimension(int& dim) const { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_geo_type)); - int const curDim((int)cm.getDimension()); + int curDim((int)cm.getDimension()); dim=std::max(dim,curDim); } void MEDFileFieldPerMeshPerType::simpleRepr(int bkOffset, std::ostream& oss, int id) const { const char startLine[]=" ## "; - std::string const startLine2(bkOffset,' '); + std::string startLine2(bkOffset,' '); std::string startLine3(startLine2); startLine3+=startLine; if(_geo_type!=INTERP_KERNEL::NORM_ERROR) @@ -1810,7 +1786,7 @@ void MEDFileFieldPerMeshPerType::simpleRepr(int bkOffset, std::ostream& oss, int oss << startLine3 << "Entry geometry type #" << id << " is lying on NODES." << std::endl; oss << startLine3 << "Entry is defined on " << _field_pm_pt_pd.size() << " localizations." << std::endl; int i=0; - for(auto it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { const MEDFileFieldPerMeshPerTypePerDisc *cur=(*it); if(cur) @@ -1846,7 +1822,7 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileField } if(type==ON_CELLS) { - med_int const nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,mgeoti,pflName,locName)); + med_int nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,mgeoti,pflName,locName)); for(int i=0;i=nbProfiles2?MED_DESCENDING_FACE:MED_DESCENDING_EDGE;//not enough words to describe the beauty @@ -1870,14 +1846,14 @@ MCAuto MEDFileFieldPerMeshPerType::Aggregate(mcIdTyp { MCAuto ret(MEDFileFieldPerMeshPerType::New(father,gt)); std::map > > m; - for(const auto & pm : pms) + for(std::vector >::const_iterator it=pms.begin();it!=pms.end();it++) { - for(auto it2=pm.second->_field_pm_pt_pd.begin();it2!=pm.second->_field_pm_pt_pd.end();it2++) - m[(*it2)->getType()].push_back(std::pair(pm.first,*it2)); + for(std::vector< MCAuto >::const_iterator it2=(*it).second->_field_pm_pt_pd.begin();it2!=(*it).second->_field_pm_pt_pd.end();it2++) + m[(*it2)->getType()].push_back(std::pair((*it).first,*it2)); } for(std::map > >::const_iterator it=m.begin();it!=m.end();it++) { - MCAuto const agg(MEDFileFieldPerMeshPerTypePerDisc::Aggregate(start,(*it).second,dts,(*it).first,ret,extractInfo)); + MCAuto agg(MEDFileFieldPerMeshPerTypePerDisc::Aggregate(start,(*it).second,dts,(*it).first,ret,extractInfo)); ret->_field_pm_pt_pd.push_back(agg); } return ret; @@ -1889,7 +1865,7 @@ MEDFileFieldPerMeshPerTypeDyn *MEDFileFieldPerMeshPerTypeDyn::NewOnRead(med_idt { if(!entities) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeDyn::NewOnRead : null pointer !"); - const auto *entities2(dynamic_cast(entities)); + const MEDFileAllStaticEntitiesPlusDyn *entities2(dynamic_cast(entities)); if(!entities2) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeDyn::NewOnRead : invalid type of entities !"); const MEDFileStructureElement *se(entities2->getWithGT(idGT)); @@ -1901,11 +1877,11 @@ MEDFileFieldPerMeshPerTypeDyn::MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFil _se.takeRef(se); INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - med_int const nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,_se->getDynGT(),pflName,locName)); + med_int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,_se->getDynGT(),pflName,locName)); _field_pm_pt_pd.resize(nbProfiles); for(int i=0;igetEntity(),i,nullptr); + _field_pm_pt_pd[i]=MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(this,_se->getEntity(),i,NULL); } } @@ -1919,12 +1895,12 @@ std::string MEDFileFieldPerMeshPerTypeDyn::getModelName() const return _se->getName(); } -void MEDFileFieldPerMeshPerTypeDyn::getDimension(int& /*dim*/) const +void MEDFileFieldPerMeshPerTypeDyn::getDimension(int& dim) const { throw INTERP_KERNEL::Exception("not implemented yet !"); } -void MEDFileFieldPerMeshPerTypeDyn::entriesForMEDfile(TypeOfField /*mct*/, med_geometry_type& gt, med_entity_type& ent) const +void MEDFileFieldPerMeshPerTypeDyn::entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const { gt=getDynGT(); ent=MED_STRUCT_ELEMENT; @@ -1943,13 +1919,13 @@ INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerTypeDyn::getGeoTypeStati void MEDFileFieldPerMeshPerTypeDyn::simpleRepr(int bkOffset, std::ostream& oss, int id) const { const char startLine[]=" ## "; - std::string const startLine2(bkOffset,' '); + std::string startLine2(bkOffset,' '); std::string startLine3(startLine2); startLine3+=startLine; oss << startLine3 << "Entry geometry type #" << id << " is lying on geometry STRUCTURE_ELEMENT type " << getDynGT() << "." << std::endl; oss << startLine3 << "Entry is defined on " << _field_pm_pt_pd.size() << " localizations." << std::endl; int i=0; - for(auto it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { if((*it).isNotNull()) (*it)->simpleRepr(bkOffset,oss,i); @@ -1973,7 +1949,7 @@ MEDFileFieldPerMeshPerTypeDyn *MEDFileFieldPerMeshPerTypeDyn::deepCopy(MEDFileFi return ret.retn(); } -void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int /*meshDim*/, TypeOfField /*type*/, const MEDFileFieldGlobsReal * /*glob*/, std::vector< std::pair >& /*dads*/, std::vector& /*pfls*/, std::vector& /*locs*/, std::vector& /*geoTypes*/) const +void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const { throw INTERP_KERNEL::Exception("not implemented yet !"); } @@ -2003,8 +1979,8 @@ std::size_t MEDFileFieldPerMesh::getHeapMemorySizeWithoutChildren() const std::vector MEDFileFieldPerMesh::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & it : _field_pm_pt) - ret.push_back(it); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + ret.push_back(*it); return ret; } @@ -2013,7 +1989,7 @@ MEDFileFieldPerMesh *MEDFileFieldPerMesh::deepCopy(MEDFileAnyTypeField1TSWithout MCAuto< MEDFileFieldPerMesh > ret=new MEDFileFieldPerMesh(*this); ret->_father=father; std::size_t i=0; - for(auto it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { if((*it).isNotNull()) ret->_field_pm_pt[i]=(*it)->deepCopy((MEDFileFieldPerMesh *)(ret)); @@ -2023,11 +1999,11 @@ MEDFileFieldPerMesh *MEDFileFieldPerMesh::deepCopy(MEDFileAnyTypeField1TSWithout void MEDFileFieldPerMesh::simpleRepr(int bkOffset, std::ostream& oss, int id) const { - std::string const startLine(bkOffset,' '); + std::string startLine(bkOffset,' '); oss << startLine << "## Field part (" << id << ") lying on mesh \"" << getMeshName() << "\", Mesh iteration=" << _mesh_iteration << ". Mesh order=" << _mesh_order << "." << std::endl; oss << startLine << "## Field is defined on " << _field_pm_pt.size() << " types." << std::endl; int i=0; - for(auto it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { if((*it).isNotNull()) (*it)->simpleRepr(bkOffset,oss,i); @@ -2045,13 +2021,13 @@ void MEDFileFieldPerMesh::copyTinyInfoFrom(const MEDCouplingMesh *mesh) void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(mcIdType& start, const std::vector& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - std::size_t const nbOfTypes=code.size()/3; + std::size_t nbOfTypes=code.size()/3; mcIdType offset=0; for(std::size_t i=0;iassignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc); offset+=nbOfCells; } @@ -2068,15 +2044,15 @@ void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(mcIdType& start, const std */ void MEDFileFieldPerMesh::assignFieldProfile(mcIdType& start, const DataArrayIdType *multiTypePfl, const std::vector& code, const std::vector& code2, const std::vector& idsInPflPerType, const std::vector& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - std::size_t const nbOfTypes(code.size()/3); + std::size_t nbOfTypes(code.size()/3); for(std::size_t i=0;iassignNodeFieldNoProfile(start,field,arr,glob); } void MEDFileFieldPerMesh::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - mcIdType const pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR); + mcIdType pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR); _field_pm_pt[pos]->assignNodeFieldProfile(start,pfl,field,arr,glob,nasc); } void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc) { - for(auto & it : _field_pm_pt) - it->loadOnlyStructureOfDataRecursively(fid,start,nasc); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); } void MEDFileFieldPerMesh::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(auto & it : _field_pm_pt) - it->loadBigArraysRecursively(fid,nasc); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + (*it)->loadBigArraysRecursively(fid,nasc); } void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const { - std::size_t const nbOfTypes=_field_pm_pt.size(); + std::size_t nbOfTypes=_field_pm_pt.size(); for(std::size_t i=0;icopyOptionsFrom(*this); @@ -2123,27 +2099,27 @@ void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc void MEDFileFieldPerMesh::getDimension(int& dim) const { - for(const auto & it : _field_pm_pt) - it->getDimension(dim); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + (*it)->getDimension(dim); } bool MEDFileFieldPerMesh::isUniqueLevel(int& dim) const { - for(const auto & it : _field_pm_pt) - if(!it->isUniqueLevel(dim)) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + if(!(*it)->isUniqueLevel(dim)) return false; return true; } void MEDFileFieldPerMesh::fillTypesOfFieldAvailable(std::set& types) const { - for(const auto & it : _field_pm_pt) - it->fillTypesOfFieldAvailable(types); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + (*it)->fillTypesOfFieldAvailable(types); } std::vector< std::vector< std::pair > > MEDFileFieldPerMesh::getFieldSplitedByType(std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector > & locs) const { - std::size_t const sz=_field_pm_pt.size(); + std::size_t sz=_field_pm_pt.size(); std::vector< std::vector > > ret(sz); types.resize(sz); typesF.resize(sz); pfls.resize(sz); locs.resize(sz); for(std::size_t i=0;i >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - if(it.isNull()) + if((*it).isNull()) continue; - if(it->presenceOfMultiDiscPerGeoType()) + if((*it)->presenceOfMultiDiscPerGeoType()) return true; } return false; @@ -2199,10 +2175,10 @@ bool MEDFileFieldPerMesh::presenceOfMultiDiscPerGeoType() const bool MEDFileFieldPerMesh::presenceOfStructureElements() const { - for(const auto & it : _field_pm_pt) - if(it.isNotNull()) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + if((*it).isNotNull()) { - const auto *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)it)); + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); if(pt) return true; } @@ -2211,10 +2187,10 @@ bool MEDFileFieldPerMesh::presenceOfStructureElements() const bool MEDFileFieldPerMesh::onlyStructureElements() const { - for(const auto & it : _field_pm_pt) - if(it.isNotNull()) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + if((*it).isNotNull()) { - const auto *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)it)); + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); if(!pt) return false; } @@ -2224,13 +2200,13 @@ bool MEDFileFieldPerMesh::onlyStructureElements() const void MEDFileFieldPerMesh::killStructureElements() { std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res; - for(auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - if(it.isNotNull()) + if((*it).isNotNull()) { - const auto *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)it)); + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); if(!pt) - res.push_back(it); + res.push_back(*it); } } _field_pm_pt=res; @@ -2239,13 +2215,13 @@ void MEDFileFieldPerMesh::killStructureElements() void MEDFileFieldPerMesh::keepOnlyStructureElements() { std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res; - for(auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - if(it.isNotNull()) + if((*it).isNotNull()) { - const auto *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)it)); + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); if(pt) - res.push_back(it); + res.push_back(*it); } } _field_pm_pt=res; @@ -2254,15 +2230,15 @@ void MEDFileFieldPerMesh::keepOnlyStructureElements() void MEDFileFieldPerMesh::keepOnlyOnSE(const std::string& seName) { std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res; - for(auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - if(it.isNotNull()) + if((*it).isNotNull()) { - const auto *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)it)); + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); if(!pt) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::keepOnlyOnSE : presence of non SE !"); if(pt->getModelName()==seName) - res.push_back(it); + res.push_back(*it); } } _field_pm_pt=res; @@ -2270,11 +2246,11 @@ void MEDFileFieldPerMesh::keepOnlyOnSE(const std::string& seName) void MEDFileFieldPerMesh::getMeshSENames(std::vector< std::pair >& ps) const { - for(const auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - if(it.isNotNull()) + if((*it).isNotNull()) { - const auto *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)it)); + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); if(pt) { ps.push_back(std::pair(getMeshName(),pt->getModelName())); @@ -2315,20 +2291,20 @@ const std::vector& MEDFileFieldPerMesh::getInfo() const void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& pfls, const std::vector& locs, std::vector& code, std::vector& notNullPfls) { int notNullPflsSz=0; - std::size_t const nbOfArrs=geoTypes.size(); + std::size_t nbOfArrs=geoTypes.size(); for(std::size_t i=0;i const geoTypes3(geoTypes.begin(),geoTypes.end()); - std::size_t const nbOfDiffGeoTypes=geoTypes3.size(); + std::set geoTypes3(geoTypes.begin(),geoTypes.end()); + std::size_t nbOfDiffGeoTypes=geoTypes3.size(); code.resize(3*nbOfDiffGeoTypes); notNullPfls.resize(notNullPflsSz); notNullPflsSz=0; std::size_t j=0; for(std::size_t i=0;i notNullTmp; if(pfls[j]) notNullTmp.push_back(pfls[j]); @@ -2341,11 +2317,11 @@ void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, T } else break; - std::vector< std::pair > const tmpDads(dads.begin()+startZone,dads.begin()+j); - std::vector const tmpPfls(pfls.begin()+startZone,pfls.begin()+j); - std::vector const tmpLocs(locs.begin()+startZone,locs.begin()+j); + std::vector< std::pair > tmpDads(dads.begin()+startZone,dads.begin()+j); + std::vector tmpPfls(pfls.begin()+startZone,pfls.begin()+j); + std::vector tmpLocs(locs.begin()+startZone,locs.begin()+j); code[3*i]=(mcIdType)refType; - std::vector const refType2(1,refType); + std::vector refType2(1,refType); code[3*i+1]=ComputeNbOfElems(glob,type,refType2,tmpDads,tmpLocs); if(notNullTmp.empty()) code[3*i+2]=-1; @@ -2362,7 +2338,7 @@ void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, T */ mcIdType MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs) { - std::size_t const sz=dads.size(); + std::size_t sz=dads.size(); mcIdType ret=0; for(std::size_t i=0;igetNbOfGaussPtPerCell(locs[i]); + int nbOfGaussPtPerCell=glob->getNbOfGaussPtPerCell(locs[i]); ret+=(dads[i].second-dads[i].first)/nbOfGaussPtPerCell; } } @@ -2389,14 +2365,14 @@ std::vector MEDFileFieldPerMesh::getPflsReallyUsed() const { std::vector ret; std::set ret2; - for(const auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - std::vector const tmp=it->getPflsReallyUsed(); - for(const auto & it2 : tmp) - if(ret2.find(it2)==ret2.end()) + std::vector tmp=(*it)->getPflsReallyUsed(); + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + if(ret2.find(*it2)==ret2.end()) { - ret.push_back(it2); - ret2.insert(it2); + ret.push_back(*it2); + ret2.insert(*it2); } } return ret; @@ -2405,9 +2381,9 @@ std::vector MEDFileFieldPerMesh::getPflsReallyUsed() const std::vector MEDFileFieldPerMesh::getPflsReallyUsedMulti() const { std::vector ret; - for(const auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - std::vector tmp=it->getPflsReallyUsedMulti(); + std::vector tmp=(*it)->getPflsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); } return ret; @@ -2417,14 +2393,14 @@ std::vector MEDFileFieldPerMesh::getLocsReallyUsed() const { std::vector ret; std::set ret2; - for(const auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - std::vector const tmp=it->getLocsReallyUsed(); - for(const auto & it2 : tmp) - if(ret2.find(it2)==ret2.end()) + std::vector tmp=(*it)->getLocsReallyUsed(); + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + if(ret2.find(*it2)==ret2.end()) { - ret.push_back(it2); - ret2.insert(it2); + ret.push_back(*it2); + ret2.insert(*it2); } } return ret; @@ -2433,9 +2409,9 @@ std::vector MEDFileFieldPerMesh::getLocsReallyUsed() const std::vector MEDFileFieldPerMesh::getLocsReallyUsedMulti() const { std::vector ret; - for(const auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - std::vector tmp=it->getLocsReallyUsedMulti(); + std::vector tmp=(*it)->getLocsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); } return ret; @@ -2443,11 +2419,11 @@ std::vector MEDFileFieldPerMesh::getLocsReallyUsedMulti() const bool MEDFileFieldPerMesh::changeMeshNames(const std::vector< std::pair >& modifTab) { - for(const auto & it : modifTab) + for(std::vector< std::pair >::const_iterator it=modifTab.begin();it!=modifTab.end();it++) { - if(it.first==getMeshName()) + if((*it).first==getMeshName()) { - setMeshName(it.second); + setMeshName((*it).second); return true; } } @@ -2460,7 +2436,7 @@ void MEDFileFieldPerMesh::convertMedBallIntoClassic() throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::convertMedBallIntoClassic : Only managed for single mesh !"); if(_field_pm_pt[0].isNull()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::convertMedBallIntoClassic : null pointer !"); - auto *pt(dynamic_cast((MEDFileFieldPerMeshPerTypeCommon *)_field_pm_pt[0])); + MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((MEDFileFieldPerMeshPerTypeCommon *)_field_pm_pt[0])); if(!pt) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::convertMedBallIntoClassic : this is expected to be marked as structure element !"); if(pt->getNumberOfLoc()!=1) @@ -2491,21 +2467,21 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam DataArray *arr0(getOrCreateAndGetArray());//tony if(!arr0) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values of field is null !"); - auto *arr(dynamic_cast(arr0));//tony + DataArrayDouble *arr(dynamic_cast(arr0));//tony if(!arr0) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values is double ! Not managed for the moment !"); mcIdType sz=0; if(!arr) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArrayDouble storing values of field is null !"); - for(const auto & entrie : entries) + for(std::vector< std::pair,std::pair > >::const_iterator it=entries.begin();it!=entries.end();it++) { - if(typesToKeep.find(entrie.first.first)!=typesToKeep.end()) + if(typesToKeep.find((*it).first.first)!=typesToKeep.end()) { - entriesKept.push_back(getLeafGivenTypeAndLocId(entrie.first.first,entrie.first.second)); - sz+=entrie.second.second-entrie.second.first; + entriesKept.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second)); + sz+=(*it).second.second-(*it).second.first; } else - otherEntries.push_back(getLeafGivenTypeAndLocId(entrie.first.first,entrie.first.second)); + otherEntries.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second)); } MCAuto renumDefrag=DataArrayIdType::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero(); //////////////////// @@ -2519,34 +2495,34 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam // tupleIdOfStartOfNewChuncksV[sid-1]=sz2; MCAuto explicitIdsOldInArr=DataArrayIdType::New(); explicitIdsOldInArr->alloc(sz,1); mcIdType *workI=explicitIdsOldInArr->getPointer(); - for(auto itL2 : *itL1) + for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*itL1).begin();itL2!=(*itL1).end();itL2++) { - mcIdType const delta1=itL2->fillTupleIds(workI); workI+=delta1; sz1+=delta1; - itL2->setLocId(sz2); - itL2->_tmp_work1=itL2->getStart(); - mcIdType const delta2=itL2->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2; + mcIdType delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1; + (*itL2)->setLocId(sz2); + (*itL2)->_tmp_work1=(*itL2)->getStart(); + mcIdType delta2=(*itL2)->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2; } renumDefrag->setPartOfValuesSimple3(sid,explicitIdsOldInArr->begin(),explicitIdsOldInArr->end(),0,1,1); } explicitIdsOldInMesh->reAlloc(sz2); - mcIdType const tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2; + mcIdType tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2; //////////////////// - MCAuto permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=nullptr; + MCAuto permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0; // perform redispatching of non concerned MEDFileFieldPerMeshPerTypePerDisc std::vector< MCAuto > otherEntriesNew; - for(auto otherEntrie : otherEntries) + for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=otherEntries.begin();it!=otherEntries.end();it++) { - otherEntriesNew.push_back(MEDFileFieldPerMeshPerTypePerDisc::New(*otherEntrie)); - otherEntriesNew.back()->setNewStart(permArrDefrag->getIJ(otherEntrie->getStart(),0)); - otherEntriesNew.back()->setLocId(otherEntrie->getGeoType()); + otherEntriesNew.push_back(MEDFileFieldPerMeshPerTypePerDisc::New(*(*it))); + otherEntriesNew.back()->setNewStart(permArrDefrag->getIJ((*it)->getStart(),0)); + otherEntriesNew.back()->setLocId((*it)->getGeoType()); } std::vector< MCAuto > entriesKeptNew; std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKeptNew2; - for(auto it : entriesKept) + for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesKept.begin();it!=entriesKept.end();it++) { - MCAuto elt=MEDFileFieldPerMeshPerTypePerDisc::New(*it); - mcIdType const newStart=elt->getLocId(); - elt->setLocId(it->getGeoType()); + MCAuto elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it)); + mcIdType newStart=elt->getLocId(); + elt->setLocId((*it)->getGeoType()); elt->setNewStart(newStart); elt->_tmp_work1=permArrDefrag->getIJ(elt->_tmp_work1,0); entriesKeptNew.push_back(elt); @@ -2555,9 +2531,9 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam MCAuto arr2=arr->renumber(permArrDefrag->getConstPointer()); // perform redispatching of concerned MEDFileFieldPerMeshPerTypePerDisc -> values are in arr2 MCAuto explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end()); - std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > const entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2); + std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2); bool ret=false; - for(const auto & it4 : entriesKeptPerDisc) + for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it4=entriesKeptPerDisc.begin();it4!=entriesKeptPerDisc.end();it4++) { sid=0; /*for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*it4).begin();itL2!=(*it4).end();itL2++) @@ -2565,7 +2541,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam MEDFileFieldPerMeshPerTypePerDisc *curNC=const_cast(*itL2); curNC->setNewStart(permArrDefrag->getIJ((*itL2)->getStart(),0)-tupleIdOfStartOfNewChuncks+tupleIdOfStartOfNewChuncksV[sid]); }*/ - ret=MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(tupleIdOfStartOfNewChuncks,it4,explicitIdsNewInMesh,newCode, + ret=MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(tupleIdOfStartOfNewChuncks,*it4,explicitIdsNewInMesh,newCode, glob,arr2,otherEntriesNew) || ret; } if(!ret) @@ -2583,12 +2559,12 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair >& its) { std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret; - for(auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector< std::pair > its2; - if(it->keepOnlySpatialDiscretization(tof,globalNum,its2)) + if((*it)->keepOnlySpatialDiscretization(tof,globalNum,its2)) { - ret.push_back(it); + ret.push_back(*it); its.insert(its.end(),its2.begin(),its2.end()); } } @@ -2602,12 +2578,12 @@ void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, mcIdTyp void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair >& its) { std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret; - for(auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector< std::pair > its2; - if(it->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2)) + if((*it)->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2)) { - ret.push_back(it); + ret.push_back(*it); its.insert(its.end(),its2.begin(),its2.end()); } } @@ -2617,17 +2593,17 @@ void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcId void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) { std::map > > types; - for(const auto & leave : leaves) - types[(INTERP_KERNEL::NormalizedCellType)leave->getLocId()].push_back(leave); + for( std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >::const_iterator it=leaves.begin();it!=leaves.end();it++) + types[(INTERP_KERNEL::NormalizedCellType)(*it)->getLocId()].push_back(*it); // std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > fieldPmPt(types.size()); std::map > >::const_iterator it1=types.begin(); - auto it2=fieldPmPt.begin(); + std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it2=fieldPmPt.begin(); for(;it1!=types.end();it1++,it2++) { MCAuto elt=MEDFileFieldPerMeshPerType::New(this,(INTERP_KERNEL::NormalizedCellType)((*it1).second[0]->getLocId())); elt->setLeaves((*it1).second); - MCAuto const elt2(DynamicCast(elt)); + MCAuto elt2(DynamicCast(elt)); *it2=elt2; } _field_pm_pt=fieldPmPt; @@ -2635,14 +2611,14 @@ void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MCAuto< MEDFileFiel void MEDFileFieldPerMesh::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & it : _field_pm_pt) - it->changePflsRefsNamesGen(mapOfModif); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + (*it)->changePflsRefsNamesGen(mapOfModif); } void MEDFileFieldPerMesh::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & it : _field_pm_pt) - it->changeLocsRefsNamesGen(mapOfModif); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + (*it)->changeLocsRefsNamesGen(mapOfModif); } /*! @@ -2659,8 +2635,8 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t std::vector locs; std::vectorcode; std::vector geoTypes; - for(const auto & it : _field_pm_pt) - it->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); // Sort by types SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType); if(code.empty()) @@ -2669,7 +2645,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t throw INTERP_KERNEL::Exception(oss.str()); } // - std::vector< MCAuto > const notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); if(type!=ON_NODES) { @@ -2678,7 +2654,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); else { - MCAuto const arr2(arr); + MCAuto arr2(arr); return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc); } } @@ -2686,7 +2662,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t { if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !"); - mcIdType const nb=code[1]; + mcIdType nb=code[1]; if(code[2]==-1) { if(nb!=mesh->getNumberOfNodes()) @@ -2713,8 +2689,8 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c std::vector locs; std::vector code; std::vector geoTypes; - for(const auto & it : _field_pm_pt) - it->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); // Sort by types SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType); if(code.empty()) @@ -2722,7 +2698,7 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !"; throw INTERP_KERNEL::Exception(oss.str()); } - std::vector< MCAuto > const notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); if(type!=ON_NODES) { @@ -2733,7 +2709,7 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c { if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !"); - mcIdType const nb=code[1]; + mcIdType nb=code[1]; if(code[2]==-1) { if(nb!=mesh->getNumberOfNodes()) @@ -2743,20 +2719,20 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c throw INTERP_KERNEL::Exception(oss.str()); } } - return finishField4(dads,code[2]==-1?nullptr:notNullPflsPerGeoType3[0],mesh->getNumberOfNodes(),pfl); + return finishField4(dads,code[2]==-1?0:notNullPflsPerGeoType3[0],mesh->getNumberOfNodes(),pfl); } // - return nullptr; + return 0; } void MEDFileFieldPerMesh::accept(MEDFileFieldVisitor& visitor) const { - for(const auto & it : _field_pm_pt) - if(it.isNotNull()) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + if((*it).isNotNull()) { - visitor.newPerMeshPerTypeEntry(it); - it->accept(visitor); - visitor.endPerMeshPerTypeEntry(it); + visitor.newPerMeshPerTypeEntry(*it); + (*it)->accept(visitor); + visitor.endPerMeshPerTypeEntry(*it); } } @@ -2764,31 +2740,31 @@ void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - it->getSizes(globalSz,nbOfEntries); + (*it)->getSizes(globalSz,nbOfEntries); } entries.resize(nbOfEntries); nbOfEntries=0; - for(const auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - it->fillValues(nbOfEntries,entries); + (*it)->fillValues(nbOfEntries,entries); } } MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) { - for(auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - if(it->getGeoType()==typ) - return it->getLeafGivenLocId(locId); + if((*it)->getGeoType()==typ) + return (*it)->getLeafGivenLocId(locId); } const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ); std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl; oss << "Possibilities are : "; - for(const auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(it->getGeoType()); + const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType()); oss << "\"" << cm2.getRepr() << "\", "; } throw INTERP_KERNEL::Exception(oss.str()); @@ -2796,17 +2772,17 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const { - for(const auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - if(it->getGeoType()==typ) - return it->getLeafGivenLocId(locId); + if((*it)->getGeoType()==typ) + return (*it)->getLeafGivenLocId(locId); } const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ); std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl; oss << "Possibilities are : "; - for(const auto & it : _field_pm_pt) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(it->getGeoType()); + const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType()); oss << "\"" << cm2.getRepr() << "\", "; } throw INTERP_KERNEL::Exception(oss.str()); @@ -2823,25 +2799,25 @@ MCAuto MEDFileFieldPerMeshPerTypePerDisc::Agg MCAuto ret(new MEDFileFieldPerMeshPerTypePerDisc(father,tof)); if(pms.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : empty input vector !"); - for(const auto & pm : pms) + for(std::vector >::const_iterator it=pms.begin();it!=pms.end();it++) { - if(!pm.second) + if(!(*it).second) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : presence of null pointer !"); - if(!pm.second->getProfile().empty()) + if(!(*it).second->getProfile().empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for profiles !"); - if(!pm.second->getLocalization().empty()) + if(!(*it).second->getLocalization().empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for gauss pts !"); } - INTERP_KERNEL::NormalizedCellType const gt(pms[0].second->getGeoType()); + INTERP_KERNEL::NormalizedCellType gt(pms[0].second->getGeoType()); std::size_t i(0); std::vector< std::pair > filteredDTS; - for(auto it=dts.begin();it!=dts.end();it++,i++) - for(const auto & it2 : *it) - if(it2.first==gt) - filteredDTS.push_back(std::pair(i,it2.second)); + for(std::vector< std::vector< std::pair > >::const_iterator it=dts.begin();it!=dts.end();it++,i++) + for(std::vector< std::pair >::const_iterator it2=(*it).begin();it2!=(*it).end();it2++) + if((*it2).first==gt) + filteredDTS.push_back(std::pair(i,(*it2).second)); if(pms.size()!=filteredDTS.size()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for generated profiles !"); - auto it1(pms.begin()); + std::vector >::const_iterator it1(pms.begin()); std::vector< std::pair >::const_iterator it2(filteredDTS.begin()); mcIdType zeStart(start),nval(0); for(;it1!=pms.end();it1++,it2++) @@ -2862,13 +2838,13 @@ MCAuto MEDFileFieldPerMesh::Aggregate(mcIdType &start, cons MCAuto ret(new MEDFileFieldPerMesh(father,pms[0]->getMeshName(),pms[0]->getMeshIteration(),pms[0]->getMeshOrder())); std::map > > m; std::size_t i(0); - for(auto it=pms.begin();it!=pms.end();it++,i++) + for(std::vector::const_iterator it=pms.begin();it!=pms.end();it++,i++) { const std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >& v((*it)->_field_pm_pt); - for(const auto & it2 : v) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it2=v.begin();it2!=v.end();it2++) { - INTERP_KERNEL::NormalizedCellType const gt(it2->getGeoType()); - const auto *elt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)it2)); + INTERP_KERNEL::NormalizedCellType gt((*it2)->getGeoType()); + const MEDFileFieldPerMeshPerType *elt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)(*it2))); if(!elt) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::Aggregate : not managed for structelement !"); m[gt].push_back(std::pair(i,elt)); @@ -2877,7 +2853,7 @@ MCAuto MEDFileFieldPerMesh::Aggregate(mcIdType &start, cons for(std::map > >::const_iterator it=m.begin();it!=m.end();it++) { MCAuto agg(MEDFileFieldPerMeshPerType::Aggregate(start,(*it).second,dts,(*it).first,ret,extractInfo)); - MCAuto const agg2(DynamicCast(agg)); + MCAuto agg2(DynamicCast(agg)); ret->_field_pm_pt.push_back(agg2); } return ret; @@ -2886,21 +2862,21 @@ MCAuto MEDFileFieldPerMesh::Aggregate(mcIdType &start, cons int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type) { int i=0; - std::size_t const pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type)); - auto it2=_field_pm_pt.begin(); - for(auto it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) + std::size_t pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type)); + std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it2=_field_pm_pt.begin(); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { - INTERP_KERNEL::NormalizedCellType const curType=(*it)->getGeoType(); + INTERP_KERNEL::NormalizedCellType curType=(*it)->getGeoType(); if(type==curType) return i; else { - std::size_t const pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType)); + std::size_t pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType)); if(pos>pos2) it2=it+1; } } - std::size_t const ret=std::distance(_field_pm_pt.begin(),it2); + std::size_t ret=std::distance(_field_pm_pt.begin(),it2); _field_pm_pt.insert(it2,MEDFileFieldPerMeshPerType::New(this,type)); return (int)ret; } @@ -2923,12 +2899,12 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const if(type==ON_GAUSS_PT) { mcIdType offset=0; - std::size_t const nbOfArrs=dads.size(); + std::size_t nbOfArrs=dads.size(); for(std::size_t i=0;i > const dads2(1,dads[i]); const std::vector locs2(1,locs[i]); + std::vector > dads2(1,dads[i]); const std::vector locs2(1,locs[i]); const std::vector geoTypes2(1,INTERP_KERNEL::NORM_ERROR); - mcIdType const nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2); + mcIdType nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2); MCAuto di=DataArrayIdType::New(); di->alloc(nbOfElems,1); di->iota(offset); @@ -2950,7 +2926,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob, const std::vector >& dads, const std::vector& locs, - const std::vector& /*geoTypes*/, + const std::vector& geoTypes, const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { if(da->isIota(mesh->getNumberOfCells())) @@ -2972,15 +2948,15 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField if(da->isIota(mesh->getNumberOfNodes())) return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); // Treatment of particular case where nodal field on pfl is requested with a meshDimRelToMax=1. - const auto *meshu=dynamic_cast(mesh); + const MEDCouplingUMesh *meshu=dynamic_cast(mesh); if(meshu) { - if(meshu->getNodalConnectivity()==nullptr) + if(meshu->getNodalConnectivity()==0) { MCAuto ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc); - mcIdType const nb=da->getNbOfElems(); + mcIdType nb=da->getNbOfElems(); const mcIdType *ptr=da->getConstPointer(); - auto *meshuc=const_cast(meshu); + MEDCouplingUMesh *meshuc=const_cast(meshu); meshuc->allocateCells(nb); for(mcIdType i=0;iinsertNextCell(INTERP_KERNEL::NORM_POINT1,1,ptr+i); @@ -2995,11 +2971,11 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField // MCAuto ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); isPfl=true; - DataArrayIdType *arr2=nullptr; + DataArrayIdType *arr2=0; MCAuto cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); MCAuto mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2); - MCAuto const arr3(arr2); - mcIdType const nnodes=mesh2->getNumberOfNodes(); + MCAuto arr3(arr2); + mcIdType nnodes=mesh2->getNumberOfNodes(); if(nnodes==(mcIdType)da->getNbOfElems()) { MCAuto da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); @@ -3018,7 +2994,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField oss << " - if definitely the node profile has no link with mesh connectivity use MEDFileField1TS::getFieldWithProfile or MEDFileFieldMultiTS::getFieldWithProfile methods instead !"; throw INTERP_KERNEL::Exception(oss.str()); } - return nullptr; + return 0; } /*! @@ -3040,7 +3016,7 @@ DataArray *MEDFileFieldPerMesh::finishField4(const std::vector safePfl(pflOut); MCAuto da=getOrCreateAndGetArray()->selectByTupleRanges(dads); const std::vector& infos=getInfo(); - std::size_t const nbOfComp=infos.size(); + std::size_t nbOfComp=infos.size(); for(std::size_t i=0;isetInfoOnComponent(i,infos[i].c_str()); safePfl->incrRef(); @@ -3055,7 +3031,7 @@ class MFFPMIter // MEDFileFieldPerMeshIterator public: static MFFPMIter *NewCell(const MEDFileEntities *entities); static bool IsPresenceOfNode(const MEDFileEntities *entities); - virtual ~MFFPMIter() = default; + virtual ~MFFPMIter() { } virtual void begin() = 0; virtual bool finished() const = 0; virtual void next() = 0; @@ -3065,23 +3041,23 @@ public: class MFFPMIterSimple : public MFFPMIter { public: - MFFPMIterSimple() = default; - void begin() override { _pos=0; } - bool finished() const override { return _pos>=MED_N_CELL_FIXED_GEO; } - void next() override { _pos++; } - int current() const override { return _pos; } + MFFPMIterSimple():_pos(0) { } + void begin() { _pos=0; } + bool finished() const { return _pos>=MED_N_CELL_FIXED_GEO; } + void next() { _pos++; } + int current() const { return _pos; } private: - int _pos{0}; + int _pos; }; class MFFPMIter2 : public MFFPMIter { public: MFFPMIter2(const std::vector& cts); - void begin() override { _it=_ids.begin(); } - bool finished() const override { return _it==_ids.end(); } - void next() override { _it++; } - int current() const override { return *_it; } + void begin() { _it=_ids.begin(); } + bool finished() const { return _it==_ids.end(); } + void next() { _it++; } + int current() const { return *_it; } private: std::vector _ids; std::vector::const_iterator _it; @@ -3093,15 +3069,15 @@ MFFPMIter *MFFPMIter::NewCell(const MEDFileEntities *entities) return new MFFPMIterSimple; else { - const auto *entities2(dynamic_cast(entities)); + const MEDFileStaticEntities *entities2(dynamic_cast(entities)); if(entities2) { std::vector tmp; const std::vector< std::pair >& myEnt(entities2->getEntries()); - for(const auto & it : myEnt) + for(std::vector< std::pair >::const_iterator it=myEnt.begin();it!=myEnt.end();it++) { - if(it.first==ON_CELLS || it.first==ON_GAUSS_NE || it.first==ON_GAUSS_PT) - tmp.push_back(it.second); + if((*it).first==ON_CELLS || (*it).first==ON_GAUSS_NE || (*it).first==ON_GAUSS_PT) + tmp.push_back((*it).second); } return new MFFPMIter2(tmp); } @@ -3115,12 +3091,12 @@ bool MFFPMIter::IsPresenceOfNode(const MEDFileEntities *entities) return true; else { - const auto *entities2(dynamic_cast(entities)); + const MEDFileStaticEntities *entities2(dynamic_cast(entities)); if(entities2) { const std::vector< std::pair >& myEnt(entities2->getEntries()); - for(const auto & it : myEnt) - if(it.first==ON_NODES) + for(std::vector< std::pair >::const_iterator it=myEnt.begin();it!=myEnt.end();it++) + if((*it).first==ON_NODES) return true; return false; } @@ -3130,7 +3106,7 @@ bool MFFPMIter::IsPresenceOfNode(const MEDFileEntities *entities) MFFPMIter2::MFFPMIter2(const std::vector& cts) { - std::size_t const sz(cts.size()); + std::size_t sz(cts.size()); _ids.resize(sz); for(std::size_t i=0;i meshName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr pflName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr locName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); - const auto *mmu(dynamic_cast(mm)); + const MEDFileUMesh *mmu(dynamic_cast(mm)); INTERP_KERNEL::AutoCppPtr iter0(MFFPMIter::NewCell(entities)); // for each geometric type inside my mesh, check if there is a field profile ie if the field is defined on this type of cells (whether the discretization is on cells or on gauss_ne) // and if this is the case, retrieve the part to be read and build a new MedFileField from it for(iter0->begin();!iter0->finished();iter0->next()) { - med_int const nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); - std::string const name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); - med_int const nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); - std::string const name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); + med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); + med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); if(nbProfile>0 || nbProfile2>0) { - const PartDefinition *pd(nullptr); + const PartDefinition *pd(0); if(mmu) pd=mmu->getPartDefAtLevel(mmu->getRelativeLevOnGeoType(typmai2[iter0->current()]),typmai2[iter0->current()]); _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[iter0->current()],nasc,pd)); @@ -3180,10 +3156,10 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith if(MFFPMIter::IsPresenceOfNode(entities)) { // if there is a profile on nodes for the current field, retrieve the part to be read and build a new MedFileField from it - med_int const nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName)); + med_int nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName)); if(nbProfile>0) { - const PartDefinition *pd(nullptr); + const PartDefinition *pd(0); if(mmu) pd=mmu->getPartDefAtLevel(1,INTERP_KERNEL::NORM_ERROR); _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_NODES,INTERP_KERNEL::NORM_ERROR,nasc,pd)); @@ -3192,13 +3168,13 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith } if(!entities) return ; - std::vector const dynGT(entities->getDynGTAvail()); - for(int const it : dynGT) + std::vector dynGT(entities->getDynGTAvail()); + for(std::vector::const_iterator it=dynGT.begin();it!=dynGT.end();it++) { - med_int const nbPfl(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,it,pflName,locName)); + med_int nbPfl(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,*it,pflName,locName)); if(nbPfl>0) { - _field_pm_pt.push_back(MEDFileFieldPerMeshPerTypeDyn::NewOnRead(fid,this,entities,it,nasc)); + _field_pm_pt.push_back(MEDFileFieldPerMeshPerTypeDyn::NewOnRead(fid,this,entities,*it,nasc)); setMeshName(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE)); } } @@ -3208,13 +3184,13 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith iter0=MFFPMIter::NewCell(entities); for(iter0->begin();!iter0->finished();iter0->next()) { - med_int const nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); - std::string const name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); - med_int const nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); - std::string const name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); + med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); + med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); if(nbProfile>0 || nbProfile2>0) { - _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[iter0->current()],nasc,nullptr)); + _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[iter0->current()],nasc,NULL)); if(nbProfile>0) setMeshName(name0); else @@ -3232,10 +3208,10 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith INTERP_KERNEL::AutoCppPtr iter0(MFFPMIter::NewCell(entities)); for(iter0->begin();!iter0->finished();iter0->next()) { - med_int const nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); - std::string const name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); - med_int const nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); - std::string const name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); + med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); + med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); if(nbProfile>0 || nbProfile2>0) { _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[iter0->current()],nasc,pd)); @@ -3248,7 +3224,7 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith if(MFFPMIter::IsPresenceOfNode(entities)) { - med_int const nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName)); + med_int nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName)); if(nbProfile>0) { _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_NODES,INTERP_KERNEL::NORM_ERROR,nasc,pd)); diff --git a/src/MEDLoader/MEDFileFieldInternal.hxx b/src/MEDLoader/MEDFileFieldInternal.hxx index b0c9619e4..e2270e5dd 100644 --- a/src/MEDLoader/MEDFileFieldInternal.hxx +++ b/src/MEDLoader/MEDFileFieldInternal.hxx @@ -21,10 +21,6 @@ #ifndef __MEDFILEFIELDINTERNAL_HXX__ #define __MEDFILEFIELDINTERNAL_HXX__ -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCType.hxx" -#include "MEDCouplingTraits.hxx" #include "MEDLoaderDefines.hxx" #include "MEDFileUtilities.hxx" #include "NormalizedGeometricTypes" @@ -33,13 +29,8 @@ #include "med.h" -#include -#include -#include #include #include -#include -#include namespace MEDCoupling { @@ -57,10 +48,10 @@ namespace MEDCoupling { public: MEDFileGTKeeperSta(INTERP_KERNEL::NormalizedCellType gt):_geo_type(gt) { } - MEDFileGTKeeper *deepCopy() const override; - INTERP_KERNEL::NormalizedCellType getGeoType() const override; - std::string getRepr() const override; - bool isEqual(const MEDFileGTKeeper *other) const override; + MEDFileGTKeeper *deepCopy() const; + INTERP_KERNEL::NormalizedCellType getGeoType() const; + std::string getRepr() const; + bool isEqual(const MEDFileGTKeeper *other) const; private: INTERP_KERNEL::NormalizedCellType _geo_type; }; @@ -73,10 +64,10 @@ namespace MEDCoupling { public: MEDFileGTKeeperDyn(const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileStructureElement *se); - MEDFileGTKeeper *deepCopy() const override; - INTERP_KERNEL::NormalizedCellType getGeoType() const override; - std::string getRepr() const override; - bool isEqual(const MEDFileGTKeeper *other) const override; + MEDFileGTKeeper *deepCopy() const; + INTERP_KERNEL::NormalizedCellType getGeoType() const; + std::string getRepr() const; + bool isEqual(const MEDFileGTKeeper *other) const; const MEDFileUMesh *getMesh() const { return _mesh; } const MEDFileUMesh *getSection() const { return _section; } const MEDFileStructureElement *getSE() const { return _se; } @@ -98,8 +89,8 @@ namespace MEDCoupling static MEDFileFieldLoc *New(med_idt fid, const std::string& locName); static MEDFileFieldLoc *New(med_idt fid, int i, const MEDFileEntities *entities); static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileFieldLoc *deepCopy() const; bool isOnStructureElement() const; const MEDFileGTKeeper *getUndergroundGTKeeper() const { return _gt; } @@ -146,8 +137,8 @@ namespace MEDCoupling static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId); static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other); std::string getClassName() const override { return std::string("MEDFileFieldPerMeshPerTypePerDisc"); } - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const; void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); @@ -233,8 +224,8 @@ namespace MEDCoupling { public: std::string getClassName() const override { return std::string("MEDFileFieldPerMeshPerTypeCommon"); } - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); @@ -276,7 +267,7 @@ namespace MEDCoupling void setFather(MEDFileFieldPerMesh *father); void accept(MEDFileFieldVisitor& visitor) const; public: - ~MEDFileFieldPerMeshPerTypeCommon() override; + virtual ~MEDFileFieldPerMeshPerTypeCommon(); virtual void getDimension(int& dim) const = 0; virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0; virtual INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const = 0; @@ -305,14 +296,14 @@ namespace MEDCoupling static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); static MCAuto Aggregate(mcIdType &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo); public:// overload of abstract methods - void getDimension(int& dim) const override; + void getDimension(int& dim) const; INTERP_KERNEL::NormalizedCellType getGeoType() const override; INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const override; - void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const override; - void simpleRepr(int bkOffset, std::ostream& oss, int id) const override; - std::string getGeoTypeRepr() const override; - MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const override; - void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const override; + void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const; + void simpleRepr(int bkOffset, std::ostream& oss, int id) const; + std::string getGeoTypeRepr() const; + MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const; + void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; private: MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *father, INTERP_KERNEL::NormalizedCellType gt); @@ -328,14 +319,14 @@ namespace MEDCoupling int getDynGT() const; std::string getModelName() const; public: - void getDimension(int& dim) const override; + void getDimension(int& dim) const; INTERP_KERNEL::NormalizedCellType getGeoType() const override; INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const override; - void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const override; - void simpleRepr(int bkOffset, std::ostream& oss, int id) const override; - std::string getGeoTypeRepr() const override; - MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const override; - void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const override; + void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const; + void simpleRepr(int bkOffset, std::ostream& oss, int id) const; + std::string getGeoTypeRepr() const; + MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const; + void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; private: MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileStructureElement *se, const MEDFileFieldNameScope& nasc); private: @@ -353,8 +344,8 @@ namespace MEDCoupling static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities); static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const PartDefinition *pd, const MEDFileEntities *entities); std::string getClassName() const override { return std::string("MEDFileFieldPerMesh"); } - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const; void simpleRepr(int bkOffset,std::ostream& oss, int id) const; void copyTinyInfoFrom(const MEDCouplingMesh *mesh); @@ -425,7 +416,7 @@ namespace MEDCoupling MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities); MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const PartDefinition *pd, const MEDFileEntities *entities); MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh); - MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& /*meshName*/, int meshIt, int meshOrd):_mesh_iteration(meshIt),_mesh_order(meshOrd),_father(fath) { } + MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_mesh_iteration(meshIt),_mesh_order(meshOrd),_father(fath) { } private: int _mesh_iteration; int _mesh_order; diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 46dd6b150..fc243e844 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -19,43 +19,15 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileFieldMultiTS.hxx" -#include "MEDFileField.txx" -#include "MCType.hxx" -#include "MEDFileFieldGlobs.hxx" -#include "MEDFileEntities.hxx" -#include "InterpKernelException.hxx" -#include "MCAuto.hxx" -#include "MEDFileField1TS.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingMemArray.hxx" -#include "InterpKernelAutoPtr.hxx" -#include "MEDFileBasis.hxx" -#include "MCIdType.hxx" -#include "MEDFileFieldOverView.hxx" #include "MEDFileFieldVisitor.hxx" #include "MEDFileSafeCaller.txx" -#include "MEDFileUtilities.hxx" #include "MEDLoaderBase.hxx" +#include "MEDFileField.txx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" -#include "NormalizedGeometricTypes" -#include "med.h" -#include "medfield.h" -#include "MEDLoaderTraits.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include + #include -#include -#include -#include using namespace MEDCoupling; @@ -79,7 +51,8 @@ extern INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type g //= MEDFileAnyTypeFieldMultiTSWithoutSDA MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA() -= default; +{ +} MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileFieldNameScope(fieldName,meshName) { @@ -92,7 +65,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_i { med_field_type typcha; std::string dtunitOut,meshName; - int const nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,fieldId,false,_name,typcha,_infos,dtunitOut,meshName)); + int nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,fieldId,false,_name,typcha,_infos,dtunitOut,meshName)); setMeshName(meshName); setDtUnit(dtunitOut.c_str()); loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,typcha,loadAll,ms,entities); @@ -112,16 +85,16 @@ catch(INTERP_KERNEL::Exception& e) std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const { std::size_t ret(_mesh_name.capacity()+_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto)); - for(const auto & _info : _infos) - ret+=_info.capacity(); + for(std::vector::const_iterator it=_infos.begin();it!=_infos.end();it++) + ret+=(*it).capacity(); return ret; } std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _time_step : _time_steps) - ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)_time_step); + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it); return ret; } @@ -133,7 +106,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil { MCAuto ret=createNew(); ret->setInfo(_infos); - int const sz=(int)_time_steps.size(); + int sz=(int)_time_steps.size(); for(const int *id=startIds;id!=endIds;id++) { if(*id>=0 && *id ret=createNew(); ret->setInfo(_infos); - std::size_t const sz=_time_steps.size(); + std::size_t sz=_time_steps.size(); std::size_t j=bg; for(int i=0;i ids=DataArrayInt::New(); ids->alloc(0,1); - for(auto it=_time_steps.begin();it!=_time_steps.end();it++,id++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) { const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(!cur) continue; - std::pair const p(cur->getIteration(),cur->getOrder()); + std::pair p(cur->getIteration(),cur->getOrder()); if(std::find(timeSteps.begin(),timeSteps.end(),p)!=timeSteps.end()) ids->pushBackSilent(id); } @@ -218,12 +191,12 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::part { int id=0; MCAuto ids=DataArrayInt::New(); ids->alloc(0,1); - for(auto it=_time_steps.begin();it!=_time_steps.end();it++,id++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) { const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(!cur) continue; - std::pair const p(cur->getIteration(),cur->getOrder()); + std::pair p(cur->getIteration(),cur->getOrder()); if(std::find(timeSteps.begin(),timeSteps.end(),p)==timeSteps.end()) ids->pushBackSilent(id); } @@ -232,18 +205,18 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::part bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfStructureElements() const { - for(const auto & _time_step : _time_steps) - if(_time_step.isNotNull()) - if(_time_step->presenceOfStructureElements()) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + if((*it)->presenceOfStructureElements()) return true; return false; } bool MEDFileAnyTypeFieldMultiTSWithoutSDA::onlyStructureElements() const { - for(const auto & _time_step : _time_steps) - if(_time_step.isNotNull()) - if(!_time_step->onlyStructureElements()) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + if(!(*it)->onlyStructureElements()) return false; return true; } @@ -251,20 +224,20 @@ bool MEDFileAnyTypeFieldMultiTSWithoutSDA::onlyStructureElements() const void MEDFileAnyTypeFieldMultiTSWithoutSDA::killStructureElements() { std::vector< MCAuto > ret; - for(auto & _time_step : _time_steps) - if(_time_step.isNotNull()) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) { - if(_time_step->presenceOfStructureElements()) + if((*it)->presenceOfStructureElements()) { - if(!_time_step->onlyStructureElements()) + if(!(*it)->onlyStructureElements()) { - _time_step->killStructureElements(); - ret.push_back(_time_step); + (*it)->killStructureElements(); + ret.push_back(*it); } } else { - ret.push_back(_time_step); + ret.push_back(*it); } } _time_steps=ret; @@ -273,14 +246,14 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::killStructureElements() void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyStructureElements() { std::vector< MCAuto > ret; - for(auto & _time_step : _time_steps) - if(_time_step.isNotNull()) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) { - if(_time_step->presenceOfStructureElements()) + if((*it)->presenceOfStructureElements()) { - if(!_time_step->onlyStructureElements()) - _time_step->keepOnlyStructureElements(); - ret.push_back(_time_step); + if(!(*it)->onlyStructureElements()) + (*it)->keepOnlyStructureElements(); + ret.push_back(*it); } } _time_steps=ret; @@ -288,44 +261,44 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyStructureElements() void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyOnSE(const std::string& seName) { - std::vector< MCAuto > const ret; - for(auto & _time_step : _time_steps) - if(_time_step.isNotNull()) - _time_step->keepOnlyOnSE(seName); + std::vector< MCAuto > ret; + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + (*it)->keepOnlyOnSE(seName); } void MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames(std::vector< std::pair >& ps) const { std::vector< std::pair > ps2; - for(const auto & _time_step : _time_steps) - if(_time_step.isNotNull()) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) { - _time_step->getMeshSENames(ps2); + (*it)->getMeshSENames(ps2); break; } if(ps2.empty()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : this appears to not contain SE only !"); - for(const auto & _time_step : _time_steps) - if(_time_step.isNotNull()) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) { std::vector< std::pair > ps3; - _time_step->getMeshSENames(ps3); + (*it)->getMeshSENames(ps3); if(ps2!=ps3) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : For the moment only homogeneous SE def through time managed !"); } - for(const auto & it : ps2) + for(std::vector< std::pair >::const_iterator it=ps2.begin();it!=ps2.end();it++) { - auto const it2(std::find(ps.begin(),ps.end(),it)); + std::vector< std::pair >::iterator it2(std::find(ps.begin(),ps.end(),*it)); if(it2==ps.end()) - ps.push_back(it); + ps.push_back(*it); } } bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const { - for(const auto & _time_step : _time_steps) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - const MEDFileAnyTypeField1TSWithoutSDA *cur(_time_step); + const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(!cur) continue; if(cur->presenceOfMultiDiscPerGeoType()) @@ -347,16 +320,16 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setInfo(const std::vector >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) { const MEDFileAnyTypeField1TSWithoutSDA *pt(*it); if(pt->isDealingTS(iteration,order)) return ret; } std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepPos : Muli timestep field on time (" << iteration << "," << order << ") does not exist ! Available (iteration,order) are :\n"; - std::vector< std::pair > const vp=getIterations(); - for(const auto & it2 : vp) - oss << "(" << it2.first << "," << it2.second << ") "; + std::vector< std::pair > vp=getIterations(); + for(std::vector< std::pair >::const_iterator it2=vp.begin();it2!=vp.end();it2++) + oss << "(" << (*it2).first << "," << (*it2).second << ") "; throw INTERP_KERNEL::Exception(oss.str()); } @@ -373,17 +346,17 @@ MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeS bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret(false); - for(const auto & it : modifTab) + for(std::vector< std::pair >::const_iterator it=modifTab.begin();it!=modifTab.end();it++) { - if(it.first==getMeshName()) + if((*it).first==getMeshName()) { - setMeshName(it.second); + setMeshName((*it).second); ret=true; } } - for(auto & _time_step : _time_steps) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - MEDFileAnyTypeField1TSWithoutSDA *cur(_time_step); + MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(cur) ret=cur->changeMeshNames(modifTab) || ret; } @@ -410,9 +383,9 @@ bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std MEDFileFieldGlobsReal& glob) { bool ret=false; - for(auto & _time_step : _time_steps) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - MEDFileAnyTypeField1TSWithoutSDA *f1ts(_time_step); + MEDFileAnyTypeField1TSWithoutSDA *f1ts(*it); if(f1ts) ret=f1ts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret; } @@ -421,31 +394,31 @@ bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std void MEDFileAnyTypeFieldMultiTSWithoutSDA::accept(MEDFileFieldVisitor& visitor) const { - for(const auto & _time_step : _time_steps) - if(_time_step.isNotNull()) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) { - visitor.newTimeStepEntry(_time_step); - _time_step->accept(visitor); - visitor.endTimeStepEntry(_time_step); + visitor.newTimeStepEntry(*it); + (*it)->accept(visitor); + visitor.endTimeStepEntry(*it); } } void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const { - std::string const startLine(bkOffset,' '); + std::string startLine(bkOffset,' '); oss << startLine << "Field multi time steps [Type=" << getTypeStr() << "]"; if(fmtsId>=0) oss << " (" << fmtsId << ")"; oss << " has the following name: \"" << _name << "\"." << std::endl; oss << startLine << "Field multi time steps has " << _infos.size() << " components with the following infos :" << std::endl; - for(const auto & _info : _infos) + for(std::vector::const_iterator it=_infos.begin();it!=_infos.end();it++) { - oss << startLine << " - \"" << _info << "\"" << std::endl; + oss << startLine << " - \"" << *it << "\"" << std::endl; } int i=0; - for(auto it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { - std::string const chapter(17,(char)('0'+i)); + std::string chapter(17,(char)('0'+i)); oss << startLine << chapter << std::endl; const MEDFileAnyTypeField1TSWithoutSDA *cur=(*it); if(cur) @@ -458,7 +431,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream std::vector< std::pair > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeSteps(std::vector& ret1) const { - std::size_t const sz=_time_steps.size(); + std::size_t sz=_time_steps.size(); std::vector< std::pair > ret(sz); ret1.resize(sz); for(std::size_t i=0;i >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - MEDFileAnyTypeField1TSWithoutSDA *cur=_time_step; + MEDFileAnyTypeField1TSWithoutSDA *cur=(*it); if(cur) { if((cur->getInfo()).size()!=nbOfCompo) @@ -520,23 +493,23 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysR // INTERP_KERNEL::AutoCppPtr entitiesFast; const MEDFileEntities *entitiesForSubInstances(entities); - MEDFileCapability const mfcap(fid); + MEDFileCapability mfcap(fid); if( ( !entities || entities->areAllStaticPresentAndNoDyn() ) && mfcap.isFastReader()) {// no entities - med_int const nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT)); + med_int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT)); INTERP_KERNEL::AutoPtr types(new med_entity_type[nentitype]); med_int usedbyncs; MEDFILESAFECALLERRD0(MEDfieldEntityType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types,&usedbyncs)); std::vector< std::pair > entitiesFastP; for(int i=0;i geotypes(new med_geometry_type[ngeotype]); med_int geousedbyncs; MEDFILESAFECALLERRD0(MEDfieldGeometryType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i],geotypes,&geousedbyncs)); for(med_int j=0;j const p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),ConvertGeometryType(geotypes[j])); + std::pair p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),ConvertGeometryType(geotypes[j])); entitiesFastP.push_back(p); } } @@ -545,7 +518,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysR } for(int i=0;i > const ts; + std::vector< std::pair > ts; med_int numdt=0,numo=0; med_float dt=0.0; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,_name.c_str(),i+1,&numdt,&numo,&dt)); @@ -596,12 +569,12 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWri throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !"); checkThatNbOfCompoOfTSMatchThis(); std::vector infos(getInfo()); - std::size_t const nbComp=infos.size(); + std::size_t nbComp=infos.size(); INTERP_KERNEL::AutoPtr comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE); for(unsigned int i=0;iwriteLL(fid,opts,*this); } void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(auto & _time_step : _time_steps) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - MEDFileAnyTypeField1TSWithoutSDA *elt(_time_step); + MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) elt->loadBigArraysRecursively(fid,nasc); } @@ -627,9 +600,9 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(auto & _time_step : _time_steps) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - MEDFileAnyTypeField1TSWithoutSDA *elt(_time_step); + MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) elt->loadBigArraysRecursivelyIfNecessary(fid,nasc); } @@ -637,9 +610,9 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(m void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays() { - for(auto & _time_step : _time_steps) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - MEDFileAnyTypeField1TSWithoutSDA *elt(_time_step); + MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) elt->unloadArrays(); } @@ -653,11 +626,11 @@ int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS() { std::vector< MCAuto > newTS; - for(const auto & _time_step : _time_steps) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - const MEDFileAnyTypeField1TSWithoutSDA *tmp=_time_step; + const MEDFileAnyTypeField1TSWithoutSDA *tmp=(*it); if(tmp) - newTS.push_back(_time_step); + newTS.push_back(*it); } _time_steps=newTS; } @@ -665,7 +638,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS() void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds) { std::vector< MCAuto > newTS; - int const maxId=(int)_time_steps.size(); + int maxId=(int)_time_steps.size(); int ii=0; std::set idsToDel; for(const int *id=startIds;id!=endIds;id++,ii++) @@ -689,10 +662,10 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step) { static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2"; - mcIdType const nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); + mcIdType nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); if(nbOfEntriesToKill==0) return ; - std::size_t const sz=_time_steps.size(); + std::size_t sz=_time_steps.size(); std::vector b(sz,true); int j=bg; for(mcIdType i=0;i >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) { const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it); if(tmp) @@ -729,13 +702,13 @@ int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosGivenTime(double time, double ep int ret=0; std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : "; oss.precision(15); - for(auto it=_time_steps.begin();it!=_time_steps.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) { const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it); if(tmp) { int it2,ord; - double const ti=tmp->getTime(it2,ord); + double ti=tmp->getTime(it2,ord); if(fabs(time-ti) > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const { - std::size_t const lgth=_time_steps.size(); + std::size_t lgth=_time_steps.size(); std::vector< std::pair > ret(lgth); for(std::size_t i=0;ifillIteration(ret[i]); @@ -798,7 +771,7 @@ const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::ge throw INTERP_KERNEL::Exception(oss.str()); } const MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos]; - if(item==nullptr) + if(item==0) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !"; oss << "\nTry to use following method eraseEmptyTS !"; @@ -815,7 +788,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeS throw INTERP_KERNEL::Exception(oss.str()); } MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos]; - if(item==nullptr) + if(item==0) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !"; oss << "\nTry to use following method eraseEmptyTS !"; @@ -828,14 +801,14 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed { std::vector ret; std::set ret2; - for(const auto & _time_step : _time_steps) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - std::vector const tmp=_time_step->getPflsReallyUsed2(); - for(const auto & it2 : tmp) - if(ret2.find(it2)==ret2.end()) + std::vector tmp=(*it)->getPflsReallyUsed2(); + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + if(ret2.find(*it2)==ret2.end()) { - ret.push_back(it2); - ret2.insert(it2); + ret.push_back(*it2); + ret2.insert(*it2); } } return ret; @@ -845,14 +818,14 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed { std::vector ret; std::set ret2; - for(const auto & _time_step : _time_steps) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - std::vector const tmp=_time_step->getLocsReallyUsed2(); - for(const auto & it2 : tmp) - if(ret2.find(it2)==ret2.end()) + std::vector tmp=(*it)->getLocsReallyUsed2(); + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + if(ret2.find(*it2)==ret2.end()) { - ret.push_back(it2); - ret2.insert(it2); + ret.push_back(*it2); + ret2.insert(*it2); } } return ret; @@ -861,9 +834,9 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const { std::vector ret; - for(const auto & _time_step : _time_steps) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - std::vector tmp=_time_step->getPflsReallyUsedMulti2(); + std::vector tmp=(*it)->getPflsReallyUsedMulti2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); } return ret; @@ -872,9 +845,9 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const { std::vector ret; - for(const auto & _time_step : _time_steps) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { - std::vector tmp=_time_step->getLocsReallyUsedMulti2(); + std::vector tmp=(*it)->getLocsReallyUsedMulti2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); } return ret; @@ -882,19 +855,19 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & _time_step : _time_steps) - _time_step->changePflsRefsNamesGen2(mapOfModif); + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + (*it)->changePflsRefsNamesGen2(mapOfModif); } void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(auto & _time_step : _time_steps) - _time_step->changeLocsRefsNamesGen2(mapOfModif); + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + (*it)->changeLocsRefsNamesGen2(mapOfModif); } std::vector< std::vector > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const { - std::size_t const lgth=_time_steps.size(); + std::size_t lgth=_time_steps.size(); std::vector< std::vector > ret(lgth); for(std::size_t i=0;ifillTypesOfFieldAvailable(ret[i]); @@ -913,7 +886,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deep { MCAuto ret=shallowCpy(); std::size_t i=0; - for(auto it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { if((const MEDFileAnyTypeField1TSWithoutSDA *)*it) ret->_time_steps[i]=(*it)->deepCopy(); @@ -933,7 +906,7 @@ std::vector< MCAuto > MEDFileAnyTypeFieldM } for(std::size_t i=0;i > const ret1=_time_steps[i]->splitComponents(); + std::vector< MCAuto > ret1=_time_steps[i]->splitComponents(); if(ret1.size()!=sz) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents : At rank #" << i << " number of components is " << ret1.size() << " whereas it should be for all time steps " << sz << " !"; @@ -953,7 +926,7 @@ std::vector< MCAuto > MEDFileAnyTypeFieldM */ std::vector< MCAuto > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const { - std::size_t const sz(_time_steps.size()); + std::size_t sz(_time_steps.size()); std::vector< std::vector< MCAuto > > items(sz); for(std::size_t i=0;i > MEDFileAnyTypeFieldM std::vector< MCAuto > ret; std::vector< std::vector< MCAuto > > ret2; std::vector< TypeOfField > types; - for(const auto & item : items) - for(const auto & it1 : item) + for(std::vector< std::vector< MCAuto > >::const_iterator it0=items.begin();it0!=items.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) { - std::vector ts=it1->getTypesOfFieldAvailable(); + std::vector ts=(*it1)->getTypesOfFieldAvailable(); if(ts.size()!=1) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : it appears that the splitting of MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations has returned invalid result !"); - auto const it2=std::find(types.begin(),types.end(),ts[0]); + std::vector< TypeOfField >::iterator it2=std::find(types.begin(),types.end(),ts[0]); if(it2==types.end()) types.push_back(ts[0]); } ret.resize(types.size()); ret2.resize(types.size()); - for(const auto & item : items) - for(const auto & it1 : item) + for(std::vector< std::vector< MCAuto > >::const_iterator it0=items.begin();it0!=items.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) { - TypeOfField const typ=it1->getTypesOfFieldAvailable()[0]; - std::size_t const pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ)); - ret2[pos].push_back(it1); + TypeOfField typ=(*it1)->getTypesOfFieldAvailable()[0]; + std::size_t pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ)); + ret2[pos].push_back(*it1); } for(std::size_t i=0;i elt(createNew()); - for(auto & it1 : ret2[i]) - elt->pushBackTimeStep(it1);//also updates infos in elt + for(std::vector< MCAuto >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++) + elt->pushBackTimeStep(*it1);//also updates infos in elt ret[i]=elt; elt->MEDFileFieldNameScope::operator=(*this); } @@ -1003,7 +976,7 @@ std::vector< MCAuto > MEDFileAnyTypeFieldM */ std::vector< MCAuto > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const { - std::size_t const sz(_time_steps.size()); + std::size_t sz(_time_steps.size()); std::vector< std::vector< MCAuto > > items(sz); std::size_t szOut(std::numeric_limits::max()); for(std::size_t i=0;i >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++) { const MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) @@ -1131,7 +1104,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingF void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto ts) { - int const sz=(int)_time_steps.size(); + int sz=(int)_time_steps.size(); if(i<0 || i>=sz) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element at place #" << i << " should be in [0," << sz << ") !"; @@ -1158,7 +1131,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=getTimeStepEntry(iteration,order); - const auto *myF1TSC=dynamic_cast(&myF1TS); + const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2 : mismatch of type of field expecting FLOAT64 !"); return myF1TSC->getFieldSplitedByType2(mname,types,typesF,pfls,locs); @@ -1169,15 +1142,15 @@ MEDFileInt32FieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt( MCAuto ret(new MEDFileInt32FieldMultiTSWithoutSDA); ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this); int i=0; - for(auto it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it); if(eltToConv) { - const auto *eltToConvC=dynamic_cast(eltToConv); + const MEDFileField1TSWithoutSDA *eltToConvC=dynamic_cast(eltToConv); if(!eltToConvC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type FLOAT64 !"); - MCAuto const elt=eltToConvC->convertToInt(); + MCAuto elt=eltToConvC->convertToInt(); ret->setIteration(i,elt); } } @@ -1217,7 +1190,8 @@ MCAuto MEDFileFloatFieldMultiTSWithoutSDA::createNew //= MEDFileAnyTypeFieldMultiTS MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS() -= default; +{ +} MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms) try:MEDFileFieldGlobsReal(fid) @@ -1292,29 +1266,29 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr { case MED_FLOAT64: { - ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr); + ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); break; } case MED_INT32: { - ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr); + ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); break; } case MED_INT64: { - ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr); + ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); break; } case MED_FLOAT32: { - ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr); + ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); break; } case MED_INT: { if(sizeof(med_int)==sizeof(int)) { - ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,nullptr); + ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); break; } } @@ -1363,7 +1337,7 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromCont MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid) { MEDFileAnyTypeFieldMultiTS *ret(BuildNewInstanceFromContent(c)); - std::string const fileName(FileNameFromFID(fid)); + std::string fileName(FileNameFromFID(fid)); ret->setFileName(fileName); return ret; } @@ -1391,13 +1365,13 @@ catch(INTERP_KERNEL::Exception& e) */ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, bool loadAll) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,loadAll); } MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, bool loadAll) { - MCAuto c(BuildContentFrom(fid,loadAll,nullptr)); + MCAuto c(BuildContentFrom(fid,loadAll,0)); MCAuto ret(BuildNewInstanceFromContent(c,fid)); ret->loadGlobals(fid); return ret.retn(); @@ -1415,13 +1389,13 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, bool lo */ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,fieldName,loadAll); } MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, const std::string& fieldName, bool loadAll) { - MCAuto c(BuildContentFrom(fid,fieldName,loadAll,nullptr,nullptr)); + MCAuto c(BuildContentFrom(fid,fieldName,loadAll,0,0)); MCAuto ret(BuildNewInstanceFromContent(c,fid)); ret->loadGlobals(fid); return ret.retn(); @@ -1515,7 +1489,7 @@ void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds2(int bg, int end, int step) MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const { - MCAuto const c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds); + MCAuto c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds); MCAuto ret=shallowCpy(); ret->_content=c; return ret.retn(); @@ -1523,7 +1497,7 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int * MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const { - MCAuto const c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step); + MCAuto c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step); MCAuto ret=shallowCpy(); ret->_content=c; return ret.retn(); @@ -1536,15 +1510,15 @@ std::vector< std::pair > MEDFileAnyTypeFieldMultiTS::getIterations() co void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(const std::vector& f1ts) { - for(auto f1t : f1ts) - pushBackTimeStep(f1t); + for(std::vector::const_iterator it=f1ts.begin();it!=f1ts.end();it++) + pushBackTimeStep(*it); } void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(MEDFileAnyTypeFieldMultiTS *fmts) { if(!fmts) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps : Input fmts is NULL !"); - int const nbOfTS(fmts->getNumberOfTS()); + int nbOfTS(fmts->getNumberOfTS()); for(int i=0;i elt(fmts->getTimeStepAtPos(i)); @@ -1558,7 +1532,7 @@ void MEDFileAnyTypeFieldMultiTS::pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !"); checkCoherencyOfType(f1ts); f1ts->incrRef(); - MCAuto const f1tsSafe(f1ts); + MCAuto f1tsSafe(f1ts); MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase(); c->incrRef(); MCAuto cSafe(c); @@ -1681,7 +1655,7 @@ void MEDFileAnyTypeFieldMultiTS::loadArrays() { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::loadArrays : the structure does not come from a file !"); - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName())); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName())); contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase()); } @@ -1696,7 +1670,7 @@ void MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary() { if(!getFileName().empty()) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(getFileName())); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName())); contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase()); } } @@ -1757,7 +1731,7 @@ std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS:: if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitComponents : no content in this ! Unable to split components !"); std::vector< MCAuto > contentsSplit=content->splitComponents(); - std::size_t const sz(contentsSplit.size()); + std::size_t sz(contentsSplit.size()); std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz); for(std::size_t i=0;i > MEDFileAnyTypeFieldMultiTS:: if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitDiscretizations : no content in this ! Unable to split discretizations !"); std::vector< MCAuto > contentsSplit(content->splitDiscretizations()); - std::size_t const sz(contentsSplit.size()); + std::size_t sz(contentsSplit.size()); std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz); for(std::size_t i=0;i > MEDFileAnyTypeFieldMultiTS:: if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretizations !"); std::vector< MCAuto > contentsSplit(content->splitMultiDiscrPerGeoTypes()); - std::size_t const sz(contentsSplit.size()); + std::size_t sz(contentsSplit.size()); std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz); for(std::size_t i=0;i MEDFileAnyTypeFieldMultiTS::getCont */ MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStep(int iteration, int order) const { - int const pos=getPosOfTimeStep(iteration,order); + int pos=getPosOfTimeStep(iteration,order); return getTimeStepAtPos(pos); } @@ -1845,7 +1819,7 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStep(int iteration, i */ MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime(double time, double eps) const { - int const pos=getPosGivenTime(time,eps); + int pos=getPosGivenTime(time,eps); return getTimeStepAtPos(pos); } @@ -1864,11 +1838,11 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult std::list lstFMTS(vectFMTS.begin(),vectFMTS.end()); while(!lstFMTS.empty()) { - auto it(lstFMTS.begin()); + std::list::iterator it(lstFMTS.begin()); MEDFileAnyTypeFieldMultiTS *curIt(*it); if(!curIt) throw INTERP_KERNEL::Exception(msg); - std::vector< std::pair > const refIts=curIt->getIterations(); + std::vector< std::pair > refIts=curIt->getIterations(); std::vector elt; elt.push_back(curIt); it=lstFMTS.erase(it); while(it!=lstFMTS.end()) @@ -1876,7 +1850,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult curIt=*it; if(!curIt) throw INTERP_KERNEL::Exception(msg); - std::vector< std::pair > const curIts=curIt->getIterations(); + std::vector< std::pair > curIts=curIt->getIterations(); if(refIts==curIts) { elt.push_back(curIt); it=lstFMTS.erase(it); } else @@ -1917,7 +1891,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult std::vector< std::vector > ret; if(vectFMTS.empty()) return ret; - auto it(vectFMTS.begin()); + std::vector::const_iterator it(vectFMTS.begin()); MEDFileAnyTypeFieldMultiTS *frstElt(*it); if(!frstElt) throw INTERP_KERNEL::Exception(msg); @@ -1942,7 +1916,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult std::vector< MCAuto > cmps; std::vector< std::vector > retCell=SplitPerCommonSupportNotNodesAlg(vectFMTSNotNodes,mesh,cmps); ret=retCell; - for(auto vectFMTSNode : vectFMTSNodes) + for(std::vector::const_iterator it2=vectFMTSNodes.begin();it2!=vectFMTSNodes.end();it2++) { i=0; bool isFetched(false); @@ -1950,14 +1924,14 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult { if((*it0).empty()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : internal error !"); - if(cmps[i]->isCompatibleWithNodesDiscr(vectFMTSNode)) - { ret[i].push_back(vectFMTSNode); isFetched=true; } + if(cmps[i]->isCompatibleWithNodesDiscr(*it2)) + { ret[i].push_back(*it2); isFetched=true; } } if(!isFetched) { - std::vector const tmp(1,vectFMTSNode); + std::vector tmp(1,*it2); MCAuto tmp2(MEDFileMeshStruct::New(mesh)); - ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,vectFMTSNode)); + ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2)); } } fsc=cmps; @@ -1974,7 +1948,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult std::list lstFMTS(vectFMTS.begin(),vectFMTS.end()); while(!lstFMTS.empty()) { - auto it(lstFMTS.begin()); + std::list::iterator it(lstFMTS.begin()); MEDFileAnyTypeFieldMultiTS *ref(*it); std::vector elt; elt.push_back(ref); it=lstFMTS.erase(it); @@ -2021,7 +1995,7 @@ int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiT std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh \""<< f1->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !"; throw INTERP_KERNEL::Exception(oss.str()); } - int const nts=f0->getNumberOfTS(); + int nts=f0->getNumberOfTS(); if(nts!=f1->getNumberOfTS()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : number of time steps are not the same !"); if(nts==0) @@ -2067,14 +2041,14 @@ MCAuto AggregateHelperF1TS(const std::vector< typename M throw INTERP_KERNEL::Exception("AggregateHelperF1TS : empty vector !"); std::size_t sz(f1tss.size()),i(0); std::vector< typename MLFieldTraits::F1TSWSDAType const *> f1tsw(sz); - for(auto it=f1tss.begin();it!=f1tss.end();it++,i++) + for(typename std::vector< typename MLFieldTraits::F1TSType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++,i++) { typename MLFieldTraits::F1TSType const *elt(*it); if(!elt) throw INTERP_KERNEL::Exception("AggregateHelperF1TS : presence of a null pointer !"); f1tsw[i]=dynamic_cast::F1TSWSDAType const *>(elt->contentNotNullBase()); } - auto *retc(dynamic_cast::F1TSWSDAType *>(ret->contentNotNullBase())); + typename MLFieldTraits::F1TSWSDAType *retc(dynamic_cast::F1TSWSDAType *>(ret->contentNotNullBase())); if(!retc) throw INTERP_KERNEL::Exception("AggregateHelperF1TS : internal error 1 !"); retc->aggregate(f1tsw,dts); @@ -2088,15 +2062,15 @@ MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< type MCAuto< typename MLFieldTraits::FMTSType > ret(MLFieldTraits::FMTSType::New()); if(fmtss.empty()) throw INTERP_KERNEL::Exception("AggregateHelperFMTS : empty vector !"); - std::size_t const sz(fmtss.size()); - for(auto it=fmtss.begin();it!=fmtss.end();it++) + std::size_t sz(fmtss.size()); + for(typename std::vector< typename MLFieldTraits::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++) { typename MLFieldTraits::FMTSType const *elt(*it); if(!elt) throw INTERP_KERNEL::Exception("AggregateHelperFMTS : presence of null pointer !"); } - int const nbTS(fmtss[0]->getNumberOfTS()); - for(auto it=fmtss.begin();it!=fmtss.end();it++) + int nbTS(fmtss[0]->getNumberOfTS()); + for(typename std::vector< typename MLFieldTraits::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++) if((*it)->getNumberOfTS()!=nbTS) throw INTERP_KERNEL::Exception("AggregateHelperFMTS : all fields must have the same number of TS !"); for(int iterTS=0;iterTS AggregateHelperFMTS(const std::vector< type std::size_t i(0); std::vector< typename MLFieldTraits::F1TSType const *> f1tss(sz); std::vector< MCAuto::F1TSType> > f1tss2(sz); - for(auto it=fmtss.begin();it!=fmtss.end();it++,i++) + for(typename std::vector< typename MLFieldTraits::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++,i++) { f1tss2[i]=(*it)->getTimeStepAtPos(iterTS); f1tss[i]=f1tss2[i]; } MCAuto f1ts(AggregateHelperF1TS(f1tss,dts)); ret->pushBackTimeStep(f1ts); @@ -2121,27 +2095,27 @@ MCAuto MEDFileAnyTypeFieldMultiTS::Aggregate(const s { if(fmtss.empty()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !"); - std::size_t const sz(fmtss.size()); + std::size_t sz(fmtss.size()); std::vector fmtss1; std::vector fmtss2; std::vector fmtss3; - for(auto fmts : fmtss) + for(std::vector::const_iterator it=fmtss.begin();it!=fmtss.end();it++) { - if(!fmts) + if(!(*it)) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : presence of null instance in input vector !"); - const auto *elt1(dynamic_cast(fmts)); + const MEDFileFieldMultiTS *elt1(dynamic_cast(*it)); if(elt1) { fmtss1.push_back(elt1); continue; } - const auto *elt2(dynamic_cast(fmts)); + const MEDFileInt32FieldMultiTS *elt2(dynamic_cast(*it)); if(elt2) { fmtss2.push_back(elt2); continue; } - const auto *elt3(dynamic_cast(fmts)); + const MEDFileInt64FieldMultiTS *elt3(dynamic_cast(*it)); if(elt3) { fmtss3.push_back(elt3); @@ -2186,7 +2160,7 @@ MEDFileInt32FieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(content) { - const auto *contc=dynamic_cast(content); + const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !"); MCAuto newc(contc->convertToInt()); @@ -2236,7 +2210,8 @@ MEDFileAnyTypeFieldMultiTSIterator::MEDFileAnyTypeFieldMultiTSIterator(MEDFileAn } MEDFileAnyTypeFieldMultiTSIterator::~MEDFileAnyTypeFieldMultiTSIterator() -= default; +{ +} MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTSIterator::nextt() { @@ -2246,10 +2221,10 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTSIterator::nextt() if(fmts) return fmts->getTimeStepAtPos(_iter_id++); else - return nullptr; + return 0; } else - return nullptr; + return 0; } //= MEDFileInt32FieldMultiTS diff --git a/src/MEDLoader/MEDFileFieldMultiTS.hxx b/src/MEDLoader/MEDFileFieldMultiTS.hxx index a954e9696..3de1e84f8 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.hxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.hxx @@ -20,24 +20,11 @@ #pragma once -#include "MEDCouplingRefCountObject.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingTraits.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCType.hxx" #include "MEDLoaderDefines.hxx" #include "MEDFileField1TS.hxx" #include "MEDFileFieldGlobs.hxx" #include "MEDLoaderTraits.hxx" -#include "MEDFileUtilities.txx" -#include -#include "med.h" -#include -#include -#include -#include -#include "NormalizedGeometricTypes" -#include +#include "MEDFileUtilities.hxx" namespace MEDCoupling { @@ -58,8 +45,8 @@ namespace MEDCoupling MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); public: MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileAnyTypeFieldMultiTSWithoutSDA"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT virtual std::vector< MCAuto > splitComponents() const; MEDLOADER_EXPORT virtual std::vector< MCAuto > splitDiscretizations() const; @@ -140,9 +127,9 @@ namespace MEDCoupling { public: MEDLOADER_EXPORT static typename MLFieldTraits::FMTSWSDAType *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); - MEDLOADER_EXPORT const char *getTypeStr() const override; - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const override; - MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const override; + MEDLOADER_EXPORT const char *getTypeStr() const; + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const; + MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileTemplateFieldMultiTSWithoutSDA"); } protected: MEDFileTemplateFieldMultiTSWithoutSDA() { } @@ -150,7 +137,7 @@ namespace MEDCoupling /** \param [in] fieldId field id in C mode */ MEDFileTemplateFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } MEDFileTemplateFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } - void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const override; + void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; }; class MEDFileFieldMultiTSWithoutSDA : public MEDFileTemplateFieldMultiTSWithoutSDA @@ -160,15 +147,15 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA *convertToInt() const; - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const override { return new MEDFileFieldMultiTSWithoutSDA(*this); } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileFieldMultiTSWithoutSDA(*this); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFieldMultiTSWithoutSDA"); } MEDLOADER_EXPORT MCAuto createNewWithSDA() const override; protected: MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } - med_field_type getMEDFileFieldType() const override { return MED_FLOAT64; } + med_field_type getMEDFileFieldType() const { return MED_FLOAT64; } public: - MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA() = default; + MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA() { } }; template @@ -188,15 +175,15 @@ namespace MEDCoupling friend class MEDFileTemplateFieldMultiTSWithoutSDA; public: MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const override { return new MEDFileInt32FieldMultiTSWithoutSDA(*this); } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileInt32FieldMultiTSWithoutSDA(*this); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32FieldMultiTSWithoutSDA"); } MEDLOADER_EXPORT MCAuto createNewWithSDA() const override; protected: MEDFileInt32FieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } MEDFileInt32FieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } - med_field_type getMEDFileFieldType() const override { return MED_INT32; } + med_field_type getMEDFileFieldType() const { return MED_INT32; } public: - MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA() = default; + MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA() { } }; class MEDFileInt64FieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA @@ -204,15 +191,15 @@ namespace MEDCoupling friend class MEDFileTemplateFieldMultiTSWithoutSDA; public: MEDLOADER_EXPORT MEDFileInt64FieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const override { return new MEDFileInt64FieldMultiTSWithoutSDA(*this); } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileInt64FieldMultiTSWithoutSDA(*this); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64FieldMultiTSWithoutSDA"); } MEDLOADER_EXPORT MCAuto createNewWithSDA() const override; protected: MEDFileInt64FieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } MEDFileInt64FieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } - med_field_type getMEDFileFieldType() const override { return MED_INT64; } + med_field_type getMEDFileFieldType() const { return MED_INT64; } public: - MEDLOADER_EXPORT MEDFileInt64FieldMultiTSWithoutSDA() = default; + MEDLOADER_EXPORT MEDFileInt64FieldMultiTSWithoutSDA() { } }; class MEDFileFloatFieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA @@ -220,15 +207,15 @@ namespace MEDCoupling friend class MEDFileTemplateFieldMultiTSWithoutSDA; public: MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const override { return new MEDFileFloatFieldMultiTSWithoutSDA(*this); } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileFloatFieldMultiTSWithoutSDA(*this); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFloatFieldMultiTSWithoutSDA"); } MEDLOADER_EXPORT MCAuto createNewWithSDA() const override; protected: MEDFileFloatFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } MEDFileFloatFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } - med_field_type getMEDFileFieldType() const override { return MED_FLOAT32; } + med_field_type getMEDFileFieldType() const { return MED_FLOAT32; } public: - MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA() = default; + MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA() { } }; class MEDFileAnyTypeFieldMultiTSIterator; @@ -241,7 +228,7 @@ namespace MEDCoupling protected: MEDFileAnyTypeFieldMultiTS(); MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); - MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr); + MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid); static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms); @@ -257,9 +244,9 @@ namespace MEDCoupling MEDLOADER_EXPORT void loadArraysIfNecessary(); MEDLOADER_EXPORT void unloadArrays(); MEDLOADER_EXPORT void unloadArraysWithoutDataLoss(); - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *deepCopy() const; MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitComponents() const; MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitDiscretizations() const; @@ -311,12 +298,12 @@ namespace MEDCoupling MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const = 0; MEDLOADER_EXPORT static MCAuto Aggregate(const std::vector& fmtss, const std::vector< std::vector< std::pair > >& dts); public: - MEDLOADER_EXPORT std::vector getPflsReallyUsed() const override; - MEDLOADER_EXPORT std::vector getLocsReallyUsed() const override; - MEDLOADER_EXPORT std::vector getPflsReallyUsedMulti() const override; - MEDLOADER_EXPORT std::vector getLocsReallyUsedMulti() const override; - MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) override; - MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) override; + MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; + MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; + MEDLOADER_EXPORT std::vector getPflsReallyUsedMulti() const; + MEDLOADER_EXPORT std::vector getLocsReallyUsedMulti() const; + MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); + MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); protected: MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase(); const MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase() const; @@ -339,7 +326,7 @@ namespace MEDCoupling MEDLOADER_EXPORT static typename MLFieldTraits::FMTSType *New(const typename MLFieldTraits::FMTSWSDAType& other, bool shallowCopyOfContent); MEDLOADER_EXPORT static typename MLFieldTraits::FMTSType *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair >& entities, bool loadAll=true); MEDLOADER_EXPORT typename MLFieldTraits::FMTSType *extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const; - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const override { return this->extractPartImpl(extractDef,mm); } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); } // MEDLOADER_EXPORT typename Traits::FieldType *field(int iteration, int order, const MEDFileMesh *mesh) const; MEDLOADER_EXPORT typename Traits::FieldType *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; @@ -353,21 +340,21 @@ namespace MEDCoupling MEDLOADER_EXPORT void appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); // - MEDLOADER_EXPORT typename MLFieldTraits::F1TSType *getTimeStepAtPos(int pos) const override; + MEDLOADER_EXPORT typename MLFieldTraits::F1TSType *getTimeStepAtPos(int pos) const; MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArray(int iteration, int order) const; MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT typename MLFieldTraits::FMTSType *buildNewEmptyImpl() const; - MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const override; + MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const; protected: const typename MLFieldTraits::FMTSWSDAType *contentNotNull() const; typename MLFieldTraits::FMTSWSDAType *contentNotNull(); void appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller); protected: - ~MEDFileTemplateFieldMultiTS() override = default; + ~MEDFileTemplateFieldMultiTS() { } MEDFileTemplateFieldMultiTS(); MEDFileTemplateFieldMultiTS(const typename MLFieldTraits::FMTSWSDAType& other, bool shallowCopyOfContent); MEDFileTemplateFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); - MEDFileTemplateFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr); + MEDFileTemplateFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); }; class MEDFileIntFieldMultiTS; @@ -379,19 +366,19 @@ namespace MEDCoupling { friend class MEDFileTemplateFieldMultiTS; public: - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const override; + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const; MEDLOADER_EXPORT MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const; MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFieldMultiTS"); } // MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; - MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const override { return buildNewEmptyImpl(); } + MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); } public: private: - ~MEDFileFieldMultiTS() override = default; + ~MEDFileFieldMultiTS() { } MEDFileFieldMultiTS() { } MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); - MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr); + MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); }; template @@ -400,7 +387,7 @@ namespace MEDCoupling public: MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; protected: - ~MEDFileNDTemplateFieldMultiTS() override = default; + ~MEDFileNDTemplateFieldMultiTS() { } MEDFileNDTemplateFieldMultiTS() { } MEDFileNDTemplateFieldMultiTS(const typename MLFieldTraits::FMTSWSDAType& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS(other,shallowCopyOfContent) { } MEDFileNDTemplateFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateFieldMultiTS(fid,loadAll,ms) { } @@ -414,15 +401,15 @@ namespace MEDCoupling { friend class MEDFileTemplateFieldMultiTS; public: - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const override { return new MEDFileInt32FieldMultiTS(*this); } - MEDLOADER_EXPORT MEDFileInt32FieldMultiTS *buildNewEmpty() const override { return buildNewEmptyImpl(); } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileInt32FieldMultiTS(*this); } + MEDLOADER_EXPORT MEDFileInt32FieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32FieldMultiTS"); } private: - ~MEDFileInt32FieldMultiTS() override = default; + ~MEDFileInt32FieldMultiTS() { } MEDFileInt32FieldMultiTS() { } MEDFileInt32FieldMultiTS(const MEDFileInt32FieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS(other,shallowCopyOfContent) { } MEDFileInt32FieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS(fid,loadAll,ms) { } - MEDFileInt32FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } + MEDFileInt32FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } }; /*! @@ -432,15 +419,15 @@ namespace MEDCoupling { friend class MEDFileTemplateFieldMultiTS; public: - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const override { return new MEDFileInt64FieldMultiTS(*this); } - MEDLOADER_EXPORT MEDFileInt64FieldMultiTS *buildNewEmpty() const override { return buildNewEmptyImpl(); } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileInt64FieldMultiTS(*this); } + MEDLOADER_EXPORT MEDFileInt64FieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64FieldMultiTS"); } private: - ~MEDFileInt64FieldMultiTS() override = default; + ~MEDFileInt64FieldMultiTS() { } MEDFileInt64FieldMultiTS() { } MEDFileInt64FieldMultiTS(const MEDFileInt64FieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS(other,shallowCopyOfContent) { } MEDFileInt64FieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS(fid,loadAll,ms) { } - MEDFileInt64FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } + MEDFileInt64FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } }; /*! @@ -450,15 +437,15 @@ namespace MEDCoupling { friend class MEDFileTemplateFieldMultiTS; public: - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const override { return new MEDFileFloatFieldMultiTS(*this); } - MEDLOADER_EXPORT MEDFileFloatFieldMultiTS *buildNewEmpty() const override { return buildNewEmptyImpl(); } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileFloatFieldMultiTS(*this); } + MEDLOADER_EXPORT MEDFileFloatFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFloatFieldMultiTS"); } private: - ~MEDFileFloatFieldMultiTS() override = default; + ~MEDFileFloatFieldMultiTS() { } MEDFileFloatFieldMultiTS() { } MEDFileFloatFieldMultiTS(const MEDFileFloatFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS(other,shallowCopyOfContent) { } MEDFileFloatFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS(fid,loadAll,ms) { } - MEDFileFloatFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=nullptr):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } + MEDFileFloatFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } }; class MEDFileAnyTypeFieldMultiTSIterator diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index f310a75d4..038ee1954 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -19,32 +19,11 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDFileFieldOverView.hxx" -#include "MCType.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCIdType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingPartDefinition.hxx" -#include "MEDCoupling1GTUMesh.hxx" -#include "MEDCouplingPointSet.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingStructuredMesh.hxx" #include "MEDFileField.hxx" -#include "MEDFileFieldInternal.hxx" #include "MEDFileMesh.hxx" #include "MEDCouplingFieldDiscretization.hxx" #include "CellModel.hxx" -#include -#include -#include -#include "NormalizedGeometricTypes" -#include -#include -#include -#include -#include -#include -#include using namespace MEDCoupling; @@ -62,8 +41,8 @@ MEDFileMeshStruct *MEDFileMeshStruct::New(const MEDFileMesh *mesh) std::size_t MEDFileMeshStruct::getHeapMemorySizeWithoutChildren() const { std::size_t ret(0); - for(const auto & it0 : _geo_types_distrib) - ret+=it0.capacity()*sizeof(int); + for(std::vector< std::vector >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++) + ret+=(*it0).capacity()*sizeof(int); ret+=_geo_types_distrib.capacity()*sizeof(std::vector); return ret; } @@ -81,20 +60,20 @@ MEDFileMeshStruct::MEDFileMeshStruct(const MEDFileMesh *mesh):_mesh(mesh) if(!levs.empty()) { _geo_types_distrib.resize(-(*std::min_element(levs.begin(),levs.end()))+1); - for(int const lev : levs) - _geo_types_distrib[-lev]=mesh->getDistributionOfTypes(lev); + for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) + _geo_types_distrib[-(*lev)]=mesh->getDistributionOfTypes(*lev); } } int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const { int j=0; - for(auto it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--) + for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--) { - std::size_t const sz=(*it1).size(); + std::size_t sz=(*it1).size(); if(sz%3!=0) throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getLevelOfGeoType : internal error in code !"); - std::size_t const nbGeo=sz/3; + std::size_t nbGeo=sz/3; for(std::size_t i=0;i >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) { - std::size_t const sz=it1.size(); + std::size_t sz=(*it1).size(); if(sz%3!=0) throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getNumberOfElemsOfGeoType : internal error in code !"); - std::size_t const nbGeo=sz/3; + std::size_t nbGeo=sz/3; for(std::size_t i=0;i >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) { - std::size_t const sz=it1.size(); + std::size_t sz=(*it1).size(); if(sz%3!=0) throw INTERP_KERNEL::Exception("MEDFileMeshStruct::doesManageGeoType : internal error in code !"); - std::size_t const nbGeo=sz/3; + std::size_t nbGeo=sz/3; for(std::size_t i=0;i arr(3); arr[0]=(mcIdType)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1; @@ -163,10 +142,10 @@ int MEDFileMeshStruct::getNumberOfLevs() const int MEDFileMeshStruct::getNumberOfGeoTypesInLev(int relativeLev) const { - int const pos(-relativeLev); + int pos(-relativeLev); if(pos<0 || pos>=(int)_geo_types_distrib.size()) throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getNumberOfGeoTypesInLev : invalid level specified !"); - std::size_t const sz=_geo_types_distrib[pos].size(); + std::size_t sz=_geo_types_distrib[pos].size(); if(sz%3!=0) throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getNumberOfGeoTypesInLev : internal error in code !"); return (int)(sz/3); @@ -188,13 +167,13 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector(m)); + const MEDFileUMesh *um(dynamic_cast(m)); if(um) return MEDUMeshMultiLev::New(um,levs); - const auto *cm(dynamic_cast(m)); + const MEDFileCMesh *cm(dynamic_cast(m)); if(cm) return MEDCMeshMultiLev::New(cm,levs); - const auto *clm(dynamic_cast(m)); + const MEDFileCurveLinearMesh *clm(dynamic_cast(m)); if(clm) return MEDCurveLinearMeshMultiLev::New(clm,levs); throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !"); @@ -204,13 +183,13 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector(m)); + const MEDFileUMesh *um(dynamic_cast(m)); if(um) return MEDUMeshMultiLev::New(um,gts,pfls,nbEntities); - const auto *cm(dynamic_cast(m)); + const MEDFileCMesh *cm(dynamic_cast(m)); if(cm) return MEDCMeshMultiLev::New(cm,gts,pfls,nbEntities); - const auto *clm(dynamic_cast(m)); + const MEDFileCurveLinearMesh *clm(dynamic_cast(m)); if(clm) return MEDCurveLinearMeshMultiLev::New(clm,gts,pfls,nbEntities); throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !"); @@ -239,14 +218,14 @@ void MEDMeshMultiLev::setCellReduction(const DataArrayIdType *cr) cr->incrRef(); } -bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal * /*globs*/) const +bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const { if(fst.getType()==ON_NODES) { if(fst.getNumberOfItems()!=1) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::isFastlyTheSameStruct : unexpected situation for nodes !"); const MEDFileField1TSStructItem2& p(fst[0]); - std::string const pflName(p.getPflName()); + std::string pflName(p.getPflName()); const DataArrayIdType *nr(_node_reduction); if(pflName.empty() && !nr) return true; @@ -258,7 +237,7 @@ bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst } else { - std::size_t const sz(fst.getNumberOfItems()); + std::size_t sz(fst.getNumberOfItems()); if(sz!=_geo_types.size()) return false; mcIdType strt(0); @@ -289,8 +268,8 @@ void MEDMeshMultiLev::retrieveFamilyIdsOnCells(DataArrayIdType *& famIds, bool& { const DataArrayIdType *fids(_cell_fam_ids); if(!fids) - { famIds=nullptr; isWithoutCopy=true; return ; } - std::size_t const sz(_geo_types.size()); + { famIds=0; isWithoutCopy=true; return ; } + std::size_t sz(_geo_types.size()); bool presenceOfPfls(false); for(std::size_t i=0;i tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1)); @@ -332,8 +311,8 @@ void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& { const DataArrayIdType *nids(_cell_num_ids); if(!nids) - { numIds=nullptr; isWithoutCopy=true; return ; } - std::size_t const sz(_geo_types.size()); + { numIds=0; isWithoutCopy=true; return ; } + std::size_t sz(_geo_types.size()); bool presenceOfPfls(false); for(std::size_t i=0;i tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1)); @@ -375,7 +354,7 @@ void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& { const DataArrayIdType *fids(_node_fam_ids); if(!fids) - { famIds=nullptr; isWithoutCopy=true; return ; } + { famIds=0; isWithoutCopy=true; return ; } const DataArrayIdType *nr(_node_reduction); if(nr) { @@ -397,7 +376,7 @@ void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& { const DataArrayIdType *fids(_node_num_ids); if(!fids) - { numIds=nullptr; isWithoutCopy=true; return ; } + { numIds=0; isWithoutCopy=true; return ; } const DataArrayIdType *nr(_node_reduction); if(nr) { @@ -417,7 +396,7 @@ void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& */ DataArrayIdType *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const { - const auto *umesh(dynamic_cast(_mesh)); + const MEDFileUMesh *umesh(dynamic_cast(_mesh)); if(!umesh) return nullptr; const PartDefinition *pd(umesh->getPartDefAtLevel(1)); @@ -475,7 +454,7 @@ void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayIdType *numIds) std::string MEDMeshMultiLev::getPflNameOfId(int id) const { - std::size_t const sz(_pfls.size()); + std::size_t sz(_pfls.size()); if(id<0 || id>=(int)sz) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getPflNameOfId : invalid input id !"); const DataArrayIdType *pfl(_pfls[id]); @@ -490,7 +469,7 @@ std::string MEDMeshMultiLev::getPflNameOfId(int id) const */ mcIdType MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const { - std::size_t const sz(_nb_entities.size()); + std::size_t sz(_nb_entities.size()); for(std::size_t i=0;ideepCopy(); @@ -541,16 +520,16 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& } else { - std::size_t const sz(fst.getNumberOfItems()); - std::set const s(_geo_types.begin(),_geo_types.end()); + std::size_t sz(fst.getNumberOfItems()); + std::set s(_geo_types.begin(),_geo_types.end()); if(s.size()!=_geo_types.size()) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 2 !"); std::vector< const DataArray *> arr(s.size()); std::vector< MCAuto > arrSafe(s.size()); int iii(0); - mcIdType const nc(ToIdType(vals->getNumberOfComponents())); - std::vector const compInfo(vals->getInfoOnComponents()); - for(auto it=_geo_types.begin();it!=_geo_types.end();it++,iii++) + mcIdType nc(ToIdType(vals->getNumberOfComponents())); + std::vector compInfo(vals->getInfoOnComponents()); + for(std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator it=_geo_types.begin();it!=_geo_types.end();it++,iii++) { const DataArrayIdType *thisP(_pfls[iii]); std::vector ps; @@ -564,7 +543,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 1 !"); if(ps.size()==1) { - int const nbi(ps[0]->getNbOfIntegrationPts(globs)); + int nbi(ps[0]->getNbOfIntegrationPts(globs)); const DataArrayIdType *otherP(ps[0]->getPfl(globs)); const std::pair& strtStop(ps[0]->getStartStop()); MCAuto ret(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); @@ -606,7 +585,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& int jj(0); for(std::vector::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++) { - int const nbi((*it2)->getNbOfIntegrationPts(globs)); + int nbi((*it2)->getNbOfIntegrationPts(globs)); const DataArrayIdType *otherPfl((*it2)->getPfl(globs)); const std::pair& strtStop((*it2)->getStartStop()); MCAuto ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); @@ -654,8 +633,8 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& */ void MEDMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) { - mcIdType const nbOfVertices(verticesToAdd->getNumberOfTuples()); - std::size_t const sz(_pfls.size()); + mcIdType nbOfVertices(verticesToAdd->getNumberOfTuples()); + std::size_t sz(_pfls.size()); _pfls.resize(sz+1); _geo_types.resize(sz+1,INTERP_KERNEL::NORM_POINT1); _nb_entities.resize(sz+1,nbOfVertices); @@ -698,7 +677,7 @@ MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh):_mesh(mesh),_nb_nodes( MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes) { - std::size_t const sz(_geo_types.size()); + std::size_t sz(_geo_types.size()); if(sz!=pfls.size() || sz!=nbEntities.size()) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::MEDMeshMultiLev : input vector must have the same size !"); _pfls.resize(sz); @@ -710,8 +689,9 @@ MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, cons } } -MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other) -= default; +MEDMeshMultiLev::MEDMeshMultiLev(const MEDMeshMultiLev& other):RefCountObject(other),_mesh(other._mesh),_pfls(other._pfls),_geo_types(other._geo_types),_nb_entities(other._nb_entities),_node_reduction(other._node_reduction),_nb_nodes(other._nb_nodes),_cell_fam_ids(other._cell_fam_ids),_cell_num_ids(other._cell_num_ids),_node_fam_ids(other._node_fam_ids),_node_num_ids(other._node_num_ids) +{ +} //= @@ -725,12 +705,12 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector if(!m) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev constructor : null input pointer !"); std::vector v; - for(int const lev : levs) + for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { - std::vector vTmp(m->getDirectUndergroundSingleGeoTypeMeshes(lev)); + std::vector vTmp(m->getDirectUndergroundSingleGeoTypeMeshes(*it)); v.insert(v.end(),vTmp.begin(),vTmp.end()); } - std::size_t const sz(v.size()); + std::size_t sz(v.size()); if(v.empty()) { _coords=m->getCoords(); _coords->incrRef(); @@ -751,7 +731,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector _nb_entities[i]=obj->getNumberOfCells(); } // ids fields management - bool const cellFamIdsNoCpy(levs.size()==1); + bool cellFamIdsNoCpy(levs.size()==1); if(cellFamIdsNoCpy) { const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(levs[0])); @@ -774,7 +754,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector if(f && !tmps.empty()) _cell_fam_ids=DataArrayIdType::Aggregate(tmps); } - bool const cellNumIdsNoCpy(levs.size()==1); + bool cellNumIdsNoCpy(levs.size()==1); if(cellNumIdsNoCpy) { const DataArrayIdType *tmp(m->getNumberFieldAtLevel(levs[0])); @@ -823,10 +803,10 @@ MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) { - std::size_t const sz(gts.size()); + std::size_t sz(gts.size()); if(sz<1) throw INTERP_KERNEL::Exception("constructor of MEDUMeshMultiLev : number of different geo type must be >= 1 !"); - unsigned const dim(INTERP_KERNEL::CellModel::GetCellModel(gts[0]).getDimension()); + unsigned dim(INTERP_KERNEL::CellModel::GetCellModel(gts[0]).getDimension()); _parts.resize(sz); bool isSameDim(true),isNoPfl(true); for(std::size_t i=0;igetMeshDimension()); + int lev((int)dim-m->getMeshDimension()); if(isSameDim && isNoPfl && m->getGeoTypesAtLevel(lev)==gts)//optimized part { const DataArrayIdType *famIds(m->getFamilyFieldAtLevel(lev)); @@ -896,7 +876,7 @@ void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNodes) { if(!pflNodes || !pflNodes->isAllocated()) return ; - std::size_t const sz(_parts.size()); + std::size_t sz(_parts.size()); std::vector< MCAuto > a(sz); std::vector< const DataArrayIdType *> aa(sz); for(std::size_t i=0;i m(_parts[i]); if(pfl) m=dynamic_cast(_parts[i]->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); - DataArrayIdType *cellIds=nullptr; + DataArrayIdType *cellIds=0; m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); - MCAuto const cellIdsSafe(cellIds); + MCAuto cellIdsSafe(cellIds); MCAuto m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); mcIdType tmp=-1; MCAuto o2n(m2->getNodeIdsInUse(tmp)); @@ -939,8 +919,9 @@ MEDMeshMultiLev *MEDUMeshMultiLev::prepare() const return new MEDUMeshMultiLev(*this); } -MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDUMeshMultiLev& other) -= default; +MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDUMeshMultiLev& other):MEDMeshMultiLev(other),_parts(other._parts),_coords(other._coords) +{ +} MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto& part):MEDMeshMultiLev(other) { @@ -948,7 +929,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const _parts[0]=part; _geo_types.resize(1); _geo_types[0]=part->getCellModelEnum(); _nb_entities.resize(1); _nb_entities[0]=part->getNumberOfCells(); - _pfls.resize(1); _pfls[0]=nullptr; + _pfls.resize(1); _pfls[0]=0; } /*! @@ -958,7 +939,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const */ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const { - const DataArrayDouble *tmp(nullptr); + const DataArrayDouble *tmp(0); if(_parts.empty()) tmp=_coords; else @@ -969,7 +950,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * mcIdType szBCE(0),szD(0),szF(0); bool isPolyh(false); int iii(0); - for(auto it=_parts.begin();it!=_parts.end();it++,iii++) + for(std::vector< MCAuto >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) { const MEDCoupling1GTUMesh *cur(*it); if(!cur) @@ -982,7 +963,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * else { cur2=dynamic_cast(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; } // - mcIdType const curNbCells(cur->getNumberOfCells()); + mcIdType curNbCells(cur->getNumberOfCells()); szBCE+=curNbCells; if((*it)->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) szD+=cur->getNodalConnectivity()->getNumberOfTuples()+curNbCells; @@ -997,12 +978,12 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * MCAuto b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer()); MCAuto c(DataArrayIdType::New()); c->alloc(szBCE,1); mcIdType *cPtr(c->getPointer()); MCAuto d(DataArrayIdType::New()); d->alloc(szD,1); mcIdType *dPtr(d->getPointer()); - MCAuto e(DataArrayIdType::New()),f(DataArrayIdType::New()); mcIdType *ePtr(nullptr),*fPtr(nullptr); + MCAuto e(DataArrayIdType::New()),f(DataArrayIdType::New()); mcIdType *ePtr(0),*fPtr(0); if(isPolyh) { e->alloc(szBCE,1); ePtr=e->getPointer(); f->alloc(szF,1); fPtr=f->getPointer(); } mcIdType k(0); iii=0; - for(auto it=_parts.begin();it!=_parts.end();it++,iii++) + for(std::vector< MCAuto >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) { const MEDCoupling1GTUMesh *cur(*it); // @@ -1013,16 +994,16 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * else { cur2=dynamic_cast(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; } // - mcIdType const curNbCells(cur->getNumberOfCells()); - int const gt((int)cur->getCellModelEnum()); + mcIdType curNbCells(cur->getNumberOfCells()); + int gt((int)cur->getCellModelEnum()); if(gt<0 || gt>=PARAMEDMEM_2_VTKTYPE_LGTH) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : invalid geometric type !"); - unsigned char const gtvtk(PARAMEDMEM_2_VTKTYPE[gt]); + unsigned char gtvtk(PARAMEDMEM_2_VTKTYPE[gt]); if(gtvtk==255) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : no VTK type for the requested INTERP_KERNEL geometric type !"); std::fill(bPtr,bPtr+curNbCells,gtvtk); bPtr+=curNbCells; - const auto *scur(dynamic_cast(cur)); - const auto *dcur(dynamic_cast(cur)); + const MEDCoupling1SGTUMesh *scur(dynamic_cast(cur)); + const MEDCoupling1DGTUMesh *dcur(dynamic_cast(cur)); const mcIdType *connPtr(cur->getNodalConnectivity()->begin()); if(!scur && !dcur) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : internal error !"); @@ -1030,7 +1011,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * { if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA27) { - mcIdType const nnpc(scur->getNumberOfNodesPerCell()); + mcIdType nnpc(scur->getNumberOfNodesPerCell()); for(mcIdType i=0;igetNumberOfComponents()!=3) a=a->changeNbOfComponents(3,0.); coords=a.retn(); types=b.retn(); cellLocations=c.retn(); cells=d.retn(); if(!isPolyh) - { faceLocations=nullptr; faces=nullptr; } + { faceLocations=0; faces=0; } else { faceLocations=e.retn(); faces=f.retn(); } return _mesh->isObjectInTheProgeny(coords); @@ -1123,12 +1104,12 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end())); return ; } - mcIdType const sz(coords->getNumberOfTuples()); + mcIdType sz(coords->getNumberOfTuples()); std::vector b(sz,false); const mcIdType *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end()); while(work!=endW) { - mcIdType const nb(*work++); + mcIdType nb(*work++); for(mcIdType i=0;i=0 && *work& coords, work=polyhedNodalConnVTK->begin(); endW=polyhedNodalConnVTK->end(); while(work!=endW) { - mcIdType const nb(*work++); + mcIdType nb(*work++); for(mcIdType i=0;i=0 && *work& coords, } } } - std::size_t const szExp(std::count(b.begin(),b.end(),true)); + std::size_t szExp(std::count(b.begin(),b.end(),true)); if(ToIdType(szExp)!=nr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::reorderNodesIfNecessary : internal error #3 !"); // Go renumbering ! @@ -1172,7 +1153,7 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, mcIdType *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples()); while(work2!=endW2) { - mcIdType const nb(*work2++); + mcIdType nb(*work2++); for(mcIdType i=0;i& coords, work2=polyhedNodalConnVTK->getPointer(); endW2=polyhedNodalConnVTK->getPointer()+polyhedNodalConnVTK->getNumberOfTuples(); while(work2!=endW2) { - mcIdType const nb(*work2++); + mcIdType nb(*work2++); for(mcIdType i=0;i& coords, void MEDUMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) { - mcIdType const nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1 + mcIdType nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1 MEDMeshMultiLev::appendVertices(verticesToAdd,nr); MCAuto elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1)); elt->allocateCells(nbOfCells); @@ -1214,7 +1195,7 @@ void MEDUMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, Data //= -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& /*lev*/):MEDMeshMultiLev(m),_is_internal(true) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev):MEDMeshMultiLev(m),_is_internal(true) { initStdFieldOfIntegers(m); } @@ -1231,7 +1212,7 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMult void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMesh *m) { // ids fields management - const DataArrayIdType *tmp(nullptr); + const DataArrayIdType *tmp(0); tmp=m->getFamilyFieldAtLevel(0); if(tmp) { @@ -1245,7 +1226,7 @@ void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMe _cell_num_ids=const_cast(tmp); } // - tmp=nullptr; + tmp=0; tmp=m->getFamilyFieldAtLevel(1); if(tmp) { @@ -1275,27 +1256,27 @@ void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMe void MEDStructuredMeshMultiLev::moveFaceToCell() const { - const_cast(this)->_cell_fam_ids=_face_fam_ids; const_cast(this)->_face_fam_ids=nullptr; - const_cast(this)->_cell_num_ids=_face_num_ids; const_cast(this)->_face_num_ids=nullptr; + const_cast(this)->_cell_fam_ids=_face_fam_ids; const_cast(this)->_face_fam_ids=0; + const_cast(this)->_cell_num_ids=_face_num_ids; const_cast(this)->_face_num_ids=0; } bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMultiLev *&ret) const { - ret=nullptr; + ret=0; if(_geo_types.empty()) return false; if(_geo_types.size()!=1) throw INTERP_KERNEL::Exception("MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase only one geo types supported at most supported for the moment !"); - INTERP_KERNEL::NormalizedCellType const gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(_mesh->getMeshDimension())); + INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(_mesh->getMeshDimension())); if(_geo_types[0]==gt) return false; MEDCoupling1GTUMesh *facesIfPresent((static_cast(_mesh))->getImplicitFaceMesh()); if(!facesIfPresent) return false; - const DataArrayIdType *pfl(nullptr),*nr(_node_reduction); + const DataArrayIdType *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; - MCAuto const facesIfPresent2(facesIfPresent); facesIfPresent->incrRef(); + MCAuto facesIfPresent2(facesIfPresent); facesIfPresent->incrRef(); moveFaceToCell(); MCAuto ret2(new MEDUMeshMultiLev(*this,facesIfPresent2)); if(pfl) @@ -1308,7 +1289,7 @@ bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMu void MEDStructuredMeshMultiLev::dealWithImplicitUnstructuredMesh(const MEDFileMesh *m) { - const DataArrayIdType *tmp(nullptr); + const DataArrayIdType *tmp(0); tmp=m->getFamilyFieldAtLevel(-1); if(tmp) { @@ -1336,9 +1317,9 @@ void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNode { m=dynamic_cast(m->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); } - DataArrayIdType *cellIds=nullptr; + DataArrayIdType *cellIds=0; m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); - MCAuto const cellIdsSafe(cellIds); + MCAuto cellIdsSafe(cellIds); MCAuto m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); mcIdType tmp=-1; _node_reduction=m2->getNodeIdsInUse(tmp); @@ -1366,11 +1347,11 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : null input pointer !"); if(levs.size()!=1 || levs[0]!=0) throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : levels supported is 0 only !"); - int const sdim(m->getSpaceDimension()); + int sdim(m->getSpaceDimension()); _coords.resize(sdim); for(int i=0;i(m->getMesh()->getCoordsAt(i))); + DataArrayDouble *elt(const_cast(m->getMesh()->getCoordsAt(i))); if(!elt) throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !"); elt->incrRef(); @@ -1384,14 +1365,14 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vectorgetMeshDimension()); - INTERP_KERNEL::NormalizedCellType const gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(mdim)); + int mdim(m->getMeshDimension()); + INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(mdim)); if(gt==gts[0]) { _coords.resize(mdim); for(int i=0;i(m->getMesh()->getCoordsAt(i))); + DataArrayDouble *elt(const_cast(m->getMesh()->getCoordsAt(i))); if(!elt) throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !"); _coords[i]=elt; _coords[i]->incrRef(); @@ -1401,8 +1382,9 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector MEDCMeshMultiLev::getNodeGridStructure() const { @@ -1414,10 +1396,10 @@ std::vector MEDCMeshMultiLev::getNodeGridStructure() const MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const { - MEDMeshMultiLev *retSpecific(nullptr); + MEDMeshMultiLev *retSpecific(0); if(prepareForImplicitUnstructuredMeshCase(retSpecific)) return retSpecific; - const DataArrayIdType *pfl(nullptr),*nr(_node_reduction); + const DataArrayIdType *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; MCAuto nnr; @@ -1435,7 +1417,7 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const if(nr) { nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret->_nb_entities[0]=pfl->getNumberOfTuples(); - ret->_pfls[0]=nullptr; + ret->_pfls[0]=0; std::vector< MCAuto > coords(_coords.size()); for(std::size_t i=0;i<_coords.size();i++) coords[i]=_coords[i]->selectByTupleIdSafeSlice(cellParts[i].first,cellParts[i].second+1,1); @@ -1483,7 +1465,7 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const std::vector< DataArrayDouble * > MEDCMeshMultiLev::buildVTUArrays(bool& isInternal) const { isInternal=_is_internal; - std::size_t const sz(_coords.size()); + std::size_t sz(_coords.size()); std::vector< DataArrayDouble * > ret(sz); for(std::size_t i=0;i(m->getMesh()->getCoords())); + DataArrayDouble *coords(const_cast(m->getMesh()->getCoords())); if(!coords) throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : no coords set !"); coords->incrRef(); @@ -1525,10 +1507,10 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearM throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !"); if(gts.size()!=1 || pfls.size()!=1) throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : lengths of gts and pfls must be equal to one !"); - INTERP_KERNEL::NormalizedCellType const gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension())); + INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension())); if(gt==gts[0]) { - auto *coords(const_cast(m->getMesh()->getCoords())); + DataArrayDouble *coords(const_cast(m->getMesh()->getCoords())); if(!coords) throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : no coords set !"); coords->incrRef(); @@ -1539,8 +1521,9 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearM dealWithImplicitUnstructuredMesh(m); } -MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other) -= default; +MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other):MEDStructuredMeshMultiLev(other),_coords(other._coords),_structure(other._structure) +{ +} std::vector MEDCurveLinearMeshMultiLev::getNodeGridStructure() const { @@ -1549,10 +1532,10 @@ std::vector MEDCurveLinearMeshMultiLev::getNodeGridStructure() const MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const { - MEDMeshMultiLev *retSpecific(nullptr); + MEDMeshMultiLev *retSpecific(0); if(prepareForImplicitUnstructuredMeshCase(retSpecific)) return retSpecific; - const DataArrayIdType *pfl(nullptr),*nr(_node_reduction); + const DataArrayIdType *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; MCAuto nnr; @@ -1578,7 +1561,7 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const if(nr) { nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret->_nb_entities[0]=pfl->getNumberOfTuples(); - ret->_pfls[0]=nullptr; + ret->_pfls[0]=0; ret->_coords=_coords->selectByTupleIdSafe(p->begin(),p->end()); ret->_structure=st; ret2=(MEDCurveLinearMeshMultiLev *)ret; ret2->incrRef(); @@ -1629,7 +1612,8 @@ void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::v //= MEDFileField1TSStructItem2::MEDFileField1TSStructItem2() -= default; +{ +} MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair& b, const std::string& c, const std::string& d):_geo_type(a),_start_end(b),_pfl(DataArrayIdType::New()),_loc(d),_nb_of_entity(-1) { @@ -1640,16 +1624,16 @@ void MEDFileField1TSStructItem2::checkWithMeshStructForCells(const MEDFileMeshSt { if(!mst->doesManageGeoType(_geo_type)) { - auto *mstUnConstCasted(const_cast(mst)); + MEDFileMeshStruct *mstUnConstCasted(const_cast(mst)); mstUnConstCasted->appendIfImplicitType(_geo_type); } - mcIdType const nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); + mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); checkInRange(nbOfEnt,1,globs); } void MEDFileField1TSStructItem2::checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) { - mcIdType const nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); + mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type); checkInRange(nbOfEnt,(int)cm.getNumberOfNodes(),globs); } @@ -1661,7 +1645,7 @@ void MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT(const MEDFileMesh if(_loc.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT : no localization specified !"); const MEDFileFieldLoc& loc=globs->getLocalization(_loc.c_str()); - mcIdType const nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); + mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); checkInRange(nbOfEnt,loc.getNumberOfGaussPoints(),globs); } @@ -1691,7 +1675,7 @@ const DataArrayIdType *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlob if(!_pfl->isAllocated()) { if(_pfl->getName().empty()) - return nullptr; + return 0; else return globs->getProfile(_pfl->getName().c_str()); } @@ -1770,9 +1754,9 @@ MEDFileField1TSStructItem2 MEDFileField1TSStructItem2::BuildAggregationOf(const throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : empty input !"); if(objs.size()==1) return MEDFileField1TSStructItem2(*objs[0]); - INTERP_KERNEL::NormalizedCellType const gt(objs[0]->_geo_type); - mcIdType const nbEntityRef(objs[0]->_nb_of_entity); - std::size_t const sz(objs.size()); + INTERP_KERNEL::NormalizedCellType gt(objs[0]->_geo_type); + mcIdType nbEntityRef(objs[0]->_nb_of_entity); + std::size_t sz(objs.size()); std::vector arrs(sz); for(std::size_t i=0;i arr(DataArrayIdType::Aggregate(arrs)); arr->sort(); - mcIdType const oldNbTuples(arr->getNumberOfTuples()); + mcIdType oldNbTuples(arr->getNumberOfTuples()); arr=arr->buildUnique(); if(oldNbTuples!=arr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : some entities are present several times !"); if(arr->isIota(nbEntityRef)) { - std::pair const p(0,nbEntityRef); + std::pair p(0,nbEntityRef); std::string a,b; MEDFileField1TSStructItem2 ret(gt,p,a,b); ret._nb_of_entity=nbEntityRef; @@ -1802,7 +1786,7 @@ MEDFileField1TSStructItem2 MEDFileField1TSStructItem2::BuildAggregationOf(const else { arr->setName(NEWLY_CREATED_PFL_NAME); - std::pair const p(0,oldNbTuples); + std::pair p(0,oldNbTuples); std::string a,b; MEDFileField1TSStructItem2 ret(gt,p,a,b); ret._nb_of_entity=nbEntityRef; @@ -1813,7 +1797,7 @@ MEDFileField1TSStructItem2 MEDFileField1TSStructItem2::BuildAggregationOf(const std::size_t MEDFileField1TSStructItem2::getHeapMemorySizeWithoutChildren() const { - std::size_t const ret(_loc.capacity()); + std::size_t ret(_loc.capacity()); return ret; } @@ -1836,7 +1820,7 @@ void MEDFileField1TSStructItem::checkWithMeshStruct(const MEDFileMeshStruct *mst { case ON_NODES: { - mcIdType const nbOfEnt=mst->getNumberOfNodes(); + mcIdType nbOfEnt=mst->getNumberOfNodes(); if(_items.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::checkWithMeshStruct : for nodes field only one subdivision supported !"); _items[0].checkInRange(nbOfEnt,1,globs); @@ -1844,20 +1828,20 @@ void MEDFileField1TSStructItem::checkWithMeshStruct(const MEDFileMeshStruct *mst } case ON_CELLS: { - for(auto & _item : _items) - _item.checkWithMeshStructForCells(mst,globs); + for(std::vector< MEDFileField1TSStructItem2 >::iterator it=_items.begin();it!=_items.end();it++) + (*it).checkWithMeshStructForCells(mst,globs); break; } case ON_GAUSS_NE: { - for(auto & _item : _items) - _item.checkWithMeshStructForGaussNE(mst,globs); + for(std::vector< MEDFileField1TSStructItem2 >::iterator it=_items.begin();it!=_items.end();it++) + (*it).checkWithMeshStructForGaussNE(mst,globs); break; } case ON_GAUSS_PT: { - for(auto & _item : _items) - _item.checkWithMeshStructForGaussPT(mst,globs); + for(std::vector< MEDFileField1TSStructItem2 >::iterator it=_items.begin();it!=_items.end();it++) + (*it).checkWithMeshStructForGaussPT(mst,globs); break; } default: @@ -1924,9 +1908,9 @@ MEDFileField1TSStructItem MEDFileField1TSStructItem::simplifyMeOnCellEntity(cons throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::simplifyMeOnCellEntity : must be on ON_CELLS, ON_GAUSS_NE or ON_GAUSS_PT !"); std::vector< std::pair< INTERP_KERNEL::NormalizedCellType, std::vector > > m; std::size_t i=0; - for(auto it=_items.begin();it!=_items.end();it++,i++) + for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++) { - auto const it0(std::find_if(m.begin(),m.end(),CmpGeo((*it).getGeo()))); + std::vector< std::pair< INTERP_KERNEL::NormalizedCellType, std::vector > >::iterator it0(std::find_if(m.begin(),m.end(),CmpGeo((*it).getGeo()))); if(it0==m.end()) m.push_back(std::pair< INTERP_KERNEL::NormalizedCellType, std::vector >((*it).getGeo(),std::vector(1,i))); else @@ -1938,7 +1922,7 @@ MEDFileField1TSStructItem MEDFileField1TSStructItem::simplifyMeOnCellEntity(cons ret._type=ON_CELLS; return ret; } - std::size_t const sz(m.size()); + std::size_t sz(m.size()); std::vector< MEDFileField1TSStructItem2 > items(sz); for(i=0;igetNumberOfNodes()); + mcIdType nbOfNodes(meshSt->getNumberOfNodes()); if(otherNodeIt.getPflName().empty()) {//on all nodes if(!ret0) @@ -2000,21 +1984,21 @@ bool MEDFileField1TSStructItem::isFullyOnOneLev(const MEDFileMeshStruct *meshSt, throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : works only for ON_CELLS discretization !"); if(_items.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : items vector is empty !"); - int const nbOfLevs(meshSt->getNumberOfLevs()); + int nbOfLevs(meshSt->getNumberOfLevs()); if(nbOfLevs==0) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : no levels in input mesh structure !"); std::vector levs(nbOfLevs); theFirstLevFull=1; std::set gts; - for(const auto & _item : _items) + for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++) { - if(!_item.getPflName().empty()) + if(!(*it).getPflName().empty()) return false; - INTERP_KERNEL::NormalizedCellType const gt(_item.getGeo()); + INTERP_KERNEL::NormalizedCellType gt((*it).getGeo()); if(gts.find(gt)!=gts.end()) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : internal error !"); gts.insert(gt); - int const pos(meshSt->getLevelOfGeoType(_item.getGeo())); + int pos(meshSt->getLevelOfGeoType((*it).getGeo())); levs[-pos]++; } for(int i=0;i MEDFileField1TSStructItem::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _item : _items) - ret.push_back(&_item); + for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++) + ret.push_back(&(*it)); return ret; } MEDMeshMultiLev *MEDFileField1TSStructItem::buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const { - std::size_t const sz(_items.size()); + std::size_t sz(_items.size()); std::vector a0(sz); std::vector a1(sz); std::vector a2(sz); std::size_t i(0); - for(auto it=_items.begin();it!=_items.end();it++,i++) + for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++) { a0[i]=(*it).getGeo(); a1[i]=(*it).getPfl(globs); @@ -2075,10 +2059,10 @@ std::vector MEDFileField1TSStructItem::getGeo else return ret; } - for(const auto & _item : _items) + for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++) { - INTERP_KERNEL::NormalizedCellType const elt(_item.getGeo()); - auto const it2(std::find(ret.begin(),ret.end(),elt)); + INTERP_KERNEL::NormalizedCellType elt((*it).getGeo()); + std::vector::iterator it2(std::find(ret.begin(),ret.end(),elt)); if(it2==ret.end()) ret.push_back(elt); } @@ -2093,15 +2077,15 @@ MEDFileField1TSStructItem MEDFileField1TSStructItem::BuildItemFrom(const MEDFile std::vector< std::vector > typesF; std::vector geoTypes; std::vector< std::vector > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs); - std::size_t const nbOfGeoTypes(geoTypes.size()); + std::size_t nbOfGeoTypes(geoTypes.size()); if(nbOfGeoTypes==0) throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref !"); if(typesF[0].empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : internal error #1 bis !"); - TypeOfField const atype(typesF[0][0]); + TypeOfField atype(typesF[0][0]); for(std::size_t i=0;i::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++) { - if(it==b) + if((*it)==b) return true; } return false; @@ -2163,10 +2147,10 @@ bool MEDFileField1TSStruct::isSupportSameAs(const MEDFileAnyTypeField1TS *other, { if(_already_checked.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isSupportSameAs : no ref !"); - MEDFileField1TSStructItem const b(MEDFileField1TSStructItem::BuildItemFrom(other,meshSt)); + MEDFileField1TSStructItem b(MEDFileField1TSStructItem::BuildItemFrom(other,meshSt)); if(!_already_checked[0].isEntityCell() || !b.isEntityCell()) throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isSupportSameAs : only available on cell entities !"); - MEDFileField1TSStructItem const other1(b.simplifyMeOnCellEntity(other)); + MEDFileField1TSStructItem other1(b.simplifyMeOnCellEntity(other)); int found=-1,i=0; for(std::vector::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++) if((*it).isComputed()) @@ -2174,7 +2158,7 @@ bool MEDFileField1TSStruct::isSupportSameAs(const MEDFileAnyTypeField1TS *other, bool ret(false); if(found==-1) { - MEDFileField1TSStructItem const this1(_already_checked[0].simplifyMeOnCellEntity(other)); + MEDFileField1TSStructItem this1(_already_checked[0].simplifyMeOnCellEntity(other)); ret=this1.isCellSupportEqual(other1,other); if(ret) _already_checked.push_back(this1); @@ -2193,7 +2177,7 @@ bool MEDFileField1TSStruct::isCompatibleWithNodesDiscr(const MEDFileAnyTypeField { if(_already_checked.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isCompatibleWithNodesDiscr : no ref !"); - MEDFileField1TSStructItem const other1(MEDFileField1TSStructItem::BuildItemFrom(other,meshSt)); + MEDFileField1TSStructItem other1(MEDFileField1TSStructItem::BuildItemFrom(other,meshSt)); if(_already_checked[0].isEntityCell()) { int found=-1,i=0; @@ -2203,7 +2187,7 @@ bool MEDFileField1TSStruct::isCompatibleWithNodesDiscr(const MEDFileAnyTypeField bool ret(false); if(found==-1) { - MEDFileField1TSStructItem const this1(_already_checked[0].simplifyMeOnCellEntity(other)); + MEDFileField1TSStructItem this1(_already_checked[0].simplifyMeOnCellEntity(other)); ret=this1.isCompatibleWithNodesDiscr(other1,meshSt,other); if(ret) _already_checked.push_back(this1); @@ -2220,15 +2204,15 @@ bool MEDFileField1TSStruct::isCompatibleWithNodesDiscr(const MEDFileAnyTypeField std::size_t MEDFileField1TSStruct::getHeapMemorySizeWithoutChildren() const { - std::size_t const ret(_already_checked.capacity()*sizeof(MEDFileField1TSStructItem)); + std::size_t ret(_already_checked.capacity()*sizeof(MEDFileField1TSStructItem)); return ret; } std::vector MEDFileField1TSStruct::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & it : _already_checked) - ret.push_back(&it); + for(std::vector::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++) + ret.push_back(&(*it)); return ret; } @@ -2275,16 +2259,16 @@ bool MEDFileField1TSStruct::isDataSetSupportFastlyEqualTo(const MEDFileField1TSS std::vector MEDFileField1TSStruct::getGeoTypes(const MEDFileMesh *m) const { std::vector ret; - for(const auto & it : _already_checked) + for(std::vector::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++) { - std::vector const ret2(it.getGeoTypes(m)); - for(auto it2 : ret2) + std::vector ret2((*it).getGeoTypes(m)); + for(std::vector::const_iterator it2=ret2.begin();it2!=ret2.end();it2++) { - if(it2==INTERP_KERNEL::NORM_ERROR) + if(*it2==INTERP_KERNEL::NORM_ERROR) continue; - auto const it3(std::find(ret.begin(),ret.end(),it2)); + std::vector::iterator it3(std::find(ret.begin(),ret.end(),*it2)); if(it3==ret.end()) - ret.push_back(it2); + ret.push_back(*it2); } } return ret; @@ -2299,12 +2283,12 @@ bool MEDFileField1TSStruct::presenceOfCellDiscr(int& pos) const std::size_t refSz(std::numeric_limits::max()); bool ret(false); int i(0); - for(auto it=_already_checked.begin();it!=_already_checked.end();it++,i++) + for(std::vector::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++) { if((*it).getType()!=ON_NODES) { ret=true; - std::size_t const sz((*it).getNumberOfItems()); + std::size_t sz((*it).getNumberOfItems()); if(refSz>sz) { pos=i; refSz=sz; } } @@ -2321,11 +2305,11 @@ bool MEDFileField1TSStruct::presenceOfCellDiscr(int& pos) const bool MEDFileField1TSStruct::presenceOfPartialNodeDiscr(int& pos) const { int i(0); - for(auto it=_already_checked.begin();it!=_already_checked.end();it++,i++) + for(std::vector::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++) { if((*it).getType()==ON_NODES) { - std::size_t const sz((*it).getNumberOfItems()); + std::size_t sz((*it).getNumberOfItems()); if(sz==1) { if(!(*it)[0].getPflName().empty()) @@ -2350,7 +2334,7 @@ MEDFileFastCellSupportComparator::MEDFileFastCellSupportComparator(const MEDFile if(!m) throw INTERP_KERNEL::Exception("MEDFileFastCellSupportComparator constructor : null input mesh struct !"); _mesh_comp=const_cast(m); _mesh_comp->incrRef(); - int const nbPts=ref->getNumberOfTS(); + int nbPts=ref->getNumberOfTS(); _f1ts_cmps.resize(nbPts); for(int i=0;i)); + std::size_t ret(_f1ts_cmps.capacity()*sizeof(MCAuto)); return ret; } @@ -2381,14 +2365,14 @@ std::vector MEDFileFastCellSupportComparator::getDirect const MEDFileMeshStruct *mst(_mesh_comp); if(mst) ret.push_back(mst); - for(const auto & _f1ts_cmp : _f1ts_cmps) - ret.push_back((const MEDFileField1TSStruct *)_f1ts_cmp); + for(std::vector< MCAuto >::const_iterator it=_f1ts_cmps.begin();it!=_f1ts_cmps.end();it++) + ret.push_back((const MEDFileField1TSStruct *)*it); return ret; } bool MEDFileFastCellSupportComparator::isEqual(const MEDFileAnyTypeFieldMultiTS *other) { - int const nbPts=other->getNumberOfTS(); + int nbPts=other->getNumberOfTS(); if(nbPts!=(int)_f1ts_cmps.size()) { std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::isEqual : unexpected nb of time steps in input ! Should be " << _f1ts_cmps.size() << " it is in reality " << nbPts << " !"; @@ -2406,7 +2390,7 @@ bool MEDFileFastCellSupportComparator::isEqual(const MEDFileAnyTypeFieldMultiTS bool MEDFileFastCellSupportComparator::isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other) { - int const nbPts=other->getNumberOfTS(); + int nbPts=other->getNumberOfTS(); if(nbPts!=(int)_f1ts_cmps.size()) { std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::isCompatibleWithNodesDiscr : unexpected nb of time steps in input ! Should be " << _f1ts_cmps.size() << " it is in reality " << nbPts << " !"; diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index d6b4a6275..466f73b72 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -21,20 +21,15 @@ #ifndef __MEDFILEFIELDOVERVIEW_HXX__ #define __MEDFILEFIELDOVERVIEW_HXX__ -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" -#include "CellModel.hxx" #include "MEDLoaderDefines.hxx" #include "MCAuto.hxx" #include "MEDCouplingRefCountObject.hxx" #include "MEDCoupling1GTUMesh.hxx" -#include "NormalizedGeometricTypes" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelException.hxx" -#include -#include -#include #include namespace MEDCoupling @@ -56,8 +51,8 @@ namespace MEDCoupling public: MEDLOADER_EXPORT static MEDFileMeshStruct *New(const MEDFileMesh *mesh); std::string getClassName() const override { return std::string("MEDFileMeshStruct"); } - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; const MEDFileMesh *getTheMesh() const { return _mesh; } mcIdType getNumberOfNodes() const { return _nb_nodes; } bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const; @@ -81,8 +76,8 @@ namespace MEDCoupling class MEDMeshMultiLev : public RefCountObject { public: - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; std::string getClassName() const override { return std::string("MEDMeshMultiLev"); } public: static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); @@ -139,13 +134,13 @@ namespace MEDCoupling public: static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& levs); static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); - void selectPartOfNodes(const DataArrayIdType *pflNodes) override; + void selectPartOfNodes(const DataArrayIdType *pflNodes); std::string getClassName() const override { return std::string("MEDUMeshMultiLev"); } - MEDMeshMultiLev *prepare() const override; + MEDMeshMultiLev *prepare() const; MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto& part); MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const; protected: - void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) override; + void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr); private: void reorderNodesIfNecessary(MCAuto& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const; private: @@ -161,7 +156,7 @@ namespace MEDCoupling class MEDStructuredMeshMultiLev : public MEDMeshMultiLev { public: - void selectPartOfNodes(const DataArrayIdType *pflNodes) override; + void selectPartOfNodes(const DataArrayIdType *pflNodes); virtual std::vector getNodeGridStructure() const = 0; std::string getClassName() const override { return std::string("MEDStructuredMeshMultiLev"); } protected: @@ -185,9 +180,9 @@ namespace MEDCoupling public: static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& levs); static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); - std::vector getNodeGridStructure() const override; + std::vector getNodeGridStructure() const; std::string getClassName() const override { return std::string("MEDCMeshMultiLev"); } - MEDMeshMultiLev *prepare() const override; + MEDMeshMultiLev *prepare() const; MEDLOADER_EXPORT std::vector< DataArrayDouble * > buildVTUArrays(bool& isInternal) const; private: MEDCMeshMultiLev(const MEDCMeshMultiLev& other); @@ -203,8 +198,8 @@ namespace MEDCoupling static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& levs); static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls , const std::vector& nbEntities); std::string getClassName() const override { return std::string("MEDCurveLinearMeshMultiLev"); } - std::vector getNodeGridStructure() const override; - MEDMeshMultiLev *prepare() const override; + std::vector getNodeGridStructure() const; + MEDMeshMultiLev *prepare() const; MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const; private: MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other); @@ -225,8 +220,8 @@ namespace MEDCoupling void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); // - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; // const DataArrayIdType *getPfl(const MEDFileFieldGlobsReal *globs) const; INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; } @@ -259,8 +254,8 @@ namespace MEDCoupling void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); bool operator==(const MEDFileField1TSStructItem& other) const; std::string getClassName() const override { return std::string("MEDFileField1TSStructItem"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; bool isEntityCell() const; bool isComputed() const { return _computed; } TypeOfField getType() const { return _type; } @@ -286,9 +281,9 @@ namespace MEDCoupling public: static MEDFileField1TSStruct *New(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst); void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); - std::size_t getHeapMemorySizeWithoutChildren() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; std::string getClassName() const override { return std::string("MEDFileField1TSStruct"); } - std::vector getDirectChildrenWithNull() const override; + std::vector getDirectChildrenWithNull() const; bool isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const; bool isSupportSameAs(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt); bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt); @@ -314,8 +309,8 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const; bool isEqual(const MEDFileAnyTypeFieldMultiTS *other); bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other); - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; private: MEDFileFastCellSupportComparator(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref); private: diff --git a/src/MEDLoader/MEDFileFieldVisitor.hxx b/src/MEDLoader/MEDFileFieldVisitor.hxx index 64eddf036..24fa4b9a5 100644 --- a/src/MEDLoader/MEDFileFieldVisitor.hxx +++ b/src/MEDLoader/MEDFileFieldVisitor.hxx @@ -21,6 +21,7 @@ #ifndef __MEDFILEFIELDVISITOR_HXX__ #define __MEDFILEFIELDVISITOR_HXX__ +#include "MEDLoaderDefines.hxx" #include "MEDFileField.hxx" namespace MEDCoupling @@ -47,7 +48,7 @@ namespace MEDCoupling virtual void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) = 0; // virtual void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) = 0; - virtual ~MEDFileFieldVisitor() = default; + virtual ~MEDFileFieldVisitor() { } }; } diff --git a/src/MEDLoader/MEDFileJoint.cxx b/src/MEDLoader/MEDFileJoint.cxx index d9dfc0bb5..678babc17 100644 --- a/src/MEDLoader/MEDFileJoint.cxx +++ b/src/MEDLoader/MEDFileJoint.cxx @@ -18,28 +18,13 @@ // #include "MEDFileJoint.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCType.hxx" #include "MEDFileBasis.hxx" -#include "MEDFileUtilities.hxx" +#include "MEDLoader.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileSafeCaller.txx" #include "CellModel.hxx" #include "InterpKernelAutoPtr.hxx" -#include "med.h" -#include "NormalizedGeometricTypes" -#include -#include -#include -#include "medfile.h" -#include -#include "medsubdomain.h" -#include -#include -#include -#include // From MEDLOader.cxx TU extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO]; @@ -121,8 +106,8 @@ MEDFileJointCorrespondence *MEDFileJointCorrespondence::New() */ void MEDFileJointCorrespondence::write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const { - med_access_mode const medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),medmod); + med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); std::ostringstream oss; oss << "MEDFileJointCorrespondence : error on attempt to write in file : \"" << fileName << "\""; MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str()); @@ -221,8 +206,8 @@ std::string MEDFileJointCorrespondence::simpleRepr() const const DataArrayIdType* tmp=getCorrespondence(); oss << "- Correspondence : <<"; - for(long const it : *tmp) - oss<< it << " "; + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) + oss<< *it << " "; } else { @@ -249,7 +234,7 @@ std::vector MEDFileJointOneStep::getDirectChildrenWithN MEDFileJointOneStep *MEDFileJointOneStep::New(int dt, int it) { - auto* j = new MEDFileJointOneStep(); + MEDFileJointOneStep* j = new MEDFileJointOneStep(); j->setOrder( dt ); j->setIteration( it ); return j; @@ -268,7 +253,7 @@ MEDFileJointOneStep *MEDFileJointOneStep::New(int dt, int it) MEDFileJointOneStep *MEDFileJointOneStep::New(const std::string& fileName, const std::string& mName, const std::string& jointName, int num) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY); return new MEDFileJointOneStep(fid, mName, jointName, num); } @@ -318,8 +303,8 @@ MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, */ void MEDFileJointOneStep::write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const { - med_access_mode const medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),medmod); + med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); std::ostringstream oss; oss << "MEDFileJointOneStep : error on attempt to write in file : \"" << fileName << "\""; MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str()); if ( _correspondences.empty() ) @@ -329,9 +314,9 @@ void MEDFileJointOneStep::write(const std::string& fileName, int mode, const std void MEDFileJointOneStep::writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName) const { - for(const auto & _correspondence : _correspondences) + for(std::vector< MCAuto >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++) { - _correspondence->writeLL(fid, localMeshName, jointName, getOrder(), getIteration()); + (*it)->writeLL(fid, localMeshName, jointName, getOrder(), getIteration()); } } @@ -402,7 +387,7 @@ MEDFileJointOneStep *MEDFileJointOneStep::deepCopy() const { std::vector< MCAuto > correspondences(_correspondences.size()); std::size_t i=0; - for(auto it=_correspondences.begin();it!=_correspondences.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++,i++) if((const MEDFileJointCorrespondence *)*it) correspondences[i]=(*it)->deepCopy(); MCAuto ret= new MEDFileJointOneStep; @@ -426,9 +411,9 @@ std::string MEDFileJointOneStep::simpleRepr() const std::ostringstream oss; oss << "(*************************************)\n(* JOINT_ONE_STEP INFORMATION: *)\n(*************************************)\n"; oss << "- Number of the correspondences : <<" << _correspondences.size() << ">>\n"; - for(const auto & _correspondence : _correspondences) + for(std::vector< MCAuto >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++) { - oss << _correspondence->simpleRepr(); + oss << (*it)->simpleRepr(); } return oss.str(); } @@ -465,7 +450,7 @@ MEDFileJoint *MEDFileJoint::New() MEDFileJoint *MEDFileJoint::New(const std::string& fileName, const std::string& mName, int curJoint) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY); return new MEDFileJoint(fid,mName,curJoint); } @@ -476,7 +461,7 @@ MEDFileJoint *MEDFileJoint::New(med_idt fid, const std::string& mName, int curJo MEDFileJoint *MEDFileJoint::New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum) { - auto* j = new MEDFileJoint(); + MEDFileJoint* j = new MEDFileJoint(); j->setJointName( jointName ); j->setLocalMeshName( locMeshName ); j->setRemoteMeshName( remoteMeshName ); @@ -485,7 +470,8 @@ MEDFileJoint *MEDFileJoint::New(const std::string& jointName, const std::string& } MEDFileJoint::MEDFileJoint() -= default; +{ +} /*! * Returns a new MEDFileJoint holding the mesh data that has been read from a given MED @@ -521,8 +507,8 @@ void MEDFileJoint::writeLL(med_idt fid) const // if ( _loc_mesh_name.empty() ) // throw INTERP_KERNEL::Exception("MEDFileJoint::write : name of a local mesh not defined!"); MEDFILESAFECALLERWR0(MEDsubdomainJointCr,(fid,getLocalMeshName().c_str(),getJointName().c_str(),getDescription().c_str(),getDomainNumber(),getRemoteMeshName().c_str())); - for(const auto & it : _joint) - it->writeLL(fid, getLocalMeshName(),getJointName()); + for(std::vector< MCAuto >::const_iterator it=_joint.begin();it!=_joint.end();it++) + (*it)->writeLL(fid, getLocalMeshName(),getJointName()); } void MEDFileJoint::pushStep(MEDFileJointOneStep* step) @@ -567,7 +553,7 @@ bool MEDFileJoint::isEqual(const MEDFileJoint *other) const return false; if(_domain_number!=other->_domain_number) return false; - int const nbTS(getNumberOfSteps()); + int nbTS(getNumberOfSteps()); if(nbTS!=other->getNumberOfSteps()) return false; std::vector found(nbTS,false); @@ -592,7 +578,7 @@ MEDFileJoint *MEDFileJoint::deepCopy() const { std::vector< MCAuto > joint(_joint.size()); std::size_t i=0; - for(auto it=_joint.begin();it!=_joint.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_joint.begin();it!=_joint.end();it++,i++) if((const MEDFileJointOneStep *)*it) joint[i]=(*it)->deepCopy(); MCAuto ret=new MEDFileJoint(*this); @@ -608,11 +594,11 @@ MEDFileJoint *MEDFileJoint::shallowCpy() const bool MEDFileJoint::changeJointNames(const std::vector< std::pair >& modifTab) { - for(const auto & it : modifTab) + for(std::vector< std::pair >::const_iterator it=modifTab.begin();it!=modifTab.end();it++) { - if(it.first==_joint_name) + if((*it).first==_joint_name) { - _joint_name=it.second; + _joint_name=(*it).second; return true; } } @@ -633,9 +619,9 @@ std::string MEDFileJoint::simpleRepr() const oss << "- Description : <<" << getDescription() << ">>\n"; oss << "- Joint name : <<" << getJointName() << ">>\n"; oss << "- Domain number : " << getDomainNumber() << "\n"; - for(const auto & it : _joint) + for(std::vector< MCAuto >::const_iterator it=_joint.begin();it!=_joint.end();it++) { - oss << it->simpleRepr(); + oss << (*it)->simpleRepr(); } return oss.str(); } @@ -648,7 +634,7 @@ MEDFileJoints *MEDFileJoints::New() MEDFileJoints *MEDFileJoints::New(const std::string& fileName, const std::string& meshName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(), MED_ACC_RDONLY); return new MEDFileJoints( fid, meshName ); } @@ -659,8 +645,8 @@ MEDFileJoints *MEDFileJoints::New(med_idt fid, const std::string& meshName) void MEDFileJoints::writeLL(med_idt fid) const { - for(const auto & _joint : _joints) - _joint->writeLL(fid); + for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++) + (*it)->writeLL(fid); } std::string MEDFileJoints::getMeshName() const @@ -694,7 +680,7 @@ MEDFileJoint *MEDFileJoints::getJointAtPos(int i) const MEDFileJoint *MEDFileJoints::getJointWithName(const std::string& jname) const { std::vector js=getJointsNames(); - auto const it=std::find(js.begin(),js.end(),jname); + std::vector::iterator it=std::find(js.begin(),js.end(),jname); if(it==js.end()) { std::ostringstream oss; oss << "MEDFileJoints::getJointWithName : Joint \"" << jname << "\" does not exist in this ! Existing are : "; @@ -708,7 +694,7 @@ std::vector MEDFileJoints::getJointsNames() const { std::vector ret(_joints.size()); int i=0; - for(auto it=_joints.begin();it!=_joints.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++) { const MEDFileJoint *f=(*it); if(f) @@ -727,9 +713,9 @@ std::vector MEDFileJoints::getJointsNames() const bool MEDFileJoints::changeJointNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(auto & _joint : _joints) + for(std::vector< MCAuto >::iterator it=_joints.begin();it!=_joints.end();it++) { - MEDFileJoint *cur(_joint); + MEDFileJoint *cur(*it); if(cur) ret=cur->changeJointNames(modifTab) || ret; } @@ -774,11 +760,12 @@ void MEDFileJoints::destroyJointAtPos(int i) } MEDFileJoints::MEDFileJoints() -= default; +{ +} MEDFileJoints::MEDFileJoints(med_idt fid, const std::string& meshName) { - med_int const num_joint=MEDnSubdomainJoint(fid, meshName.c_str() ); + med_int num_joint=MEDnSubdomainJoint(fid, meshName.c_str() ); for(int i = 1; i <= num_joint; i++) _joints.push_back(MEDFileJoint::New(fid,meshName,i)); } @@ -787,7 +774,7 @@ MEDFileJoints *MEDFileJoints::deepCopy() const { std::vector< MCAuto > joints(_joints.size()); std::size_t i=0; - for(auto it=_joints.begin();it!=_joints.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++) if((const MEDFileJoint *)*it) joints[i]=(*it)->deepCopy(); MCAuto ret=MEDFileJoints::New(); @@ -803,8 +790,8 @@ std::size_t MEDFileJoints::getHeapMemorySizeWithoutChildren() const std::vector MEDFileJoints::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _joint : _joints) - ret.push_back((const MEDFileJoint *)_joint); + for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++) + ret.push_back((const MEDFileJoint *)*it); return ret; } @@ -818,13 +805,13 @@ std::string MEDFileJoints::simpleRepr() const void MEDFileJoints::simpleReprWithoutHeader(std::ostream& oss) const { - int const nbOfJoints=getNumberOfJoints(); + int nbOfJoints=getNumberOfJoints(); oss << "There are " << nbOfJoints << " joints with the following names : \n"; std::vector jns=getJointsNames(); for(int i=0;i >::const_iterator it=_joints.begin();it!=_joints.end();it++) { - oss << _joint->simpleRepr(); + oss << (*it)->simpleRepr(); } } diff --git a/src/MEDLoader/MEDFileJoint.hxx b/src/MEDLoader/MEDFileJoint.hxx index fe81ecd60..29882107f 100644 --- a/src/MEDLoader/MEDFileJoint.hxx +++ b/src/MEDLoader/MEDFileJoint.hxx @@ -20,19 +20,12 @@ #ifndef __MEDFILEJOINT_HXX__ #define __MEDFILEJOINT_HXX__ -#include "MEDCouplingRefCountObject.hxx" -#include "MEDFileUtilities.hxx" -#include "MCType.hxx" #include "MEDLoaderDefines.hxx" +#include "MEDFileUtilities.txx" +#include "MEDCouplingMemArray.hxx" #include "MCAuto.hxx" #include "NormalizedGeometricTypes" -#include -#include -#include -#include "med.h" -#include -#include namespace MEDCoupling { @@ -51,8 +44,8 @@ public: INTERP_KERNEL::NormalizedCellType loc_geo_type, INTERP_KERNEL::NormalizedCellType rem_geo_type); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileJointCorrespondence"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileJointCorrespondence *deepCopy() const; MEDLOADER_EXPORT MEDFileJointCorrespondence *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileJointCorrespondence *other) const; @@ -91,8 +84,8 @@ public: MEDLOADER_EXPORT static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1); MEDLOADER_EXPORT static MEDFileJointOneStep *New(med_idt fid, const std::string& mName, const std::string& jointName, int number=1); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileJointOneStep"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileJointOneStep *deepCopy() const; MEDLOADER_EXPORT MEDFileJointOneStep *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileJointOneStep *other) const; @@ -132,8 +125,8 @@ public: MEDLOADER_EXPORT static MEDFileJoint *New(med_idt fid, const std::string& mName, int num); MEDLOADER_EXPORT static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum ); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileJoint"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileJoint *deepCopy() const; MEDLOADER_EXPORT MEDFileJoint *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileJoint *other) const; @@ -152,7 +145,7 @@ public: MEDLOADER_EXPORT int getNumberOfSteps() const; MEDLOADER_EXPORT MEDFileJointOneStep *getStepAtPos(int i) const; - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::string simpleRepr() const; private: @@ -178,11 +171,11 @@ public: MEDLOADER_EXPORT static MEDFileJoints *New(med_idt fid, const std::string& meshName); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileJoints"); } MEDLOADER_EXPORT MEDFileJoints *deepCopy() const; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const; - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::string getMeshName() const; MEDLOADER_EXPORT int getNumberOfJoints() const; MEDLOADER_EXPORT MEDFileJoint *getJointAtPos(int i) const; @@ -195,7 +188,7 @@ public: MEDLOADER_EXPORT void setJointAtPos(int i, MEDFileJoint *joint); MEDLOADER_EXPORT void destroyJointAtPos(int i); private: - ~MEDFileJoints() override = default; + ~MEDFileJoints() { } MEDFileJoints(); MEDFileJoints(med_idt fid, const std::string& meshName); private: diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 72dea91d7..57a21ceb1 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -19,58 +19,25 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDFileMesh.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCType.hxx" -#include "MEDCouplingMesh.hxx" -#include "MCAuto.hxx" -#include "MEDFileEquivalence.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingPartDefinition.hxx" -#include "CellModel.hxx" -#include "MEDCouplingPointSet.hxx" -#include "MEDCouplingStructuredMesh.hxx" -#include "MEDFileBasis.hxx" -#include "MEDCouplingCurveLinearMesh.hxx" -#include "InterpKernelException.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDFileFieldOverView.hxx" #include "MEDFileField.hxx" -#include "MEDFileMeshReadSelector.hxx" -#include "MEDFileUtilities.hxx" -#include "MEDFileMeshLL.hxx" -#include "MEDFileJoint.hxx" #include "MEDLoader.hxx" +#include "MEDLoaderNS.hxx" #include "MEDFileSafeCaller.txx" #include "MEDLoaderBase.hxx" #include "CrackAlgo.hxx" -#include "MEDLoaderNS.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingMemArray.txx" -// #include "MEDFileMeshElt.hxx" #include "InterpKernelAutoPtr.hxx" -#include "med.h" -#include "NormalizedGeometricTypes" -#include "MEDLoaderTraits.hxx" -#include "medfile.h" -#include "medmesh.h" -#include #include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include // From MEDLOader.cxx TU extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO]; @@ -90,14 +57,14 @@ MEDFileMesh::MEDFileMesh():_order(-1),_iteration(-1),_time(0.),_univ_wr_status(t std::size_t MEDFileMesh::getHeapMemorySizeWithoutChildren() const { std::size_t ret(_dt_unit.capacity()+_name.capacity()+_univ_name.capacity()+_desc_name.capacity()); - for(const auto & _group : _groups) + for(std::map >::const_iterator it=_groups.begin();it!=_groups.end();it++) { - ret+=_group.first.capacity()+_group.second.capacity()*sizeof(std::string); - for(const auto & it2 : _group.second) - ret+=it2.capacity(); + ret+=(*it).first.capacity()+(*it).second.capacity()*sizeof(std::string); + for(std::vector::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++) + ret+=(*it2).capacity(); } - for(const auto & _familie : _families) - ret+=_familie.first.capacity()+sizeof(mcIdType); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + ret+=(*it).first.capacity()+sizeof(mcIdType); return ret; } @@ -120,13 +87,13 @@ std::vector MEDFileMesh::getDirectChildrenWithNull() co */ MEDFileMesh *MEDFileMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,mrs); } MEDFileMesh *MEDFileMesh::New(med_idt fid, MEDFileMeshReadSelector *mrs) { - std::vector ms((MEDLoaderNS::getMeshNamesFid(fid))); + std::vector ms(MEDLoaderNS::getMeshNamesFid(fid)); if(ms.empty()) { std::ostringstream oss; oss << "MEDFileMesh::New : no meshes in file \"" << FileNameFromFID(fid) << "\" !"; @@ -184,11 +151,11 @@ MEDFileMesh *MEDFileMesh::New(med_idt fid, MEDFileMeshReadSelector *mrs) */ MEDFileMesh *MEDFileMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs, MEDFileJoints* joints) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,mName,dt,it,mrs,joints); } -MEDFileMesh *MEDFileMesh::New(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs, MEDFileJoints* /*joints*/) +MEDFileMesh *MEDFileMesh::New(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs, MEDFileJoints* joints) { MEDCoupling::MEDCouplingMeshType meshType; int dummy0,dummy1; @@ -307,11 +274,11 @@ void MEDFileMesh::clearNonDiscrAttributes() const bool MEDFileMesh::changeNames(const std::vector< std::pair >& modifTab) { - for(const auto & it : modifTab) + for(std::vector< std::pair >::const_iterator it=modifTab.begin();it!=modifTab.end();it++) { - if(it.first==_name) + if((*it).first==_name) { - _name=it.second; + _name=(*it).second; return true; } } @@ -375,8 +342,8 @@ void MEDFileMesh::clearFamGrpMaps() */ std::vector MEDFileMesh::getFamiliesOnGroup(const std::string& name) const { - std::string const oname(name); - auto const it=_groups.find(oname); + std::string oname(name); + std::map >::const_iterator it=_groups.find(oname); if(it==_groups.end()) { std::vector grps=getGroupsNames(); @@ -396,12 +363,12 @@ std::vector MEDFileMesh::getFamiliesOnGroup(const std::string& name std::vector MEDFileMesh::getFamiliesOnGroups(const std::vector& grps) const { std::set fams; - for(const auto & grp : grps) + for(std::vector::const_iterator it=grps.begin();it!=grps.end();it++) { - auto const it2=_groups.find(grp); + std::map >::const_iterator it2=_groups.find(*it); if(it2==_groups.end()) { - std::ostringstream oss; oss << "No such group in mesh \"" << _name << "\" : " << grp; + std::ostringstream oss; oss << "No such group in mesh \"" << _name << "\" : " << *it; std::vector grps2=getGroupsNames(); oss << "\" !\nAvailable groups are :"; std::copy(grps2.begin(),grps2.end(),std::ostream_iterator(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -420,8 +387,8 @@ std::vector MEDFileMesh::getFamiliesOnGroups(const std::vector MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const { - std::string const oname(name); - auto const it=_groups.find(oname); + std::string oname(name); + std::map >::const_iterator it=_groups.find(oname); std::vector grps=getGroupsNames(); if(it==_groups.end()) { @@ -441,13 +408,13 @@ std::vector MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name */ void MEDFileMesh::setFamiliesOnGroup(const std::string& name, const std::vector& fams) { - std::string const oname(name); + std::string oname(name); _groups[oname]=fams; - for(const auto & fam : fams) + for(std::vector::const_iterator it1=fams.begin();it1!=fams.end();it1++) { - auto const it2=_families.find(fam); + std::map::iterator it2=_families.find(*it1); if(it2==_families.end()) - _families[fam]=0; + _families[*it1]=0; } } @@ -461,12 +428,12 @@ void MEDFileMesh::setFamiliesOnGroup(const std::string& name, const std::vector< */ void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds) { - std::string const oname(name); + std::string oname(name); std::vector fams(famIds.size()); int i=0; - for(auto it1=famIds.begin();it1!=famIds.end();it1++,i++) + for(std::vector::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++) { - std::string const name2=getFamilyNameGivenId(*it1); + std::string name2=getFamilyNameGivenId(*it1); fams[i]=name2; } _groups[oname]=fams; @@ -480,12 +447,12 @@ void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vect std::vector MEDFileMesh::getGroupsOnFamily(const std::string& name) const { std::vector ret; - for(const auto & _group : _groups) + for(std::map >::const_iterator it1=_groups.begin();it1!=_groups.end();it1++) { - for(auto it2=_group.second.begin();it2!=_group.second.end();it2++) + for(std::vector::const_iterator it2=(*it1).second.begin();it2!=(*it1).second.end();it2++) if((*it2)==name) { - ret.push_back(_group.first); + ret.push_back((*it1).first); break; } } @@ -500,7 +467,7 @@ std::vector MEDFileMesh::getGroupsOnFamily(const std::string& name) */ void MEDFileMesh::setGroupsOnFamily(const std::string& famName, const std::vector& grps) { - std::string const fName(famName); + std::string fName(famName); const std::map::const_iterator it=_families.find(fName); if(it==_families.end()) { @@ -509,15 +476,15 @@ void MEDFileMesh::setGroupsOnFamily(const std::string& famName, const std::vecto std::copy(fams.begin(),fams.end(),std::ostream_iterator(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(const auto & grp : grps) + for(std::vector::const_iterator it3=grps.begin();it3!=grps.end();it3++) { - auto const it2=_groups.find(grp); + std::map< std::string, std::vector >::iterator it2=_groups.find(*it3); if(it2!=_groups.end()) (*it2).second.push_back(fName); else { - std::vector const grps2(1,fName); - _groups[grp]=grps2; + std::vector grps2(1,fName); + _groups[*it3]=grps2; } } } @@ -530,7 +497,7 @@ std::vector MEDFileMesh::getGroupsNames() const { std::vector ret(_groups.size()); int i=0; - for(auto it=_groups.begin();it!=_groups.end();it++,i++) + for(std::map >::const_iterator it=_groups.begin();it!=_groups.end();it++,i++) ret[i]=(*it).first; return ret; } @@ -543,7 +510,7 @@ std::vector MEDFileMesh::getFamiliesNames() const { std::vector ret(_families.size()); int i=0; - for(auto it=_families.begin();it!=_families.end();it++,i++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++,i++) ret[i]=(*it).first; return ret; } @@ -570,7 +537,7 @@ std::vector MEDFileMesh::getFamiliesNamesWithFilePointOfView() cons std::vector MEDFileMesh::getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const { std::vector ret; - std::vector const allGrps(getGroupsNames()); + std::vector allGrps(getGroupsNames()); const DataArrayIdType *arr=getFamilyFieldAtLevel(meshDimRelToMaxExt); if(!arr) return ret; @@ -581,7 +548,7 @@ std::vector MEDFileMesh::getGroupsOnSpecifiedLev(int meshDimRelToMa for(auto it2 : it.second) { auto it3 = _families.find( it2 ); - mcIdType const famIdToTest = (*it3).second; + mcIdType famIdToTest = (*it3).second; if( famIdsInUse.find(famIdToTest) != famIdsInUse.end() ) { ret.push_back( it.first ); @@ -599,7 +566,7 @@ std::vector MEDFileMesh::getGroupsOnSpecifiedLev(int meshDimRelToMa */ std::vector MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const { - std::vector const fams(getFamiliesOnGroup(grp)); + std::vector fams(getFamiliesOnGroup(grp)); return getFamsNonEmptyLevelsExt(fams); } @@ -611,7 +578,7 @@ std::vector MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& gr */ std::vector MEDFileMesh::getGrpsNonEmptyLevels(const std::vector& grps) const { - std::vector const fams(getFamiliesOnGroups(grps)); + std::vector fams(getFamiliesOnGroups(grps)); return getFamsNonEmptyLevels(fams); } @@ -622,7 +589,7 @@ std::vector MEDFileMesh::getGrpsNonEmptyLevels(const std::vector MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector& grps) const { - std::vector const fams(getFamiliesOnGroups(grps)); + std::vector fams(getFamiliesOnGroups(grps)); return getFamsNonEmptyLevelsExt(fams); } @@ -634,7 +601,7 @@ std::vector MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const { - std::vector const fams(getFamiliesOnGroup(grp)); + std::vector fams(getFamiliesOnGroup(grp)); return getFamsNonEmptyLevels(fams); } @@ -646,7 +613,7 @@ std::vector MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) */ std::vector MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const { - std::vector const fams(1,std::string(fam)); + std::vector fams(1,std::string(fam)); return getFamsNonEmptyLevels(fams); } @@ -657,7 +624,7 @@ std::vector MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) */ std::vector MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const { - std::vector const fams(1,std::string(fam)); + std::vector fams(1,std::string(fam)); return getFamsNonEmptyLevelsExt(fams); } @@ -686,7 +653,7 @@ void MEDFileMesh::assignFamilyNameWithGroupName() } newFams[grps[0]]=(*it).second; std::vector& grps2=groups[grps[0]]; - std::size_t const pos=std::distance(grps2.begin(),std::find(grps2.begin(),grps2.end(),(*it).first)); + std::size_t pos=std::distance(grps2.begin(),std::find(grps2.begin(),grps2.end(),(*it).first)); grps2[pos]=grps[0]; } else @@ -726,7 +693,7 @@ std::vector MEDFileMesh::removeEmptyGroups() void MEDFileMesh::removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& name) { - auto const it(_groups.find(name)); + std::map >::iterator it(_groups.find(name)); std::vector grps(getGroupsNames()); if(it==_groups.end()) { @@ -735,7 +702,7 @@ void MEDFileMesh::removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& throw INTERP_KERNEL::Exception(oss.str().c_str()); } const std::vector &famsOnGrp((*it).second); - std::vector const famIds(getFamiliesIdsOnGroup(name)); + std::vector famIds(getFamiliesIdsOnGroup(name)); const DataArrayIdType *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt)); if(!famArr) return ; @@ -745,10 +712,10 @@ void MEDFileMesh::removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& if(idsToKill->empty()) return ; std::vector newFamsOnGrp; - for(const auto & itt : famsOnGrp) + for(std::vector::const_iterator itt=famsOnGrp.begin();itt!=famsOnGrp.end();itt++) { - if(!idsToKill->presenceOfValue(getFamilyId(itt))) - newFamsOnGrp.push_back(itt); + if(!idsToKill->presenceOfValue(getFamilyId(*itt))) + newFamsOnGrp.push_back(*itt); } (*it).second=newFamsOnGrp; } @@ -760,7 +727,7 @@ void MEDFileMesh::removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& */ void MEDFileMesh::removeGroup(const std::string& name) { - auto const it=_groups.find(name); + std::map >::iterator it=_groups.find(name); std::vector grps(getGroupsNames()); if(it==_groups.end()) { @@ -778,8 +745,8 @@ void MEDFileMesh::removeGroup(const std::string& name) */ void MEDFileMesh::removeFamily(const std::string& name) { - std::string const oname(name); - auto const it=_families.find(oname); + std::string oname(name); + std::map::iterator it=_families.find(oname); std::vector fams=getFamiliesNames(); if(it==_families.end()) { @@ -788,10 +755,10 @@ void MEDFileMesh::removeFamily(const std::string& name) throw INTERP_KERNEL::Exception(oss.str().c_str()); } _families.erase(it); - for(auto & _group : _groups) + for(std::map >::iterator it3=_groups.begin();it3!=_groups.end();it3++) { - std::vector& v=_group.second; - auto const it4=std::find(v.begin(),v.end(),oname); + std::vector& v=(*it3).second; + std::vector::iterator it4=std::find(v.begin(),v.end(),oname); if(it4!=v.end()) v.erase(it4); } @@ -838,12 +805,12 @@ std::vector MEDFileMesh::removeOrphanFamilies() else { ret.push_back((*it).first); - std::vector const grpsOnEraseFam=getGroupsOnFamily((*it).first); - for(const auto & it2 : grpsOnEraseFam) + std::vector grpsOnEraseFam=getGroupsOnFamily((*it).first); + for(std::vector::const_iterator it2=grpsOnEraseFam.begin();it2!=grpsOnEraseFam.end();it2++) { - auto const it3=grps.find(it2);//it3!=grps.empty() thanks to copy + std::map >::iterator it3=grps.find(*it2);//it3!=grps.empty() thanks to copy std::vector& famv=(*it3).second; - auto const it4=std::find(famv.begin(),famv.end(),(*it).first);//it4!=famv.end() thanks to copy + std::vector::iterator it4=std::find(famv.begin(),famv.end(),(*it).first);//it4!=famv.end() thanks to copy famv.erase(it4); } } @@ -862,16 +829,16 @@ std::vector MEDFileMesh::removeOrphanFamilies() */ void MEDFileMesh::removeFamiliesReferedByNoGroups() { - std::map const fams; + std::map fams; std::set sfams; for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) sfams.insert((*it).first); for(std::map >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++) - for(const auto & it1 : (*it0).second) - sfams.erase(it1); - for(const auto & sfam : sfams) - if(sfam!=DFT_FAM_NAME) - _families.erase(sfam); + for(std::vector::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++) + sfams.erase(*it1); + for(std::set::const_iterator it=sfams.begin();it!=sfams.end();it++) + if(*it!=DFT_FAM_NAME) + _families.erase(*it); } /*! @@ -888,7 +855,7 @@ void MEDFileMesh::rearrangeFamilies() checkOrphanFamilyZero(); removeFamiliesReferedByNoGroups(); // - std::vector const levels(getNonEmptyLevelsExt()); + std::vector levels(getNonEmptyLevelsExt()); std::set idsRefed; for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { @@ -902,25 +869,25 @@ void MEDFileMesh::rearrangeFamilies() } } } - for(int const level : levels) + for(std::vector::const_iterator it=levels.begin();it!=levels.end();it++) { - const DataArrayIdType *fams(nullptr); + const DataArrayIdType *fams(0); try { - fams=getFamilyFieldAtLevel(level); + fams=getFamilyFieldAtLevel(*it); } catch(INTERP_KERNEL::Exception& ) { } if(!fams) continue; std::vector v(fams->getNumberOfTuples(),false); - for(long const pt : idsRefed) - fams->switchOnTupleEqualTo(pt,v); + for(std::set::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++) + fams->switchOnTupleEqualTo(*pt,v); MCAuto unfetchedIds(DataArrayIdType::BuildListOfSwitchedOff(v)); if(!unfetchedIds->empty()) { MCAuto newFams(fams->deepCopy()); newFams->setPartOfValuesSimple3(0,unfetchedIds->begin(),unfetchedIds->end(),0,1,1); - setFamilyFieldArr(level,newFams); + setFamilyFieldArr(*it,newFams); } } removeOrphanFamilies(); @@ -941,13 +908,13 @@ void MEDFileMesh::zipFamilies() for(auto fam : _families) { std::vector grps( this->getGroupsOnFamily( fam.first ) ); - std::set const sgrps(grps.begin(),grps.end()); + std::set sgrps(grps.begin(),grps.end()); setOfFamilies[sgrps].push_back(fam.first); } // std::map > newGroups(_groups); std::map newFams(_families); - std::vector const levels(getNonEmptyLevelsExt()); + std::vector levels(getNonEmptyLevelsExt()); std::map > famIdsToSubstitute; // iterate on all different set of groups std::set familiesToKill; @@ -963,7 +930,7 @@ void MEDFileMesh::zipFamilies() { if( setOfCommonGrp.second.size()<=1 ) continue; - std::string const newFamName(setOfCommonGrp.second[0]); + std::string newFamName(setOfCommonGrp.second[0]); auto newFamID(_families[newFamName]); for(auto grpToBeModified : setOfCommonGrp.first) { @@ -985,12 +952,12 @@ void MEDFileMesh::zipFamilies() // apply modifications in datastructure for(auto famIdsSubstSession : famIdsToSubstitute) { - for(int const level : levels) + for(std::vector::const_iterator it=levels.begin();it!=levels.end();it++) { DataArrayIdType *fams(nullptr); try { - fams=getFamilyFieldAtLevel(level); + fams=getFamilyFieldAtLevel(*it); } catch(INTERP_KERNEL::Exception& ) { } if(!fams) @@ -1008,11 +975,11 @@ void MEDFileMesh::zipFamilies() */ void MEDFileMesh::checkOrphanFamilyZero() const { - for(const auto & _group : _groups) + for(std::map >::const_iterator it=_groups.begin();it!=_groups.end();it++) { - if(std::find(_group.second.begin(),_group.second.end(),DFT_FAM_NAME)!=_group.second.end()) + if(std::find((*it).second.begin(),(*it).second.end(),DFT_FAM_NAME)!=(*it).second.end()) { - std::ostringstream oss; oss << "MEDFileMesh::rearrangeFamilies : Groups \"" << _group.first << "\" is lying on family \"" << DFT_FAM_NAME << "\" !"; + std::ostringstream oss; oss << "MEDFileMesh::rearrangeFamilies : Groups \"" << (*it).first << "\" is lying on family \"" << DFT_FAM_NAME << "\" !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } @@ -1027,8 +994,8 @@ void MEDFileMesh::checkOrphanFamilyZero() const */ void MEDFileMesh::changeGroupName(const std::string& oldName, const std::string& newName) { - std::string const oname(oldName); - auto const it=_groups.find(oname); + std::string oname(oldName); + std::map >::iterator it=_groups.find(oname); std::vector grps=getGroupsNames(); if(it==_groups.end()) { @@ -1036,14 +1003,14 @@ void MEDFileMesh::changeGroupName(const std::string& oldName, const std::string& std::copy(grps.begin(),grps.end(),std::ostream_iterator(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::string const nname(newName); - auto const it2=_groups.find(nname); + std::string nname(newName); + std::map >::iterator it2=_groups.find(nname); if(it2!=_groups.end()) { std::ostringstream oss; oss << "Such groupname \"" << newName << "\" already exists ! Kill it before !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::vector const cpy=(*it).second; + std::vector cpy=(*it).second; _groups.erase(it); _groups[newName]=cpy; } @@ -1077,8 +1044,8 @@ void MEDFileMesh::changeFamilyId(mcIdType oldId, mcIdType newId) */ void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string& newName) { - std::string const oname(oldName); - auto const it=_families.find(oname); + std::string oname(oldName); + std::map::iterator it=_families.find(oname); std::vector fams=getFamiliesNames(); if(it==_families.end()) { @@ -1086,20 +1053,20 @@ void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string std::copy(fams.begin(),fams.end(),std::ostream_iterator(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::string const nname(newName); - auto const it2=_families.find(nname); + std::string nname(newName); + std::map::iterator it2=_families.find(nname); if(it2!=_families.end()) { std::ostringstream oss; oss << "Such familyname \"" << newName << " already exists ! Kill it before !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType const cpy=(*it).second; + mcIdType cpy=(*it).second; _families.erase(it); _families[newName]=cpy; - for(auto & _group : _groups) + for(std::map >::iterator it3=_groups.begin();it3!=_groups.end();it3++) { - std::vector& v=_group.second; - auto const it4=std::find(v.begin(),v.end(),oname); + std::vector& v=(*it3).second; + std::vector::iterator it4=std::find(v.begin(),v.end(),oname); if(it4!=v.end()) (*it4)=nname; } @@ -1112,18 +1079,18 @@ void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string * \return bool - \c true if number of families and their ids are the same in the two * meshes. Families with the id == \c 0 are not considered. */ -bool MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& /*what*/) const +bool MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& what) const { if(_families==other->_families) return true; std::map fam0; std::map fam1; - for(const auto & _familie : _families) - if(_familie.second!=0) - fam0[_familie.first]=_familie.second; - for(const auto & _familie : other->_families) - if(_familie.second!=0) - fam1[_familie.first]=_familie.second; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + if((*it).second!=0) + fam0[(*it).first]=(*it).second; + for(std::map::const_iterator it=other->_families.begin();it!=other->_families.end();it++) + if((*it).second!=0) + fam1[(*it).first]=(*it).second; return fam0==fam1; } @@ -1140,7 +1107,7 @@ bool MEDFileMesh::areGrpsEqual(const MEDFileMesh *other, std::string& what) cons if(_groups==other->_groups) return true; bool ret=true; - std::size_t const sz=_groups.size(); + std::size_t sz=_groups.size(); if(sz!=other->_groups.size()) { what="Groups differ because not same number !\n"; @@ -1148,14 +1115,14 @@ bool MEDFileMesh::areGrpsEqual(const MEDFileMesh *other, std::string& what) cons } if(ret) { - auto it1=_groups.begin(); + std::map >::const_iterator it1=_groups.begin(); for(std::size_t i=0;i_groups.find((*it1).first); + std::map >::const_iterator it2=other->_groups.find((*it1).first); if(it2!=other->_groups.end()) { - std::set const s1((*it1).second.begin(),(*it1).second.end()); - std::set const s2((*it2).second.begin(),(*it2).second.end()); + std::set s1((*it1).second.begin(),(*it1).second.end()); + std::set s2((*it2).second.begin(),(*it2).second.end()); ret=(s1==s2); } else @@ -1169,18 +1136,18 @@ bool MEDFileMesh::areGrpsEqual(const MEDFileMesh *other, std::string& what) cons { std::ostringstream oss; oss << "Groups description differs :\n"; oss << "First group description :\n"; - for(const auto & _group : _groups) + for(std::map >::const_iterator it=_groups.begin();it!=_groups.end();it++) { - oss << " Group \"" << _group.first << "\" on following families :\n"; - for(const auto & it2 : _group.second) - oss << " \"" << it2 << "\n"; + oss << " Group \"" << (*it).first << "\" on following families :\n"; + for(std::vector::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++) + oss << " \"" << *it2 << "\n"; } oss << "Second group description :\n"; - for(const auto & _group : other->_groups) + for(std::map >::const_iterator it=other->_groups.begin();it!=other->_groups.end();it++) { - oss << " Group \"" << _group.first << "\" on following families :\n"; - for(const auto & it2 : _group.second) - oss << " \"" << it2 << "\n"; + oss << " Group \"" << (*it).first << "\" on following families :\n"; + for(std::vector::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++) + oss << " \"" << *it2 << "\n"; } what+=oss.str(); } @@ -1194,7 +1161,7 @@ bool MEDFileMesh::areGrpsEqual(const MEDFileMesh *other, std::string& what) cons */ bool MEDFileMesh::existsGroup(const std::string& groupName) const { - std::string const grpName(groupName); + std::string grpName(groupName); return _groups.find(grpName)!=_groups.end(); } @@ -1205,8 +1172,8 @@ bool MEDFileMesh::existsGroup(const std::string& groupName) const */ bool MEDFileMesh::existsFamily(mcIdType famId) const { - for(const auto & _familie : _families) - if(_familie.second==famId) + for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) + if((*it2).second==famId) return true; return false; } @@ -1218,7 +1185,7 @@ bool MEDFileMesh::existsFamily(mcIdType famId) const */ bool MEDFileMesh::existsFamily(const std::string& familyName) const { - std::string const fname(familyName); + std::string fname(familyName); return _families.find(fname)!=_families.end(); } @@ -1229,13 +1196,13 @@ bool MEDFileMesh::existsFamily(const std::string& familyName) const */ void MEDFileMesh::setFamilyId(const std::string& familyName, mcIdType id) { - std::string const fname(familyName); + std::string fname(familyName); _families[fname]=id; } void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, mcIdType id) { - std::string const fname(familyName); + std::string fname(familyName); for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) if((*it).second==id) { @@ -1256,8 +1223,8 @@ void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, mcIdType id) */ void MEDFileMesh::addFamily(const std::string& familyName, mcIdType famId) { - std::string const fname(familyName); - std::map::const_iterator const it=_families.find(fname); + std::string fname(familyName); + std::map::const_iterator it=_families.find(fname); if(it==_families.end()) { for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) @@ -1295,7 +1262,7 @@ void MEDFileMesh::addFamily(const std::string& familyName, mcIdType famId) */ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName) { - std::string const grpName(groupName); + std::string grpName(groupName); std::vector levs=getNonEmptyLevelsExt(); if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)==levs.end()) { @@ -1313,14 +1280,14 @@ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& gr throw INTERP_KERNEL::Exception(oss.str().c_str()); } const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt); - if(fieldFamIds==nullptr) + if(fieldFamIds==0) throw INTERP_KERNEL::Exception("MEDFileMesh::createGroupOnAll : Family field arr ids is not defined for this level !"); MCAuto famIds=fieldFamIds->getDifferentValues(); std::vector familiesOnWholeGroup; - for(long const it : *famIds) + for(const mcIdType *it=famIds->begin();it!=famIds->end();it++) { bool tmp; - familiesOnWholeGroup.push_back(findOrCreateAndGiveFamilyWithId(it,tmp)); + familiesOnWholeGroup.push_back(findOrCreateAndGiveFamilyWithId(*it,tmp)); } _groups[grpName]=familiesOnWholeGroup; } @@ -1336,34 +1303,34 @@ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& gr */ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& vMeshDimRelToMaxExt) { - std::set const levsInput(vMeshDimRelToMaxExt.begin(),vMeshDimRelToMaxExt.end()); + std::set levsInput(vMeshDimRelToMaxExt.begin(),vMeshDimRelToMaxExt.end()); std::vector levs=getNonEmptyLevelsExt(); - std::set const levs2(levs.begin(),levs.end()); + std::set levs2(levs.begin(),levs.end()); std::vector levsToTest; std::set_difference(levs2.begin(),levs2.end(),levsInput.begin(),levsInput.end(),std::back_insert_iterator< std::vector >(levsToTest)); - std::set const famIds2(famIds.begin(),famIds.end()); + std::set famIds2(famIds.begin(),famIds.end()); bool ret=true; mcIdType maxFamId=1; if(!_families.empty()) maxFamId=getMaxFamilyId()+1; - std::vector const allFams=getFamiliesNames(); - for(int const it : levsToTest) + std::vector allFams=getFamiliesNames(); + for(std::vector::const_iterator it=levsToTest.begin();it!=levsToTest.end();it++) { - const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(it); + const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(*it); if(fieldFamIds) { - MCAuto const famIds3=fieldFamIds->getDifferentValues(); + MCAuto famIds3=fieldFamIds->getDifferentValues(); std::vector tmp; std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector >(tmp)); - for(long const it2 : tmp) + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) { ret=false; - std::string const famName=getFamilyNameGivenId(it2); + std::string famName=getFamilyNameGivenId(*it2); std::ostringstream oss; oss << "Family_" << maxFamId; - std::string const zeName=CreateNameNotIn(oss.str(),allFams); + std::string zeName=CreateNameNotIn(oss.str(),allFams); addFamilyOnAllGroupsHaving(famName,zeName); _families[zeName]=maxFamId; - (const_cast(fieldFamIds))->changeValue(it2,maxFamId); + (const_cast(fieldFamIds))->changeValue(*it2,maxFamId); maxFamId++; } } @@ -1381,8 +1348,8 @@ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, cons */ void MEDFileMesh::addFamilyOnGrp(const std::string& grpName, const std::string& famName) { - std::string const grpn(grpName); - std::string const famn(famName); + std::string grpn(grpName); + std::string famn(famName); if(grpn.empty() || famn.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::addFamilyOnGrp : input strings must be non null !"); std::vector fams=getFamiliesNames(); @@ -1393,14 +1360,14 @@ void MEDFileMesh::addFamilyOnGrp(const std::string& grpName, const std::string& std::copy(fams.begin(),fams.end(),std::ostream_iterator(oss," ")); oss << "."; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - auto const it=_groups.find(grpn); + std::map >::iterator it=_groups.find(grpn); if(it==_groups.end()) { _groups[grpn].push_back(famn); } else { - auto const it2=std::find((*it).second.begin(),(*it).second.end(),famn); + std::vector::iterator it2=std::find((*it).second.begin(),(*it).second.end(),famn); if(it2==(*it).second.end()) (*it).second.push_back(famn); } @@ -1413,11 +1380,11 @@ void MEDFileMesh::addFamilyOnGrp(const std::string& grpName, const std::string& */ void MEDFileMesh::addFamilyOnAllGroupsHaving(const std::string& famName, const std::string& otherFamName) { - std::string const famNameCpp(famName); - std::string const otherCpp(otherFamName); - for(auto & _group : _groups) + std::string famNameCpp(famName); + std::string otherCpp(otherFamName); + for(std::map >::iterator it=_groups.begin();it!=_groups.end();it++) { - std::vector& v=_group.second; + std::vector& v=(*it).second; if(std::find(v.begin(),v.end(),famNameCpp)!=v.end()) { v.push_back(otherCpp); @@ -1430,7 +1397,7 @@ void MEDFileMesh::checkNoGroupClash(const DataArrayIdType *famArr, const std::st std::vector grpsNames(getGroupsNames()); if(std::find(grpsNames.begin(),grpsNames.end(),grpName)==grpsNames.end()) return ; - std::vector const famIds(getFamiliesIdsOnGroup(grpName)); + std::vector famIds(getFamiliesIdsOnGroup(grpName)); if(famArr->presenceOfValue(famIds)) { std::ostringstream oss; oss << "MEDFileUMesh::addGroup : Group with name \"" << grpName << "\" already exists at specified level ! Destroy it before calling this method !"; @@ -1446,7 +1413,7 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayIdType *i { if(!ids) throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : NULL pointer in input !"); - std::string const grpName(ids->getName()); + std::string grpName(ids->getName()); if(grpName.empty()) throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : empty group name ! MED file format do not accept empty group name !"); ids->checkStrictlyMonotonic(true); @@ -1479,11 +1446,11 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayIdType *i else { familyIds.push_back(isNodeGroup?maxVal:-maxVal); idsPerfamiliyIds.push_back(ids2); - std::string const locFamName=FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created); + std::string locFamName=FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created); fams.push_back(locFamName); if(existsFamily(*famId)) { - std::string const locFamName2=getFamilyNameGivenId(*famId); std::vector v(2); v[0]=locFamName2; v[1]=locFamName; + std::string locFamName2=getFamilyNameGivenId(*famId); std::vector v(2); v[0]=locFamName2; v[1]=locFamName; ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId),v); } maxVal++; @@ -1493,10 +1460,10 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayIdType *i { familyIds.push_back(isNodeGroup?maxVal:-maxVal); idsPerfamiliyIds.push_back(ret0); // modifying all other groups on *famId to lie on maxVal and on maxVal+1 familyIds.push_back(isNodeGroup?maxVal+1:-maxVal-1); idsPerfamiliyIds.push_back(ids2);//grp lie only on maxVal+1 - std::string const n2(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal+1:-maxVal-1,created)); fams.push_back(n2); + std::string n2(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal+1:-maxVal-1,created)); fams.push_back(n2); if(existsFamily(*famId)) { - std::string const n1(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created)); std::vector v(2); v[0]=n1; v[1]=n2; + std::string n1(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created)); std::vector v(2); v[0]=n1; v[1]=n2; ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId),v); } maxVal+=2; @@ -1508,7 +1475,7 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayIdType *i famArr->setPartOfValuesSimple3(familyIds[i],da->begin(),da->end(),0,1,1); } _families=families; - auto const itt(groups.find(grpName)); + std::map >::iterator itt(groups.find(grpName)); if(itt!=groups.end()) { std::vector& famsOnGrp((*itt).second); @@ -1526,11 +1493,11 @@ void MEDFileMesh::changeAllGroupsContainingFamily(const std::string& familyNameT void MEDFileMesh::ChangeAllGroupsContainingFamily(std::map >& groups, const std::string& familyNameToChange, const std::vector& newFamiliesNames) { - std::string const fam(familyNameToChange); - for(auto & group : groups) + std::string fam(familyNameToChange); + for(std::map >::iterator it=groups.begin();it!=groups.end();it++) { - std::vector& fams(group.second); - auto const it2=std::find(fams.begin(),fams.end(),fam); + std::vector& fams((*it).second); + std::vector::iterator it2=std::find(fams.begin(),fams.end(),fam); if(it2!=fams.end()) { fams.erase(it2); @@ -1610,7 +1577,7 @@ void MEDFileMesh::setGroupInfo(const std::map::const_iterator it=_families.find(name); if(it==_families.end()) { std::vector fams(getFamiliesNames()); @@ -1631,9 +1598,9 @@ std::vector MEDFileMesh::getFamiliesIds(const std::vector { std::vector ret(fams.size()); int i=0; - for(auto it=fams.begin();it!=fams.end();it++,i++) + for(std::vector::const_iterator it=fams.begin();it!=fams.end();it++,i++) { - auto const it2=_families.find(*it); + std::map::const_iterator it2=_families.find(*it); if(it2==_families.end()) { std::vector fams2=getFamiliesNames(); @@ -1656,9 +1623,9 @@ mcIdType MEDFileMesh::getMaxAbsFamilyId() const if(_families.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !"); mcIdType ret=-std::numeric_limits::max(); - for(const auto & _familie : _families) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { - ret=std::max(std::abs(_familie.second),ret); + ret=std::max(std::abs((*it).second),ret); } return ret; } @@ -1673,9 +1640,9 @@ mcIdType MEDFileMesh::getMaxFamilyId() const if(_families.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !"); mcIdType ret=-std::numeric_limits::max(); - for(const auto & _familie : _families) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { - ret=std::max(_familie.second,ret); + ret=std::max((*it).second,ret); } return ret; } @@ -1690,9 +1657,9 @@ mcIdType MEDFileMesh::getMinFamilyId() const if(_families.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::getMinFamilyId : no families set !"); mcIdType ret=std::numeric_limits::max(); - for(const auto & _familie : _families) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { - ret=std::min(_familie.second,ret); + ret=std::min((*it).second,ret); } return ret; } @@ -1705,9 +1672,9 @@ mcIdType MEDFileMesh::getMinFamilyId() const mcIdType MEDFileMesh::getTheMaxAbsFamilyId() const { mcIdType m1=-std::numeric_limits::max(); - for(const auto & _familie : _families) - m1=std::max(std::abs(_familie.second),m1); - mcIdType const m2=getMaxAbsFamilyIdInArrays(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + m1=std::max(std::abs((*it).second),m1); + mcIdType m2=getMaxAbsFamilyIdInArrays(); return std::max(m1,m2); } @@ -1719,9 +1686,9 @@ mcIdType MEDFileMesh::getTheMaxAbsFamilyId() const mcIdType MEDFileMesh::getTheMaxFamilyId() const { mcIdType m1=-std::numeric_limits::max(); - for(const auto & _familie : _families) - m1=std::max(_familie.second,m1); - mcIdType const m2=getMaxFamilyIdInArrays(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + m1=std::max((*it).second,m1); + mcIdType m2=getMaxFamilyIdInArrays(); return std::max(m1,m2); } @@ -1733,9 +1700,9 @@ mcIdType MEDFileMesh::getTheMaxFamilyId() const mcIdType MEDFileMesh::getTheMinFamilyId() const { mcIdType m1=std::numeric_limits::max(); - for(const auto & _familie : _families) - m1=std::min(_familie.second,m1); - mcIdType const m2=getMinFamilyIdInArrays(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + m1=std::min((*it).second,m1); + mcIdType m2=getMinFamilyIdInArrays(); return std::min(m1,m2); } @@ -1748,8 +1715,8 @@ DataArrayIdType *MEDFileMesh::getAllFamiliesIdsReferenced() const { MCAuto ret=DataArrayIdType::New(); std::set v; - for(const auto & _familie : _families) - v.insert(_familie.second); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + v.insert((*it).second); ret->alloc((mcIdType)v.size(),1); std::copy(v.begin(),v.end(),ret->getPointer()); return ret.retn(); @@ -1762,11 +1729,11 @@ DataArrayIdType *MEDFileMesh::getAllFamiliesIdsReferenced() const */ DataArrayIdType *MEDFileMesh::computeAllFamilyIdsInUse() const { - std::vector const famLevs=getFamArrNonEmptyLevelsExt(); + std::vector famLevs=getFamArrNonEmptyLevelsExt(); MCAuto ret; - for(int const famLev : famLevs) + for(std::vector::const_iterator it=famLevs.begin();it!=famLevs.end();it++) { - const DataArrayIdType *arr=getFamilyFieldAtLevel(famLev);//arr not null due to spec of getFamArrNonEmptyLevelsExt + const DataArrayIdType *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt MCAuto dv=arr->getDifferentValues(); if((DataArrayIdType *) ret) ret=dv->buildUnion(ret); @@ -1782,20 +1749,20 @@ DataArrayIdType *MEDFileMesh::computeAllFamilyIdsInUse() const */ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() { - std::vector const levs=getNonEmptyLevelsExt(); - std::set const allFamIds; + std::vector levs=getNonEmptyLevelsExt(); + std::set allFamIds; mcIdType maxId=getMaxFamilyId()+1; std::map > famIdsToRenum; - for(int const lev : levs) + for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { - const DataArrayIdType *fam=getFamilyFieldAtLevel(lev); + const DataArrayIdType *fam=getFamilyFieldAtLevel(*it); if(fam) { MCAuto tmp=fam->getDifferentValues(); std::set r2; std::set_intersection(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r2,r2.end())); if(!r2.empty()) - famIdsToRenum[lev].insert(famIdsToRenum[lev].end(),r2.begin(),r2.end()); + famIdsToRenum[*it].insert(famIdsToRenum[*it].end(),r2.begin(),r2.end()); std::set r3; std::set_union(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r3,r3.end())); } @@ -1805,25 +1772,25 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() MCAuto allIds=getAllFamiliesIdsReferenced(); for(std::map >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++) { - auto *fam=const_cast(getFamilyFieldAtLevel((*it2).first)); + DataArrayIdType *fam=const_cast(getFamilyFieldAtLevel((*it2).first)); mcIdType *famIdsToChange=fam->getPointer(); std::map ren; - for(auto it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++) + for(std::vector::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++) { if(allIds->presenceOfValue(*it3)) { - std::string const famName=getFamilyNameGivenId(*it3); - std::vector const grps=getGroupsOnFamily(famName); + std::string famName=getFamilyNameGivenId(*it3); + std::vector grps=getGroupsOnFamily(famName); ren[*it3]=maxId; bool dummy; - std::string const newFam=findOrCreateAndGiveFamilyWithId(maxId,dummy); - for(const auto & grp : grps) - addFamilyOnGrp(grp,newFam); + std::string newFam=findOrCreateAndGiveFamilyWithId(maxId,dummy); + for(std::vector::const_iterator it4=grps.begin();it4!=grps.end();it4++) + addFamilyOnGrp((*it4),newFam); } } MCAuto ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size()); - for(long const id : *ids) - famIdsToChange[id]=ren[famIdsToChange[id]]; + for(const mcIdType *id=ids->begin();id!=ids->end();id++) + famIdsToChange[*id]=ren[famIdsToChange[*id]]; } return false; } @@ -1854,7 +1821,7 @@ void MEDFileMesh::normalizeFamIdsTrio() std::map ren; for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++) ren[*it]=refId; - mcIdType const nbOfTuples=fam->getNumberOfTuples(); + mcIdType nbOfTuples=fam->getNumberOfTuples(); mcIdType *start=const_cast(fam)->getPointer(); for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; @@ -1862,7 +1829,7 @@ void MEDFileMesh::normalizeFamIdsTrio() { if(allIds->presenceOfValue(*it)) { - std::string const famName=getFamilyNameGivenId(*it); + std::string famName=getFamilyNameGivenId(*it); families[famName]=ren[*it]; famsFetched.insert(famName); } @@ -1880,7 +1847,7 @@ void MEDFileMesh::normalizeFamIdsTrio() std::map ren; for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--) ren[*it]=refId; - mcIdType const nbOfTuples=fam->getNumberOfTuples(); + mcIdType nbOfTuples=fam->getNumberOfTuples(); mcIdType *start=const_cast(fam)->getPointer(); for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; @@ -1888,16 +1855,16 @@ void MEDFileMesh::normalizeFamIdsTrio() { if(allIds->presenceOfValue(*it)) { - std::string const famName=getFamilyNameGivenId(*it); + std::string famName=getFamilyNameGivenId(*it); families[famName]=ren[*it]; famsFetched.insert(famName); } } } } - for(int const it2 : levsS) + for(std::set::const_iterator it2=levsS.begin();it2!=levsS.end();it2++) { - auto *fam=const_cast(getFamilyFieldAtLevel(it2)); + DataArrayIdType *fam=const_cast(getFamilyFieldAtLevel(*it2)); if(fam) { MCAuto tmp=fam->getDifferentValues(); @@ -1905,7 +1872,7 @@ void MEDFileMesh::normalizeFamIdsTrio() for(const mcIdType *it3=tmp->begin();it3!=tmp->end();it3++) if(allIds->presenceOfValue(*it3)) { - std::string const famName=getFamilyNameGivenId(*it3); + std::string famName=getFamilyNameGivenId(*it3); families[famName]=0; famsFetched.insert(famName); } @@ -1913,11 +1880,11 @@ void MEDFileMesh::normalizeFamIdsTrio() } // std::vector allFams=getFamiliesNames(); - std::set const allFamsS(allFams.begin(),allFams.end()); + std::set allFamsS(allFams.begin(),allFams.end()); std::set unFetchedIds; std::set_difference(allFamsS.begin(),allFamsS.end(),famsFetched.begin(),famsFetched.end(),std::inserter(unFetchedIds,unFetchedIds.end())); - for(const auto & unFetchedId : unFetchedIds) - families[unFetchedId]=_families[unFetchedId]; + for(std::set::const_iterator it4=unFetchedIds.begin();it4!=unFetchedIds.end();it4++) + families[*it4]=_families[*it4]; _families=families; } @@ -1946,7 +1913,7 @@ void MEDFileMesh::normalizeFamIdsMEDFile() std::map ren; for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++) ren[*it]=refId; - mcIdType const nbOfTuples=fam->getNumberOfTuples(); + mcIdType nbOfTuples=fam->getNumberOfTuples(); mcIdType *start=const_cast(fam)->getPointer(); for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; @@ -1954,7 +1921,7 @@ void MEDFileMesh::normalizeFamIdsMEDFile() { if(allIds->presenceOfValue(*it)) { - std::string const famName=getFamilyNameGivenId(*it); + std::string famName=getFamilyNameGivenId(*it); families[famName]=ren[*it]; famsFetched.insert(famName); } @@ -1962,7 +1929,7 @@ void MEDFileMesh::normalizeFamIdsMEDFile() } } refId=-1; - for(auto it2=levsS.rbegin();it2!=levsS.rend();it2++) + for(std::set::const_reverse_iterator it2=levsS.rbegin();it2!=levsS.rend();it2++) { const DataArrayIdType *fam=getFamilyFieldAtLevel(*it2); if(fam) @@ -1971,7 +1938,7 @@ void MEDFileMesh::normalizeFamIdsMEDFile() std::map ren; for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--) ren[*it]=refId; - mcIdType const nbOfTuples=fam->getNumberOfTuples(); + mcIdType nbOfTuples=fam->getNumberOfTuples(); mcIdType *start=const_cast(fam)->getPointer(); for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; @@ -1979,7 +1946,7 @@ void MEDFileMesh::normalizeFamIdsMEDFile() { if(allIds->presenceOfValue(*it)) { - std::string const famName=getFamilyNameGivenId(*it); + std::string famName=getFamilyNameGivenId(*it); families[famName]=ren[*it]; famsFetched.insert(famName); } @@ -1988,11 +1955,11 @@ void MEDFileMesh::normalizeFamIdsMEDFile() } // std::vector allFams=getFamiliesNames(); - std::set const allFamsS(allFams.begin(),allFams.end()); + std::set allFamsS(allFams.begin(),allFams.end()); std::set unFetchedIds; std::set_difference(allFamsS.begin(),allFamsS.end(),famsFetched.begin(),famsFetched.end(),std::inserter(unFetchedIds,unFetchedIds.end())); - for(const auto & unFetchedId : unFetchedIds) - families[unFetchedId]=_families[unFetchedId]; + for(std::set::const_iterator it4=unFetchedIds.begin();it4!=unFetchedIds.end();it4++) + families[*it4]=_families[*it4]; _families=families; } @@ -2005,9 +1972,9 @@ void MEDFileMesh::normalizeFamIdsMEDFile() */ std::string MEDFileMesh::getFamilyNameGivenId(mcIdType id) const { - for(const auto & _familie : _families) - if(_familie.second==id) - return _familie.first; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + if((*it).second==id) + return (*it).first; std::ostringstream oss; oss << "MEDFileUMesh::getFamilyNameGivenId : no such family id : " << id; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -2090,7 +2057,7 @@ DataArrayIdType *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::str */ DataArrayIdType *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum) const { - std::vector const fams2=getFamiliesOnGroups(grps); + std::vector fams2=getFamiliesOnGroups(grps); return getFamiliesArr(meshDimRelToMaxExt,fams2,renum); } @@ -2206,7 +2173,7 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector grpsName2(grps.size()); int i=0; - for(auto it=grps.begin();it!=grps.end();it++,i++) + for(std::vector::const_iterator it=grps.begin();it!=grps.end();it++,i++) { grpsName.insert((*it)->getName()); grpsName2[i]=(*it)->getName(); @@ -2215,7 +2182,7 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector fam; std::vector< std::vector > fidsOfGroups; if(!renum) @@ -2230,14 +2197,14 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vectorsetName(grps[ii]->getName()); } - std::vector const grps3(grps2.begin(),grps2.end()); + std::vector grps3(grps2.begin(),grps2.end()); fam=DataArrayIdType::MakePartition(grps3,sz,fidsOfGroups); } mcIdType offset=1; if(!_families.empty()) offset=getMaxAbsFamilyId()+1; TranslateFamilyIds(meshDimRelToMaxExt==1?offset:-offset,fam,fidsOfGroups); - MCAuto const ids=fam->getDifferentValues(); + MCAuto ids=fam->getDifferentValues(); appendFamilyEntries(ids,fidsOfGroups,grpsName2); setFamilyFieldArr(meshDimRelToMaxExt,fam); } @@ -2250,30 +2217,30 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector >& fidsOfGrps, const std::vector& grpNames) { std::map famInv; - for(long const famId : *famIds) + for(const mcIdType *it=famIds->begin();it!=famIds->end();it++) { std::ostringstream oss; - oss << "Family_" << famId; - _families[oss.str()]=famId; - famInv[famId]=oss.str(); + oss << "Family_" << (*it); + _families[oss.str()]=(*it); + famInv[*it]=oss.str(); } int i=0; - for(auto it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++) + for(std::vector< std::vector >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++) { - for(long const it2 : *it1) + for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) { - _groups[grpNames[i]].push_back(famInv[it2]); + _groups[grpNames[i]].push_back(famInv[*it2]); } } } std::vector MEDFileMesh::getAllGeoTypes() const { - std::vector const levs(getNonEmptyLevels()); + std::vector levs(getNonEmptyLevels()); std::vector ret; - for(int const lev : levs) + for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { - std::vector elts(getGeoTypesAtLevel(lev)); + std::vector elts(getGeoTypesAtLevel(*it)); ret.insert(ret.end(),elts.begin(),elts.end()); } return ret; @@ -2298,11 +2265,11 @@ void MEDFileMesh::loadLLWithAdditionalItems(med_idt fid, const std::string& mNam void MEDFileMesh::TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector >& famIdsPerGrp) { famArr->applyLin(offset>0?1:-1,offset,0); - for(auto & it1 : famIdsPerGrp) + for(std::vector< std::vector >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++) { if(offset<0) - std::transform(it1.begin(),it1.end(),it1.begin(),std::negate()); - std::transform(it1.begin(),it1.end(),it1.begin(),std::bind(std::plus(),std::placeholders::_1,offset)); + std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate()); + std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind(std::plus(),std::placeholders::_1,offset)); } } @@ -2317,7 +2284,7 @@ std::string MEDFileMesh::CreateNameNotIn(const std::string& nameTry, const std:: if(std::find(namesToAvoid.begin(),namesToAvoid.end(),nameTry)==namesToAvoid.end()) return nameTry; //attempt #1 - std::size_t const len=nameTry.length(); + std::size_t len=nameTry.length(); for(std::size_t ii=1;ii::const_iterator it2=namesToAvoid.begin();it2!=namesToAvoid.end();it2++) + tmp2+=(*it2); if(std::find(namesToAvoid.begin(),namesToAvoid.end(),tmp2)==namesToAvoid.end()) return tmp2; throw INTERP_KERNEL::Exception("MEDFileMesh::CreateNameNotIn : impossible to find a not already used name !"); @@ -2346,7 +2313,7 @@ std::string MEDFileMesh::CreateNameNotIn(const std::string& nameTry, const std:: mcIdType MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector& code, mcIdType strt) { - std::size_t const nbOfChunks=code.size()/3; + std::size_t nbOfChunks=code.size()/3; if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDFileMesh::PutInThirdComponentOfCodeOffset : code has invalid size : should be of size 3*x !"); mcIdType ret=strt; @@ -2372,7 +2339,7 @@ void MEDFileMesh::dealWithTinyInfo(const MEDCouplingMesh *m) _name=m->getName(); else { - std::string const name(m->getName()); + std::string name(m->getName()); if(!name.empty()) { if(_name!=name) @@ -2387,7 +2354,7 @@ void MEDFileMesh::dealWithTinyInfo(const MEDCouplingMesh *m) _desc_name=m->getDescription(); else { - std::string const name(m->getDescription()); + std::string name(m->getDescription()); if(!name.empty()) { if(_desc_name!=name) @@ -2403,11 +2370,11 @@ void MEDFileMesh::dealWithTinyInfo(const MEDCouplingMesh *m) void MEDFileMesh::getFamilyRepr(std::ostream& oss) const { oss << "(**************************)\n(* FAMILIES OF THE MESH : *)\n(**************************)\n"; - for(const auto & _familie : _families) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { - oss << "- Family with name \"" << _familie.first << "\" with number " << _familie.second << std::endl; + oss << "- Family with name \"" << (*it).first << "\" with number " << (*it).second << std::endl; oss << " - Groups lying on this family : "; - std::vector grps=getGroupsOnFamily(_familie.first); + std::vector grps=getGroupsOnFamily((*it).first); std::copy(grps.begin(),grps.end(),std::ostream_iterator(oss," ")); oss << std::endl << std::endl; } @@ -2429,7 +2396,7 @@ void MEDFileMesh::getFamilyRepr(std::ostream& oss) const */ MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,mName,dt,it,mrs); } @@ -2450,14 +2417,14 @@ MEDFileUMesh *MEDFileUMesh::New(med_idt fid, const std::string& mName, int dt, i */ MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,mrs); } template T *NewForTheFirstMeshInFile(med_idt fid, MEDFileMeshReadSelector *mrs) { - std::vector ms((MEDLoaderNS::getMeshNamesFid(fid))); + std::vector ms(MEDLoaderNS::getMeshNamesFid(fid)); if(ms.empty()) { std::ostringstream oss; oss << MLMeshTraits::ClassName << "::New : no meshes in file \"" << MEDFileWritable::FileNameFromFID(fid) << "\" !"; @@ -2536,7 +2503,7 @@ MCAuto MEDFileUMesh::LoadConnectivityOnlyPartOf(med_idt fid, const MCAuto MEDFileUMesh::LoadConnectivityOnlyPartOf(const std::string& fileName, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid const fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY)); + MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY)); return MEDFileUMesh::LoadConnectivityOnlyPartOf(fid,mName,types,slicPerTyp,dt,it,mrs); } @@ -2560,7 +2527,7 @@ MCAuto MEDFileUMesh::LoadConnectivityOnlyPartOf(const std::string& MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid const fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY)); + MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY)); return MEDFileUMesh::LoadPartOf(fid,mName,types,slicPerTyp,dt,it,mrs); } @@ -2616,7 +2583,7 @@ MEDFileUMesh *MEDFileUMesh::LoadPartOfFromUserDistrib(med_idt fid, const std::st void MEDFileUMesh::LoadPartCoords(const std::string& fileName, const std::string& mName, int dt, int it, const std::vector& infosOnComp, mcIdType startNodeId, mcIdType stopNodeId, MCAuto& coords, MCAuto& partCoords, MCAuto& famCoords, MCAuto& numCoords, MCAuto& nameCoords) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); MEDFileUMeshL2::LoadPartCoords(fid,infosOnComp,mName,dt,it,startNodeId,stopNodeId,coords,partCoords,famCoords,numCoords,nameCoords); } @@ -2637,10 +2604,10 @@ std::vector MEDFileUMesh::getDirectChildrenWithNull() c ret.push_back((const DataArrayIdType *)_rev_num_coords); ret.push_back((const DataArrayAsciiChar *)_name_coords); ret.push_back((const PartDefinition *)_part_coords); - for(const auto & _m : _ms) - ret.push_back((const MEDFileUMeshSplitL1*) _m); - for(const auto & it : _elt_str) - ret.push_back((const MEDFileEltStruct4Mesh *)it); + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) + ret.push_back((const MEDFileUMeshSplitL1*) *it); + for(std::vector< MCAuto >::const_iterator it=_elt_str.begin();it!=_elt_str.end();it++) + ret.push_back((const MEDFileEltStruct4Mesh *)*it); return ret; } @@ -2672,7 +2639,7 @@ MEDFileUMesh *MEDFileUMesh::deepCopy() const if(_name_coords.isNotNull()) ret->_name_coords=_name_coords->deepCopy(); std::size_t i=0; - for(auto it=_ms.begin();it!=_ms.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++) { if((const MEDFileUMeshSplitL1 *)(*it)) ret->_ms[i]=(*it)->deepCopy(ret->_coords); @@ -2693,7 +2660,7 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh { if(!MEDFileMesh::isEqual(other,eps,what)) return false; - const auto *otherC=dynamic_cast(other); + const MEDFileUMesh *otherC=dynamic_cast(other); if(!otherC) { what="Mesh types differ ! This is unstructured and other is NOT !"; @@ -2703,14 +2670,14 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh otherC->clearNonDiscrAttributes(); const DataArrayDouble *coo1=_coords; const DataArrayDouble *coo2=otherC->_coords; - if((coo1==nullptr && coo2!=nullptr) || (coo1!=nullptr && coo2==nullptr)) + if((coo1==0 && coo2!=0) || (coo1!=0 && coo2==0)) { what="Mismatch of coordinates ! One is defined and not other !"; return false; } if(coo1) { - bool const ret=coo1->isEqual(*coo2,eps); + bool ret=coo1->isEqual(*coo2,eps); if(!ret) { what="Coords differ !"; @@ -2719,14 +2686,14 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } { const DataArrayIdType *famc1(_fam_coords),*famc2(otherC->_fam_coords); - if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr)) + if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of families arr on nodes ! One is defined and not other !"; return false; } if(famc1) { - bool const ret=famc1->isEqual(*famc2); + bool ret=famc1->isEqual(*famc2); if(!ret) { what="Families arr on node differ !"; @@ -2736,14 +2703,14 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } { const DataArrayIdType *numc1(_num_coords),*numc2(otherC->_num_coords); - if((numc1==nullptr && numc2!=nullptr) || (numc1!=nullptr && numc2==nullptr)) + if((numc1==0 && numc2!=0) || (numc1!=0 && numc2==0)) { what="Mismatch of numbering arr on nodes ! One is defined and not other !"; return false; } if(numc1) { - bool const ret=numc1->isEqual(*numc2); + bool ret=numc1->isEqual(*numc2); if(!ret) { what="Numbering arr on node differ !"; @@ -2753,14 +2720,14 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } { const DataArrayIdType *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords); - if((gnumc1==nullptr && gnumc2!=nullptr) || (gnumc1!=nullptr && gnumc2==nullptr)) + if((gnumc1==0 && gnumc2!=0) || (gnumc1!=0 && gnumc2==0)) { what="Mismatch of numbering arr on nodes ! One is defined and not other !"; return false; } if(gnumc1) { - bool const ret=gnumc1->isEqual(*gnumc2); + bool ret=gnumc1->isEqual(*gnumc2); if(!ret) { what="Global numbering arr on node differ !"; @@ -2770,14 +2737,14 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } { const DataArrayAsciiChar *namec1(_name_coords),*namec2(otherC->_name_coords); - if((namec1==nullptr && namec2!=nullptr) || (namec1!=nullptr && namec2==nullptr)) + if((namec1==0 && namec2!=0) || (namec1!=0 && namec2==0)) { what="Mismatch of naming arr on nodes ! One is defined and not other !"; return false; } if(namec1) { - bool const ret=namec1->isEqual(*namec2); + bool ret=namec1->isEqual(*namec2); if(!ret) { what="Names arr on node differ !"; @@ -2790,19 +2757,19 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh what="Number of levels differs !"; return false; } - std::size_t const sz=_ms.size(); + std::size_t sz=_ms.size(); for(std::size_t i=0;i_ms[i]; - if((s1==nullptr && s2!=nullptr) || (s1!=nullptr && s2==nullptr)) + if((s1==0 && s2!=0) || (s1!=0 && s2==0)) { what="Mismatch of presence of sub levels !"; return false; } if(s1) { - bool const ret=s1->isEqual(s2,eps,what); + bool ret=s1->isEqual(s2,eps,what); if(!ret) return false; } @@ -2838,14 +2805,14 @@ void MEDFileUMesh::checkConsistency() const } else { - mcIdType const nbCoo = _coords->getNumberOfTuples(); + mcIdType nbCoo = _coords->getNumberOfTuples(); if (_fam_coords.isNotNull()) _fam_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node family array!"); if (_num_coords.isNotNull()) { _num_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node numbering array!"); mcIdType pos; - mcIdType const maxValue=_num_coords->getMaxValue(pos); + mcIdType maxValue=_num_coords->getMaxValue(pos); if (!_rev_num_coords || _rev_num_coords->getNumberOfTuples() != (maxValue+1)) throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): inconsistent internal revert node numbering array!"); } @@ -2860,8 +2827,9 @@ void MEDFileUMesh::checkConsistency() const if (_name_coords) _name_coords->checkNbOfTuplesAndComp(nbCoo,MED_SNAME_SIZE,"MEDFileUMesh::checkConsistency(): inconsistent internal coord name array!"); // Now sub part check: - for (const auto & _m : _ms) - _m->checkConsistency(); + for (std::vector< MCAuto >::const_iterator it=_ms.begin(); + it != _ms.end(); it++) + (*it)->checkConsistency(); } } @@ -2877,11 +2845,11 @@ void MEDFileUMesh::checkSMESHConsistency() const // For all sub-levels, numbering is either always null or with void intersection: if (_ms.size()) { - auto it=_ms.begin(); + std::vector< MCAuto >::const_iterator it=_ms.begin(); std::vector< const DataArrayIdType * > v; - bool const voidOrNot = ((*it)->_num == nullptr); + bool voidOrNot = ((*it)->_num == 0); for (it++; it != _ms.end(); it++) - if( ((*it)->_num == nullptr) != voidOrNot ) + if( ((*it)->_num == 0) != voidOrNot ) throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): inconsistent numbering between mesh sub-levels!"); else if (!voidOrNot) v.push_back((*it)->_num); @@ -2905,11 +2873,11 @@ void MEDFileUMesh::clearNodeAndCellNumbers() _num_coords.nullify(); _rev_num_coords.nullify(); _global_num_coords.nullify(); - for (auto & _m : _ms) + for (std::vector< MCAuto >::iterator it=_ms.begin(); it != _ms.end(); it++) { - _m->_num.nullify(); - _m->_rev_num.nullify(); - _m->_global_num.nullify(); + (*it)->_num.nullify(); + (*it)->_rev_num.nullify(); + (*it)->_global_num.nullify(); } } @@ -2927,23 +2895,24 @@ void MEDFileUMesh::clearNonDiscrAttributes() const _num_coords.iAmATrollConstCast()->setName("");//This parameter is not discriminant for comparison if(_name_coords.isNotNull()) _name_coords.iAmATrollConstCast()->setName("");//This parameter is not discriminant for comparison - for(const auto & _m : _ms) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { - if(_m.isNotNull()) - _m->clearNonDiscrAttributes(); + if((*it).isNotNull()) + (*it)->clearNonDiscrAttributes(); } } void MEDFileUMesh::setName(const std::string& name) { - for(auto & _m : _ms) - if(_m.isNotNull()) - _m->setName(name); + for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) + if((*it).isNotNull()) + (*it)->setName(name); MEDFileMesh::setName(name); } MEDFileUMesh::MEDFileUMesh() -= default; +{ +} MEDFileUMesh::MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) try @@ -3037,7 +3006,7 @@ void MEDFileMesh::loadJointsFromFile(med_idt fid, MEDFileJoints* toUseInstedOfRe void MEDFileMesh::loadEquivalences(med_idt fid) { - int const nbOfEq(MEDFileEquivalences::PresenceOfEquivalences(fid,_name)); + int nbOfEq(MEDFileEquivalences::PresenceOfEquivalences(fid,_name)); if(nbOfEq>0) _equiv=MEDFileEquivalences::Load(fid,nbOfEq,this); } @@ -3146,14 +3115,14 @@ void MEDFileUMesh::loadLL(med_idt fid, const std::string& mName, int dt, int it, void MEDFileUMesh::dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl2, const std::string& mName, MEDFileMeshReadSelector *mrs) { - int const lev=loaderl2.getNumberOfLevels(); + int lev=loaderl2.getNumberOfLevels(); _ms.resize(lev); for(int i=0;i desc=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str); MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str); - int const spaceDim=(int)(coo?coo->getNumberOfComponents():0); + int spaceDim=(int)(coo?coo->getNumberOfComponents():0); int mdim(0); if(!_ms.empty()) mdim=getMeshDimension(); @@ -3194,7 +3164,7 @@ void MEDFileUMesh::writeMeshLL(med_idt fid) const INTERP_KERNEL::AutoPtr unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE); for(int i=0;igetInfoOnComponent(i); + std::string info=coo->getInfoOnComponent(i); std::string c,u; MEDLoaderBase::splitIntoNameAndUnit(info,c,u); MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo @@ -3203,13 +3173,13 @@ void MEDFileUMesh::writeMeshLL(med_idt fid) const MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MEDFileMeshL2::TraduceAxisTypeRev(getAxisType()),comp,unit)); if(_univ_wr_status) MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa)); - std::string const meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); + std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); MEDFileUMeshL2::WriteCoords(fid,meshName,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords,_global_num_coords); - for(const auto & _m : _ms) - if(_m.isNotNull()) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) + if(it->isNotNull()) { - _m->checkCoordsConsistency(coo); - _m->write(fid,meshName,mdim); + (*it)->checkCoordsConsistency(coo); + (*it)->write(fid,meshName,mdim); } MEDFileUMeshL2::WriteFamiliesAndGrps(fid,meshName,_families,_groups,_too_long_str); } @@ -3222,8 +3192,8 @@ std::vector MEDFileUMesh::getNonEmptyLevels() const { std::vector ret; int lev=0; - for(auto it=_ms.begin();it!=_ms.end();it++,lev--) - if((const MEDFileUMeshSplitL1 *)(*it)!=nullptr) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) + if((const MEDFileUMeshSplitL1 *)(*it)!=0) if(!(*it)->empty()) ret.push_back(lev); return ret; @@ -3253,7 +3223,7 @@ std::vector MEDFileUMesh::getFamArrNonEmptyLevelsExt() const if(famCoo) ret.push_back(1); int lev=0; - for(auto it=_ms.begin();it!=_ms.end();it++,lev--) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) { const MEDFileUMeshSplitL1 *cur(*it); if(cur) @@ -3269,7 +3239,7 @@ std::vector MEDFileUMesh::getNumArrNonEmptyLevelsExt() const if(_num_coords.isNotNull()) ret.push_back(1); int lev=0; - for(auto it=_ms.begin();it!=_ms.end();it++,lev--) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) { const MEDFileUMeshSplitL1 *cur(*it); if(cur) @@ -3286,7 +3256,7 @@ std::vector MEDFileUMesh::getNameArrNonEmptyLevelsExt() const if(nameCoo) ret.push_back(1); int lev=0; - for(auto it=_ms.begin();it!=_ms.end();it++,lev--) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) { const MEDFileUMeshSplitL1 *cur(*it); if(cur) @@ -3305,11 +3275,11 @@ std::vector MEDFileUMesh::getNameArrNonEmptyLevelsExt() const std::vector MEDFileUMesh::getFamsNonEmptyLevels(const std::vector& fams) const { std::vector ret; - std::vector const levs(getNonEmptyLevels()); - std::vector const famIds(getFamiliesIds(fams)); - for(int lev : levs) - if(_ms[-lev]->presenceOfOneFams(famIds)) - ret.push_back(lev); + std::vector levs(getNonEmptyLevels()); + std::vector famIds(getFamiliesIds(fams)); + for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) + if(_ms[-(*it)]->presenceOfOneFams(famIds)) + ret.push_back(*it); return ret; } @@ -3324,7 +3294,7 @@ std::vector MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector const famIds(getFamiliesIds(fams)); + std::vector famIds(getFamiliesIds(fams)); if(famCoords->presenceOfValue(famIds)) { std::vector ret(ret0.size()+1); @@ -3341,17 +3311,17 @@ mcIdType MEDFileUMesh::getMaxAbsFamilyIdInArrays() const mcIdType ret=-std::numeric_limits::max(),tmp=-1; if((const DataArrayIdType *)_fam_coords) { - mcIdType const val=_fam_coords->getMaxValue(tmp); + mcIdType val=_fam_coords->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } - for(const auto & _m : _ms) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { - if((const MEDFileUMeshSplitL1 *)_m) + if((const MEDFileUMeshSplitL1 *)(*it)) { - const DataArrayIdType *da=_m->getFamilyField(); + const DataArrayIdType *da=(*it)->getFamilyField(); if(da) { - mcIdType const val=da->getMaxValue(tmp); + mcIdType val=da->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } } @@ -3364,17 +3334,17 @@ mcIdType MEDFileUMesh::getMaxFamilyIdInArrays() const mcIdType ret=-std::numeric_limits::max(),tmp=-1; if((const DataArrayIdType *)_fam_coords) { - mcIdType const val=_fam_coords->getMaxValue(tmp); + mcIdType val=_fam_coords->getMaxValue(tmp); ret=std::max(ret,val); } - for(const auto & _m : _ms) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { - if((const MEDFileUMeshSplitL1 *)_m) + if((const MEDFileUMeshSplitL1 *)(*it)) { - const DataArrayIdType *da=_m->getFamilyField(); + const DataArrayIdType *da=(*it)->getFamilyField(); if(da) { - mcIdType const val=da->getMaxValue(tmp); + mcIdType val=da->getMaxValue(tmp); ret=std::max(ret,val); } } @@ -3387,17 +3357,17 @@ mcIdType MEDFileUMesh::getMinFamilyIdInArrays() const mcIdType ret=std::numeric_limits::max(),tmp=-1; if((const DataArrayIdType *)_fam_coords) { - mcIdType const val=_fam_coords->getMinValue(tmp); + mcIdType val=_fam_coords->getMinValue(tmp); ret=std::min(ret,val); } - for(const auto & _m : _ms) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { - if((const MEDFileUMeshSplitL1 *)_m) + if((const MEDFileUMeshSplitL1 *)(*it)) { - const DataArrayIdType *da=_m->getFamilyField(); + const DataArrayIdType *da=(*it)->getFamilyField(); if(da) { - mcIdType const val=da->getMinValue(tmp); + mcIdType val=da->getMinValue(tmp); ret=std::min(ret,val); } } @@ -3413,8 +3383,8 @@ mcIdType MEDFileUMesh::getMinFamilyIdInArrays() const int MEDFileUMesh::getMeshDimension() const { int lev=0; - for(auto it=_ms.begin();it!=_ms.end();it++,lev++) - if((const MEDFileUMeshSplitL1 *)(*it)!=nullptr) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev++) + if((const MEDFileUMeshSplitL1 *)(*it)!=0) return (*it)->getMeshDimension()+lev; throw INTERP_KERNEL::Exception("MEDFileUMesh::getMeshDimension : impossible to find a mesh dimension !"); } @@ -3455,7 +3425,7 @@ std::string MEDFileUMesh::simpleRepr() const oss << _coords->getNumberOfTuples() << std::endl; else oss << MSG1 << std::endl; - std::size_t const nbOfLev=_ms.size(); + std::size_t nbOfLev=_ms.size(); oss << "- Number of levels allocated : " << nbOfLev << std::endl; for(std::size_t i=0;i& nodesFetched) const { - std::size_t const sz(st.getNumberOfItems()); + std::size_t sz(st.getNumberOfItems()); for(std::size_t i=0;icomputeNodeIdsAlg(nodesFetched); @@ -3638,9 +3608,9 @@ MEDFileMesh *MEDFileUMesh::cartesianize() const if(!coords) throw INTERP_KERNEL::Exception("MEDFileUMesh::cartesianize : coordinates are null !"); MCAuto coordsCart(_coords->cartesianize(getAxisType())); - for(auto & _m : ret->_ms) - if((const MEDFileUMeshSplitL1 *)_m) - _m=_m->shallowCpyUsingCoords(coordsCart); + for(std::vector< MCAuto >::iterator it=ret->_ms.begin();it!=ret->_ms.end();it++) + if((const MEDFileUMeshSplitL1 *)(*it)) + *it=(*it)->shallowCpyUsingCoords(coordsCart); ret->_coords=coordsCart; ret->setAxisType(AX_CART); return ret.retn(); @@ -3649,8 +3619,8 @@ MEDFileMesh *MEDFileUMesh::cartesianize() const bool MEDFileUMesh::presenceOfStructureElements() const { - for(const auto & it : _elt_str) - if(it.isNotNull()) + for(std::vector< MCAuto >::const_iterator it=_elt_str.begin();it!=_elt_str.end();it++) + if((*it).isNotNull()) return true; return false; } @@ -3692,7 +3662,7 @@ DataArrayDouble *MEDFileUMesh::getCoords() const { return tmp; } - return nullptr; + return 0; } /*! @@ -3736,7 +3706,7 @@ MEDCouplingUMesh *MEDFileUMesh::getGroups(int meshDimRelToMaxExt, const std::vec { checkCartesian(); synchronizeTinyInfoOnLeaves(); - std::vector const fams2=getFamiliesOnGroups(grps); + std::vector fams2=getFamiliesOnGroups(grps); MCAuto zeRet=getFamilies(meshDimRelToMaxExt,fams2,renum); if(grps.size()==1 && ((MEDCouplingUMesh *)zeRet)) zeRet->setName(grps[0]); @@ -3798,7 +3768,7 @@ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::v if(!famIds.empty()) zeRet=l1->getFamilyPart(&famIds[0],&famIds[0]+famIds.size(),renum); else - zeRet=l1->getFamilyPart(nullptr,nullptr,renum); + zeRet=l1->getFamilyPart(0,0,renum); if(fams.size()==1 && ((MEDCouplingUMesh *)zeRet)) zeRet->setName(fams[0]); return zeRet.retn(); @@ -3827,7 +3797,7 @@ DataArrayIdType *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std: if(!famIds.empty()) da=_fam_coords->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else - da=_fam_coords->findIdsEqualList(nullptr,nullptr); + da=_fam_coords->findIdsEqualList(0,0); if(renum) return MEDFileUMeshSplitL1::Renumber(_num_coords,da); else @@ -3844,7 +3814,7 @@ DataArrayIdType *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std: if(!famIds.empty()) return l1->getFamilyPartArr(&famIds[0],&famIds[0]+famIds.size(),renum); else - return l1->getFamilyPartArr(nullptr,nullptr,renum); + return l1->getFamilyPartArr(0,0,renum); } /*! @@ -3869,7 +3839,7 @@ MEDCouplingUMesh *MEDFileUMesh::getMeshAtLevel(int meshDimRelToMaxExt, bool renu if(!renum) { MEDCouplingUMesh *umesh=MEDCouplingUMesh::New(); - MCAuto const cc=_coords->deepCopy(); + MCAuto cc=_coords->deepCopy(); umesh->setCoords(cc); MEDFileUMeshSplitL1::ClearNonDiscrAttributes(umesh); umesh->setName(getName()); @@ -3944,9 +3914,9 @@ MEDCouplingUMesh *MEDFileUMesh::getLevelM3Mesh(bool renum) const */ void MEDFileUMesh::declarePartsUpdated() const { - for(const auto & _m : _ms) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { - const MEDFileUMeshSplitL1 *elt(_m); + const MEDFileUMeshSplitL1 *elt(*it); if(elt) elt->declarePartsUpdated(); } @@ -3962,9 +3932,9 @@ void MEDFileUMesh::declarePartsUpdated() const */ void MEDFileUMesh::forceComputationOfParts() const { - for(const auto & _m : _ms) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { - const MEDFileUMeshSplitL1 *elt(_m); + const MEDFileUMeshSplitL1 *elt(*it); if(elt) elt->forceComputationOfParts(); } @@ -3992,7 +3962,7 @@ MEDCoupling1GTUMesh *MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh(INTERP_ { checkCartesian(); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(gt)); - int const lev=(int)cm.getDimension()-getMeshDimension(); + int lev=(int)cm.getDimension()-getMeshDimension(); const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe(lev)); return sp->getDirectUndergroundSingleGeoTypeMesh(gt); } @@ -4008,13 +3978,13 @@ std::vector< std::pair > MEDFileUMesh::getAllDistributionOfTypes() { std::vector< std::pair > ret; std::vector nel(getNonEmptyLevels()); - for(auto it=nel.rbegin();it!=nel.rend();it++) + for(std::vector::reverse_iterator it=nel.rbegin();it!=nel.rend();it++) { - std::vector const gt(getGeoTypesAtLevel(*it)); - for(auto it1 : gt) + std::vector gt(getGeoTypesAtLevel(*it)); + for(std::vector::const_iterator it1=gt.begin();it1!=gt.end();it1++) { - mcIdType const nbCells(getNumberOfCellsWithType(it1)); - ret.push_back(std::pair(it1,nbCells)); + mcIdType nbCells(getNumberOfCellsWithType(*it1)); + ret.push_back(std::pair(*it1,nbCells)); } } ret.push_back(std::pair(INTERP_KERNEL::NORM_ERROR,getNumberOfNodes())); @@ -4048,7 +4018,7 @@ mcIdType MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellTyp DataArrayIdType *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt); - int const lev=(int)cm.getDimension()-getMeshDimension(); + int lev=(int)cm.getDimension()-getMeshDimension(); const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe(lev)); return sp->extractFamilyFieldOnGeoType(gt); } @@ -4063,7 +4033,7 @@ DataArrayIdType *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::Normal DataArrayIdType *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt); - int const lev=(int)cm.getDimension()-getMeshDimension(); + int lev=(int)cm.getDimension()-getMeshDimension(); const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe(lev)); return sp->extractNumberFieldOnGeoType(gt); } @@ -4075,7 +4045,7 @@ DataArrayIdType *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::Normal int MEDFileUMesh::getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt); - int const ret((int)cm.getDimension()-getMeshDimension()); + int ret((int)cm.getDimension()-getMeshDimension()); getMeshAtLevSafe(ret);//To test that returned value corresponds to a valid level. return ret; } @@ -4086,10 +4056,10 @@ const MEDFileUMeshSplitL1 *MEDFileUMesh::getMeshAtLevSafe(int meshDimRelToMaxExt throw INTERP_KERNEL::Exception("Dimension request is invalid : asking for node level (1) !"); if(meshDimRelToMaxExt>1) throw INTERP_KERNEL::Exception("Dimension request is invalid (>1) !"); - int const tracucedRk=-meshDimRelToMaxExt; + int tracucedRk=-meshDimRelToMaxExt; if(tracucedRk>=(int)_ms.size()) throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !"); - if((const MEDFileUMeshSplitL1 *)_ms[tracucedRk]==nullptr) + if((const MEDFileUMeshSplitL1 *)_ms[tracucedRk]==0) throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !"); return _ms[tracucedRk]; } @@ -4100,10 +4070,10 @@ MEDFileUMeshSplitL1 *MEDFileUMesh::getMeshAtLevSafe(int meshDimRelToMaxExt) throw INTERP_KERNEL::Exception("Dimension request is invalid : asking for node level (1) !"); if(meshDimRelToMaxExt>1) throw INTERP_KERNEL::Exception("Dimension request is invalid (>1) !"); - int const tracucedRk=-meshDimRelToMaxExt; + int tracucedRk=-meshDimRelToMaxExt; if(tracucedRk>=(int)_ms.size()) throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !"); - if((const MEDFileUMeshSplitL1 *)_ms[tracucedRk]==nullptr) + if((const MEDFileUMeshSplitL1 *)_ms[tracucedRk]==0) throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !"); return _ms[tracucedRk]; } @@ -4113,11 +4083,11 @@ void MEDFileUMesh::checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const if(-meshDimRelToMax>=(int)_ms.size()) throw INTERP_KERNEL::Exception("MEDFileUMesh::checkMeshDimCoherency : The meshdim of mesh is not managed by 'this' !"); int i=0; - for(auto it=_ms.begin();it!=_ms.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++) { - if(((const MEDFileUMeshSplitL1*) (*it))!=nullptr) + if(((const MEDFileUMeshSplitL1*) (*it))!=0) { - int const ref=(*it)->getMeshDimension(); + int ref=(*it)->getMeshDimension(); if(ref+i!=meshDim-meshDimRelToMax) throw INTERP_KERNEL::Exception("MEDFileUMesh::checkMeshDimCoherency : no coherency between levels !"); } @@ -4136,15 +4106,15 @@ void MEDFileUMesh::setCoords(DataArrayDouble *coords) if(coords==(DataArrayDouble *)_coords) return ; coords->checkAllocated(); - mcIdType const nbOfTuples(coords->getNumberOfTuples()); + mcIdType nbOfTuples(coords->getNumberOfTuples()); _coords.takeRef(coords); _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfTuples,1); _fam_coords->fillWithZero(); _num_coords.nullify(); _rev_num_coords.nullify(); _name_coords.nullify(); _global_num_coords.nullify(); - for(auto & _m : _ms) - if((MEDFileUMeshSplitL1 *)_m) - _m->setCoords(coords); + for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) + if((MEDFileUMeshSplitL1 *)(*it)) + (*it)->setCoords(coords); } /*! @@ -4157,7 +4127,7 @@ void MEDFileUMesh::setCoordsForced(DataArrayDouble *coords) if(coords==(DataArrayDouble *)_coords) return ; coords->checkAllocated(); - mcIdType const nbOfTuples(coords->getNumberOfTuples()); + mcIdType nbOfTuples(coords->getNumberOfTuples()); if(_coords.isNull()) { _coords=coords; @@ -4165,15 +4135,15 @@ void MEDFileUMesh::setCoordsForced(DataArrayDouble *coords) } else { - mcIdType const oldNbTuples(_coords->getNumberOfTuples()); + mcIdType oldNbTuples(_coords->getNumberOfTuples()); if(oldNbTuples!=nbOfTuples) throw INTERP_KERNEL::Exception("MEDFileUMesh::setCoordsForced : number of tuples is not the same -> invoke setCoords instead !"); _coords=coords; coords->incrRef(); } - for(auto & _m : _ms) - if((MEDFileUMeshSplitL1 *)_m) - _m->setCoords(coords); + for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) + if((MEDFileUMeshSplitL1 *)(*it)) + (*it)->setCoords(coords); } /*! @@ -4199,11 +4169,11 @@ void MEDFileUMesh::eraseGroupsAtLevel(int meshDimRelToMaxExt) */ void MEDFileUMesh::optimizeFamilies() { - std::vector const levs=getNonEmptyLevelsExt(); + std::vector levs=getNonEmptyLevelsExt(); std::set allFamsIds; - for(int const lev : levs) + for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { - const DataArrayIdType *ffield=getFamilyFieldAtLevel(lev); + const DataArrayIdType *ffield=getFamilyFieldAtLevel(*it); MCAuto ids=ffield->getDifferentValues(); std::set res; std::set_union(ids->begin(),ids->end(),allFamsIds.begin(),allFamsIds.end(),std::inserter(res,res.begin())); @@ -4215,24 +4185,24 @@ void MEDFileUMesh::optimizeFamilies() if(allFamsIds.find((*it).second)!=allFamsIds.end()) famNamesToKill.insert((*it).first); } - for(const auto & it : famNamesToKill) - _families.erase(it); - std::vector const grpNamesToKill; - for(auto & _group : _groups) + for(std::set::const_iterator it=famNamesToKill.begin();it!=famNamesToKill.end();it++) + _families.erase(*it); + std::vector grpNamesToKill; + for(std::map >::iterator it=_groups.begin();it!=_groups.end();it++) { std::vector tmp; - for(const auto & it2 : _group.second) + for(std::vector::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++) { - if(famNamesToKill.find(it2)==famNamesToKill.end()) - tmp.push_back(it2); + if(famNamesToKill.find(*it2)==famNamesToKill.end()) + tmp.push_back(*it2); } if(!tmp.empty()) - _group.second=tmp; + (*it).second=tmp; else - tmp.push_back(_group.first); + tmp.push_back((*it).first); } - for(const auto & it : grpNamesToKill) - _groups.erase(it); + for(std::vector::const_iterator it=grpNamesToKill.begin();it!=grpNamesToKill.end();it++) + _groups.erase(*it); } /** @@ -4314,9 +4284,9 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : This method works only for mesh defined on level 0 and -1 !"); MUMesh m0=getMeshAtLevel(0); MUMesh m1=getMeshAtLevel(-1); - mcIdType const nbNodes=m0->getNumberOfNodes(); + mcIdType nbNodes=m0->getNumberOfNodes(); MUMesh m11=getGroup(-1,grpNameM1); - DataArrayIdType *tmp00=nullptr, *tmp11=nullptr,*tmp22=nullptr; + DataArrayIdType *tmp00=0, *tmp11=0,*tmp22=0; // !!! The core of the duplication logic is in these 2 methods: // !!! @@ -4330,10 +4300,10 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, // node renumbering of cells in m1 impacted by duplication of node but not in group 'grpNameM1' on level -1 DAInt descTmp0=DataArrayIdType::New(),descITmp0=DataArrayIdType::New(),revDescTmp0=DataArrayIdType::New(),revDescITmp0=DataArrayIdType::New(); MUMesh tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0); - descTmp0=nullptr; descITmp0=nullptr; revDescTmp0=nullptr; revDescITmp0=nullptr; + descTmp0=0; descITmp0=0; revDescTmp0=0; revDescITmp0=0; DAInt cellsInM1ToRenumW2=tmp0Desc->getCellIdsLyingOnNodes(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),false); MUMesh cellsInM1ToRenumW3=static_cast(tmp0Desc->buildPartOfMySelf(cellsInM1ToRenumW2->begin(),cellsInM1ToRenumW2->end(),true)); - DataArrayIdType *cellsInM1ToRenumW4Tmp=nullptr; + DataArrayIdType *cellsInM1ToRenumW4Tmp=0; m1->areCellsIncludedIn(cellsInM1ToRenumW3,2,cellsInM1ToRenumW4Tmp); DAInt cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp); DAInt cellsInM1ToRenumW5=cellsInM1ToRenumW4->findIdsInRange(0,m1->getNumberOfCells()); @@ -4375,7 +4345,7 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, else idd=getMinFamilyId()-1; mcIdType globStart=0,start=0,end,globEnd; - mcIdType const nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples(); + mcIdType nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples(); for(mcIdType i=0;igetIJ(i,0); @@ -4402,7 +4372,7 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, fam=_fam_coords; if(fam) { - mcIdType const newNbOfNodes=getCoords()->getNumberOfTuples(); + mcIdType newNbOfNodes=getCoords()->getNumberOfTuples(); newFam=DataArrayIdType::New(); newFam->alloc(newNbOfNodes,1); newFam->setPartOfValues1(fam,0,nbNodes,1,0,1,1,true); newFam->setPartOfValuesSimple1(0,nbNodes,newNbOfNodes,1,0,1,1); @@ -4411,10 +4381,11 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, _num_coords.nullify(); _rev_num_coords.nullify(); _global_num_coords.nullify(); - for (auto & _m : _ms) + for (std::vector< MCAuto >::iterator it=_ms.begin(); + it != _ms.end(); it++) { - _m->_num = nullptr; - _m->_rev_num = nullptr; + (*it)->_num = 0; + (*it)->_rev_num = 0; } nodesDuplicated=nodeIdsToDuplicate.retn(); cellsModified=cellsToModifyConn0.retn(); @@ -4434,21 +4405,21 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, */ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) { - o2nRenumCell=nullptr; oldCode.clear(); newCode.clear(); + o2nRenumCell=0; oldCode.clear(); newCode.clear(); std::vector levs=getNonEmptyLevels(); bool ret=false; std::vector< const DataArrayIdType* > renumCellsSplited;//same than memorySaverIfThrow std::vector< MCAuto > memorySaverIfThrow;//same than renumCellsSplited only in case of throw mcIdType start=0; mcIdType end=0; - for(auto it=levs.rbegin();it!=levs.rend();it++) + for(std::vector::reverse_iterator it=levs.rbegin();it!=levs.rend();it++) { MCAuto m=getMeshAtLevel(*it); std::vector code1=m->getDistributionOfTypes(); end=PutInThirdComponentOfCodeOffset(code1,start); oldCode.insert(oldCode.end(),code1.begin(),code1.end()); - bool const hasChanged=m->unPolyze(); - DataArrayIdType *fake=nullptr; + bool hasChanged=m->unPolyze(); + DataArrayIdType *fake=0; MCAuto o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER, MEDCouplingUMesh::MEDMEM_ORDER+MEDCouplingUMesh::N_MEDMEM_ORDER,fake); fake->decrRef(); @@ -4497,9 +4468,9 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vectorgetNumberOfTuples()); + mcIdType nbOfNodes(coo->getNumberOfTuples()); std::vector nodeIdsInUse(nbOfNodes,false); - std::vector const neLevs(getNonEmptyLevels()); - for(int const neLev : neLevs) + std::vector neLevs(getNonEmptyLevels()); + for(std::vector::const_iterator lev=neLevs.begin();lev!=neLevs.end();lev++) { - const MEDFileUMeshSplitL1 *zeLev(getMeshAtLevSafe(neLev)); + const MEDFileUMeshSplitL1 *zeLev(getMeshAtLevSafe(*lev)); if(zeLev->isMeshStoredSplitByType()) { - std::vector const ms(zeLev->getDirectUndergroundSingleGeoTypeMeshes()); - for(auto m : ms) - if(m) - m->computeNodeIdsAlg(nodeIdsInUse); + std::vector ms(zeLev->getDirectUndergroundSingleGeoTypeMeshes()); + for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) + if(*it) + (*it)->computeNodeIdsAlg(nodeIdsInUse); } else { @@ -4538,13 +4509,13 @@ DataArrayIdType *MEDFileUMesh::zipCoords() mesh->computeNodeIdsAlg(nodeIdsInUse); } } - auto nbrOfNodesInUse((mcIdType)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true)); + mcIdType nbrOfNodesInUse((mcIdType)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true)); if(nbrOfNodesInUse==nbOfNodes) - return nullptr;//no need to update _part_coords + return 0;//no need to update _part_coords MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfNodes,1); std::transform(nodeIdsInUse.begin(),nodeIdsInUse.end(),ret->getPointer(),MEDLoaderAccVisit1()); MCAuto ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse)); - MCAuto const newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end())); + MCAuto newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end())); MCAuto newFamCoords; MCAuto newNameCoords; if((const DataArrayIdType *)_fam_coords) @@ -4557,12 +4528,12 @@ DataArrayIdType *MEDFileUMesh::zipCoords() if(_name_coords.isNotNull()) newNameCoords=static_cast(_name_coords->selectByTupleIdSafe(ret2->begin(),ret2->end())); _coords=newCoords; _fam_coords=newFamCoords; _num_coords=newNumCoords; _global_num_coords=newGlobalNumCoords; _name_coords=newNameCoords; _rev_num_coords.nullify(); - for(auto & _m : _ms) + for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) { - if((MEDFileUMeshSplitL1*)_m) + if((MEDFileUMeshSplitL1*)*it) { - _m->renumberNodesInConn(ret->begin()); - _m->setCoords(_coords); + (*it)->renumberNodesInConn(ret->begin()); + (*it)->setCoords(_coords); } } // updates _part_coords @@ -4582,7 +4553,7 @@ DataArrayIdType *MEDFileUMesh::zipCoords() */ DataArrayIdType *MEDFileUMesh::computeFetchedNodeIds() const { - std::vector const neLevs(this->getNonEmptyLevels()); + std::vector neLevs(this->getNonEmptyLevels()); std::vector nodesHighlighted(this->getNumberOfNodes(),false); for(auto lev : neLevs) { @@ -4604,21 +4575,21 @@ DataArrayIdType *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map levs(getNonEmptyLevels()); std::vector fetchedNodes(getNumberOfNodes(),false); - for(const auto & it : extractDef) + for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) { - if(it.first>1) + if((*it).first>1) throw INTERP_KERNEL::Exception("MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid key ! Must be <=1 !"); - if(it.second.isNull()) + if((*it).second.isNull()) throw INTERP_KERNEL::Exception("MEDFileUMesh::deduceNodeSubPartFromCellSubPart : presence of a value with null pointer !"); - if(it.first==1) + if((*it).first==1) continue; - if(std::find(levs.begin(),levs.end(),it.first)==levs.end()) + if(std::find(levs.begin(),levs.end(),(*it).first)==levs.end()) { - std::ostringstream oss; oss << "MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid level " << it.first << " ! Not present in this !"; + std::ostringstream oss; oss << "MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid level " << (*it).first << " ! Not present in this !"; throw INTERP_KERNEL::Exception(oss.str()); } - MCAuto m(getMeshAtLevel(it.first)); - MCAuto mPart(m->buildPartOfMySelf(it.second->begin(),it.second->end(),true)); + MCAuto m(getMeshAtLevel((*it).first)); + MCAuto mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true)); mPart->computeNodeIdsAlg(fetchedNodes); } return DataArrayIdType::BuildListOfSwitchedOn(fetchedNodes); @@ -4634,35 +4605,35 @@ MEDFileUMesh *MEDFileUMesh::extractPart(const std::map ret(MEDFileUMesh::New()); ret->setName(getName()); ret->copyFamGrpMapsFrom(*this); std::vector levs(getNonEmptyLevels()); - for(const auto & it : extractDef) + for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) { - if(it.first>1) + if((*it).first>1) throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : invalid key ! Must be <=1 !"); - if(it.second.isNull()) + if((*it).second.isNull()) throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : presence of a value with null pointer !"); - if(it.first==1) + if((*it).first==1) continue; - if(std::find(levs.begin(),levs.end(),it.first)==levs.end()) + if(std::find(levs.begin(),levs.end(),(*it).first)==levs.end()) { - std::ostringstream oss; oss << "MEDFileUMesh::extractPart : invalid level " << it.first << " ! Not present in this !"; + std::ostringstream oss; oss << "MEDFileUMesh::extractPart : invalid level " << (*it).first << " ! Not present in this !"; throw INTERP_KERNEL::Exception(oss.str()); } - MCAuto m(getMeshAtLevel(it.first)); - MCAuto mPart(m->buildPartOfMySelf(it.second->begin(),it.second->end(),true)); - ret->setMeshAtLevel(it.first,mPart); - const DataArrayIdType *fam(getFamilyFieldAtLevel(it.first)),*num(getNumberFieldAtLevel(it.first)); + MCAuto m(getMeshAtLevel((*it).first)); + MCAuto mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true)); + ret->setMeshAtLevel((*it).first,mPart); + const DataArrayIdType *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first)); if(fam) { - MCAuto famPart(fam->selectByTupleIdSafe(it.second->begin(),it.second->end())); - ret->setFamilyFieldArr(it.first,famPart); + MCAuto famPart(fam->selectByTupleIdSafe((*it).second->begin(),(*it).second->end())); + ret->setFamilyFieldArr((*it).first,famPart); } if(num) { - MCAuto numPart(num->selectByTupleIdSafe(it.second->begin(),it.second->end())); - ret->setFamilyFieldArr(it.first,numPart); + MCAuto numPart(num->selectByTupleIdSafe((*it).second->begin(),(*it).second->end())); + ret->setFamilyFieldArr((*it).first,numPart); } } - auto const it2(extractDef.find(1)); + std::map >::const_iterator it2(extractDef.find(1)); if(it2!=extractDef.end()) { const DataArrayDouble *coo(ret->getCoords()); @@ -4682,13 +4653,13 @@ MEDFileUMesh *MEDFileUMesh::extractPart(const std::map numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); ret->setFamilyFieldArr(1,numPart); } - for(const auto & it3 : extractDef) + for(std::map >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++) { - if(it3.first==1) + if((*it3).first==1) continue; - MCAuto m(ret->getMeshAtLevel(it3.first)); + MCAuto m(ret->getMeshAtLevel((*it3).first)); m->renumberNodesInConn(o2nNodes->begin()); - ret->setMeshAtLevel(it3.first,m); + ret->setMeshAtLevel((*it3).first,m); } } return ret.retn(); @@ -4717,35 +4688,35 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p m1D->checkConsistencyLight(); if(m1D->getMeshDimension()!=1) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : input mesh must have a mesh dimension equal to one !"); - mcIdType const nbRep(m1D->getNumberOfCells()); + mcIdType nbRep(m1D->getNumberOfCells()); std::vector levs(getNonEmptyLevels()); - std::vector const grps(getGroupsNames()); + std::vector grps(getGroupsNames()); std::vector< MCAuto > zeList; - DataArrayDouble *coords(nullptr); - std::size_t const nbOfLevsOut(levs.size()+1); + DataArrayDouble *coords(0); + std::size_t nbOfLevsOut(levs.size()+1); std::vector< MCAuto > o2ns(nbOfLevsOut); - for(int const lev : levs) + for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { - MCAuto item(getMeshAtLevel(lev)); + MCAuto item(getMeshAtLevel(*lev)); item=item->clone(false); - item->changeSpaceDimension(3+lev,0.);//no problem non const but change DataArrayDouble for coordinates do not alter data + item->changeSpaceDimension(3+(*lev),0.);//no problem non const but change DataArrayDouble for coordinates do not alter data MCAuto tmp(static_cast(m1D->deepCopy())); - tmp->changeSpaceDimension(3+lev,0.); + tmp->changeSpaceDimension(3+(*lev),0.); MCAuto elt(item->buildExtrudedMesh(tmp,policy)); zeList.push_back(elt); - if(lev==0) + if(*lev==0) coords=elt->getCoords(); } if(!coords) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : internal error !"); - for(auto & it : zeList) + for(std::vector< MCAuto >::iterator it=zeList.begin();it!=zeList.end();it++) { - it->setName(getName()); - it->setCoords(coords); + (*it)->setName(getName()); + (*it)->setCoords(coords); } for(std::size_t ii=0;ii!=zeList.size();ii++) { - int const lev(levs[ii]); + int lev(levs[ii]); MCAuto elt(zeList[ii]); if(lev<=-1) { @@ -4776,19 +4747,19 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p // for(std::size_t ii=0;ii!=zeList.size();ii++) { - int const lev(levs[ii]); + int lev(levs[ii]); std::vector< MCAuto > outGrps; std::vector< const DataArrayIdType * > outGrps2; if(lev<=-1) { - for(const auto & grp : grps) + for(std::vector::const_iterator grp=grps.begin();grp!=grps.end();grp++) { - MCAuto grpArr(getGroupArr(lev+1,grp)); + MCAuto grpArr(getGroupArr(lev+1,*grp)); if(!grpArr->empty()) { MCAuto grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy()); - mcIdType const offset0(zeList[ii]->getNumberOfCells()); - mcIdType const offset1(offset0+getNumberOfCellsAtLevel(lev+1)); + mcIdType offset0(zeList[ii]->getNumberOfCells()); + mcIdType offset1(offset0+getNumberOfCellsAtLevel(lev+1)); grpArr1->applyLin(1,offset0); grpArr2->applyLin(1,offset1); std::ostringstream oss; oss << grpArr2->getName() << "_top"; grpArr2->setName(oss.str()); @@ -4800,12 +4771,12 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p } } // - for(const auto & grp : grps) + for(std::vector::const_iterator grp=grps.begin();grp!=grps.end();grp++) { - MCAuto grpArr(getGroupArr(lev,grp)); + MCAuto grpArr(getGroupArr(lev,*grp)); if(!grpArr->empty()) { - mcIdType const nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev)); + mcIdType nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev)); std::vector< MCAuto > grpArrs(nbRep); std::vector< const DataArrayIdType *> grpArrs2(nbRep); for(int iii=0;iii grpArrExt(DataArrayIdType::Aggregate(grpArrs2)); grpArrExt->transformWithIndArr(o2ns[ii]->begin(),o2ns[ii]->end()); - std::ostringstream grpName; grpName << grp << "_extruded"; + std::ostringstream grpName; grpName << *grp << "_extruded"; grpArrExt->setName(grpName.str()); outGrps.push_back(grpArrExt); outGrps2.push_back(grpArrExt); @@ -4825,13 +4796,13 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p } std::vector< MCAuto > outGrps; std::vector< const DataArrayIdType * > outGrps2; - for(const auto & grp : grps) + for(std::vector::const_iterator grp=grps.begin();grp!=grps.end();grp++) { - MCAuto grpArr1(getGroupArr(levs.back(),grp)); + MCAuto grpArr1(getGroupArr(levs.back(),*grp)); if(grpArr1->empty()) continue; MCAuto grpArr2(grpArr1->deepCopy()); - std::ostringstream grpName; grpName << grp << "_top"; + std::ostringstream grpName; grpName << *grp << "_top"; grpArr2->setName(grpName.str()); grpArr2->applyLin(1,getNumberOfCellsAtLevel(levs.back())); outGrps.push_back(grpArr1); outGrps.push_back(grpArr2); @@ -4857,15 +4828,15 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co { checkCartesian(); MCAuto ret(MEDFileUMesh::New()); - mcIdType const initialNbNodes(getNumberOfNodes()); + mcIdType initialNbNodes(getNumberOfNodes()); MCAuto m0Tmp(getMeshAtLevel(0)); MCAuto m0(dynamic_cast(m0Tmp->deepCopy())); { - MCAuto const notUsed(m0->convertLinearCellsToQuadratic(conversionType)); + MCAuto notUsed(m0->convertLinearCellsToQuadratic(conversionType)); } DataArrayDouble *zeCoords(m0->getCoords()); ret->setMeshAtLevel(0,m0); - std::vector const levs(getNonEmptyLevels()); + std::vector levs(getNonEmptyLevels()); const DataArrayIdType *famField(getFamilyFieldAtLevel(0)); if(famField) { @@ -4882,24 +4853,24 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co } ret->copyFamGrpMapsFrom(*this); MCAuto partZeCoords(zeCoords->selectByTupleIdSafeSlice(initialNbNodes,zeCoords->getNumberOfTuples(),1)); - for(int const lev : levs) + for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { - if(lev==0) + if(*lev==0) continue; - MCAuto m1Tmp(getMeshAtLevel(lev)); + MCAuto m1Tmp(getMeshAtLevel(*lev)); MCAuto m1(dynamic_cast(m1Tmp->deepCopy())); if(m1->getMeshDimension()!=0) { { - MCAuto const notUsed(m1->convertLinearCellsToQuadratic(conversionType)); + MCAuto notUsed(m1->convertLinearCellsToQuadratic(conversionType)); }//kill unused notUsed var MCAuto m1Coords(m1->getCoords()->selectByTupleIdSafeSlice(initialNbNodes,m1->getNumberOfNodes(),1)); - DataArrayIdType *b(nullptr); - bool const a(partZeCoords->areIncludedInMe(m1Coords,eps,b)); - MCAuto const bSafe(b); + DataArrayIdType *b(0); + bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b)); + MCAuto bSafe(b); if(!a) { - std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << lev << " problem to identify nodes generated !"; + std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << *lev << " problem to identify nodes generated !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } b->applyLin(1,initialNbNodes); @@ -4909,12 +4880,12 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co m1->renumberNodesInConn(renum->begin()); } m1->setCoords(zeCoords); - ret->setMeshAtLevel(lev,m1); - famField=getFamilyFieldAtLevel(lev); + ret->setMeshAtLevel(*lev,m1); + famField=getFamilyFieldAtLevel(*lev); if(famField) { MCAuto famFieldCpy(famField->deepCopy()); - ret->setFamilyFieldArr(lev,famFieldCpy); + ret->setFamilyFieldArr(*lev,famFieldCpy); } } return ret.retn(); @@ -4940,7 +4911,7 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const m0->zipCoords(); DataArrayDouble *zeCoords(m0->getCoords()); ret->setMeshAtLevel(0,m0); - std::vector const levs(getNonEmptyLevels()); + std::vector levs(getNonEmptyLevels()); const DataArrayIdType *famField(getFamilyFieldAtLevel(0)); if(famField) { @@ -4954,30 +4925,30 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const ret->setFamilyFieldArr(1,fam); } ret->copyFamGrpMapsFrom(*this); - for(int const lev : levs) + for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { - if(lev==0) + if(*lev==0) continue; - MCAuto m1Tmp(getMeshAtLevel(lev)); + MCAuto m1Tmp(getMeshAtLevel(*lev)); MCAuto m1(dynamic_cast(m1Tmp->deepCopy())); m1->convertQuadraticCellsToLinear(); m1->zipCoords(); - DataArrayIdType *b(nullptr); - bool const a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b)); - MCAuto const bSafe(b); + DataArrayIdType *b(0); + bool a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b)); + MCAuto bSafe(b); if(!a) { - std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << lev << " problem to identify nodes generated !"; + std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << *lev << " problem to identify nodes generated !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } m1->renumberNodesInConn(b->begin()); m1->setCoords(zeCoords); - ret->setMeshAtLevel(lev,m1); - famField=getFamilyFieldAtLevel(lev); + ret->setMeshAtLevel(*lev,m1); + famField=getFamilyFieldAtLevel(*lev); if(famField) { MCAuto famFieldCpy(famField->deepCopy()); - ret->setFamilyFieldArr(lev,famFieldCpy); + ret->setFamilyFieldArr(*lev,famFieldCpy); } } return ret.retn(); @@ -5021,7 +4992,7 @@ MCAuto MEDFileUMesh::Aggregate(const std::vectorgetSpaceDimension()),meshDim(ref->getMeshDimension()); - std::vector const levs(ref->getNonEmptyLevels()); + std::vector levs(ref->getNonEmptyLevels()); std::map > m_fam,m_renum; std::map > > m_mesh2; std::map > m_mesh; @@ -5056,7 +5027,7 @@ MCAuto MEDFileUMesh::Aggregate(const std::vector MEDFileUMesh::Aggregate(const std::vector MEDFileUMesh::Aggregate(const std::vector const locMesh(msh->getMeshAtLevel(level)); + MCAuto locMesh(msh->getMeshAtLevel(level)); m_mesh[level].push_back(locMesh); m_mesh2[level].push_back(locMesh); m_renum[level].push_back(msh->getNumberFieldAtLevel(level)); @@ -5161,12 +5132,12 @@ MCAuto MEDFileUMesh::Aggregate(const std::vector ret(MEDFileUMesh::New()); MCAuto coo(DataArrayDouble::Aggregate(coos)); ret->setCoords(coo); - if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayIdType *)nullptr)==fam_coos.end()) + if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayIdType *)0)==fam_coos.end()) { MCAuto fam_coo(DataArrayIdType::Aggregate(fam_coos)); ret->setFamilyFieldArr(1,fam_coo); } - if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayIdType *)nullptr)==num_coos.end()) + if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayIdType *)0)==num_coos.end()) { MCAuto num_coo(DataArrayIdType::Aggregate(num_coos)); ret->setRenumFieldArr(1,num_coo); @@ -5217,7 +5188,7 @@ MEDCouplingMappedExtrudedMesh *MEDFileUMesh::convertToExtrudedMesh() const MCAuto m3D(getMeshAtLevel(0)),m2D(getMeshAtLevel(-1)); if(m3D.isNull() || m2D.isNull()) throw INTERP_KERNEL::Exception("MEDFileUMesh::convertToExtrudedMesh : this must be defined both at level 0 and level -1 !"); - mcIdType const zeId(std::numeric_limits::max()-getFamilyId(GetSpeStr4ExtMesh())); + mcIdType zeId(std::numeric_limits::max()-getFamilyId(GetSpeStr4ExtMesh())); MCAuto ret(MEDCouplingMappedExtrudedMesh::New(m3D,m2D,zeId)); return ret.retn(); } @@ -5226,7 +5197,7 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector layer0; layer0.push_back(getAxisType());//0 i layer0.push_back(_order); //1 i @@ -5331,7 +5302,7 @@ void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector& tinyDouble, std::vectorgetNumberOfTuples()); + mcIdType nbOfNodes(coords->getNumberOfTuples()); if(_fam_coords.isNull()) { _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); } // @@ -5419,7 +5390,7 @@ void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) */ void MEDFileUMesh::setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName) { - std::string const oldName=getFamilyNameGivenId(id); + std::string oldName=getFamilyNameGivenId(id); _families.erase(oldName); _families[newFamName]=id; } @@ -5435,8 +5406,8 @@ void MEDFileUMesh::removeMeshAtLevel(int meshDimRelToMax) std::vector::const_iterator it=std::find(levSet.begin(),levSet.end(),meshDimRelToMax); if(it==levSet.end()) throw INTERP_KERNEL::Exception("MEDFileUMesh::removeMeshAtLevel : the requested level is not existing !"); - int const pos=(-meshDimRelToMax); - _ms[pos]=nullptr; + int pos=(-meshDimRelToMax); + _ms[pos]=0; } /*! @@ -5452,7 +5423,7 @@ void MEDFileUMesh::removeMeshAtLevel(int meshDimRelToMax) */ void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m) { - MCAuto const elt(new MEDFileUMeshSplitL1(m)); + MCAuto elt(new MEDFileUMeshSplitL1(m)); checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt; } @@ -5471,7 +5442,7 @@ void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m) */ void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) { - MCAuto const elt(new MEDFileUMeshSplitL1(m,newOrOld)); + MCAuto elt(new MEDFileUMeshSplitL1(m,newOrOld)); checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt; } @@ -5481,7 +5452,7 @@ MCAuto& MEDFileUMesh::checkAndGiveEntryInSplitL1(int meshDi std::vector levSet=getNonEmptyLevels(); if(std::find(levSet.begin(),levSet.end(),meshDimRelToMax)==levSet.end()) { - if((DataArrayDouble *)_coords==nullptr) + if((DataArrayDouble *)_coords==0) { DataArrayDouble *c=m->getCoords(); if(c) @@ -5490,7 +5461,7 @@ MCAuto& MEDFileUMesh::checkAndGiveEntryInSplitL1(int meshDi } if(m->getCoords()!=_coords) throw INTERP_KERNEL::Exception("MEDFileUMesh::setMeshAtLevel : Invalid Given Mesh ! The coordinates are not the same ! try to use tryToShareSameCoords !"); - int const sz=(-meshDimRelToMax)+1; + int sz=(-meshDimRelToMax)+1; if(sz>=(int)_ms.size()) _ms.resize(sz); checkMeshDimCoherency(m->getMeshDimension(),meshDimRelToMax); @@ -5518,7 +5489,7 @@ void MEDFileUMesh::setMeshes(const std::vector& ms, bo const MEDCouplingUMesh *mRef=ms[0]; if(!mRef) throw INTERP_KERNEL::Exception("MEDFileUMesh::setMeshes : null instance in the first element of input meshes !"); - std::string const name(mRef->getName()); + std::string name(mRef->getName()); const DataArrayDouble *coo(mRef->getCoords()); std::set s; int zeDim=-1; @@ -5564,12 +5535,12 @@ void MEDFileUMesh::setGroupsFromScratch(int meshDimRelToMax, const std::vector=(int)_ms.size()) _ms.resize(sz); checkMeshDimCoherency(ms[0]->getMeshDimension(),meshDimRelToMax); DataArrayDouble *coo=checkMultiMesh(ms); - if((DataArrayDouble *)_coords==nullptr) + if((DataArrayDouble *)_coords==0) { coo->incrRef(); _coords=coo; @@ -5608,12 +5579,12 @@ void MEDFileUMesh::setGroupsOnSetMesh(int meshDimRelToMax, const std::vector=(int)_ms.size()) _ms.resize(sz); checkMeshDimCoherency(ms[0]->getMeshDimension(),meshDimRelToMax); DataArrayDouble *coo=checkMultiMesh(ms); - if((DataArrayDouble *)_coords==nullptr) + if((DataArrayDouble *)_coords==0) { coo->incrRef(); _coords=coo; @@ -5626,7 +5597,7 @@ void MEDFileUMesh::setGroupsOnSetMesh(int meshDimRelToMax, const std::vector::const_iterator it=ms.begin();it!=ms.end();it++,i++) { - DataArrayIdType *arr=nullptr; + DataArrayIdType *arr=0; bool test=m->areCellsIncludedIn(*it,_zipconn_pol,arr); corr[i]=arr; if(!test) @@ -5668,7 +5639,7 @@ void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *fa { if(!famArr) { - _fam_coords=nullptr; + _fam_coords=0; return ; } DataArrayDouble *coo(_coords); @@ -5680,10 +5651,10 @@ void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *fa } if(meshDimRelToMaxExt>1) throw INTERP_KERNEL::Exception("MEDFileUMesh::setFamilyFieldArr : Dimension request is invalid (>1) !"); - int const traducedRk=-meshDimRelToMaxExt; + int traducedRk=-meshDimRelToMaxExt; if(traducedRk>=(int)_ms.size()) throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !"); - if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==nullptr) + if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==0) throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !"); return _ms[traducedRk]->setFamilyArr(famArr); } @@ -5713,10 +5684,10 @@ void MEDFileUMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *ren } if(meshDimRelToMaxExt>1) throw INTERP_KERNEL::Exception("MEDFileUMesh::setRenumArr : Dimension request is invalid (>1) !"); - int const traducedRk=-meshDimRelToMaxExt; + int traducedRk=-meshDimRelToMaxExt; if(traducedRk>=(int)_ms.size()) throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !"); - if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==nullptr) + if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==0) throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !"); return _ms[traducedRk]->setRenumArr(renumArr); } @@ -5734,7 +5705,7 @@ void MEDFileUMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiCha { if(!nameArr) { - _name_coords=nullptr; + _name_coords=0; return ; } DataArrayDouble *coo(_coords); @@ -5746,10 +5717,10 @@ void MEDFileUMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiCha } if(meshDimRelToMaxExt>1) throw INTERP_KERNEL::Exception("MEDFileUMesh::setNameFieldAtLevel : Dimension request is invalid (>1) !"); - int const traducedRk=-meshDimRelToMaxExt; + int traducedRk=-meshDimRelToMaxExt; if(traducedRk>=(int)_ms.size()) throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! Too low !"); - if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==nullptr) + if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==0) throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !"); return _ms[traducedRk]->setNameArr(nameArr); } @@ -5812,7 +5783,7 @@ void MEDFileUMesh::computeRevNum() const if(_num_coords.isNotNull()) { mcIdType pos; - mcIdType const maxValue=_num_coords->getMaxValue(pos); + mcIdType maxValue=_num_coords->getMaxValue(pos); _rev_num_coords=_num_coords->invertArrayN2O2O2N(maxValue+1); } } @@ -5845,17 +5816,17 @@ mcIdType MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const mcIdType ret=-std::numeric_limits::max(),tmp=-1; if((const DataArrayIdType *)_fam_nodes) { - mcIdType const val=_fam_nodes->getMaxValue(tmp); + mcIdType val=_fam_nodes->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } if((const DataArrayIdType *)_fam_cells) { - mcIdType const val=_fam_cells->getMaxValue(tmp); + mcIdType val=_fam_cells->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } if((const DataArrayIdType *)_fam_faces) { - mcIdType const val=_fam_faces->getMaxValue(tmp); + mcIdType val=_fam_faces->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } return ret; @@ -5866,17 +5837,17 @@ mcIdType MEDFileStructuredMesh::getMaxFamilyIdInArrays() const mcIdType ret=-std::numeric_limits::max(),tmp=-1; if((const DataArrayIdType *)_fam_nodes) { - mcIdType const val=_fam_nodes->getMaxValue(tmp); + mcIdType val=_fam_nodes->getMaxValue(tmp); ret=std::max(ret,val); } if((const DataArrayIdType *)_fam_cells) { - mcIdType const val=_fam_cells->getMaxValue(tmp); + mcIdType val=_fam_cells->getMaxValue(tmp); ret=std::max(ret,val); } if((const DataArrayIdType *)_fam_faces) { - mcIdType const val=_fam_faces->getMaxValue(tmp); + mcIdType val=_fam_faces->getMaxValue(tmp); ret=std::max(ret,val); } return ret; @@ -5887,17 +5858,17 @@ mcIdType MEDFileStructuredMesh::getMinFamilyIdInArrays() const mcIdType ret=std::numeric_limits::max(),tmp=-1; if((const DataArrayIdType *)_fam_nodes) { - mcIdType const val=_fam_nodes->getMinValue(tmp); + mcIdType val=_fam_nodes->getMinValue(tmp); ret=std::min(ret,val); } if((const DataArrayIdType *)_fam_cells) { - mcIdType const val=_fam_cells->getMinValue(tmp); + mcIdType val=_fam_cells->getMinValue(tmp); ret=std::min(ret,val); } if((const DataArrayIdType *)_fam_faces) { - mcIdType const val=_fam_faces->getMinValue(tmp); + mcIdType val=_fam_faces->getMinValue(tmp); ret=std::min(ret,val); } return ret; @@ -5907,7 +5878,7 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s { if(!MEDFileMesh::isEqual(other,eps,what)) return false; - const auto *otherC=dynamic_cast(other); + const MEDFileStructuredMesh *otherC=dynamic_cast(other); if(!otherC) { what="Mesh types differ ! This is structured and other is NOT !"; @@ -5915,14 +5886,14 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s } const DataArrayIdType *famc1=_fam_nodes; const DataArrayIdType *famc2=otherC->_fam_nodes; - if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr)) + if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of families arr on nodes ! One is defined and not other !"; return false; } if(famc1) { - bool const ret=famc1->isEqual(*famc2); + bool ret=famc1->isEqual(*famc2); if(!ret) { what="Families arr on nodes differ !"; @@ -5931,14 +5902,14 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s } famc1=_fam_cells; famc2=otherC->_fam_cells; - if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr)) + if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of families arr on cells ! One is defined and not other !"; return false; } if(famc1) { - bool const ret=famc1->isEqual(*famc2); + bool ret=famc1->isEqual(*famc2); if(!ret) { what="Families arr on cells differ !"; @@ -5947,14 +5918,14 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s } famc1=_fam_faces; famc2=otherC->_fam_faces; - if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr)) + if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of families arr on faces ! One is defined and not other !"; return false; } if(famc1) { - bool const ret=famc1->isEqual(*famc2); + bool ret=famc1->isEqual(*famc2); if(!ret) { what="Families arr on faces differ !"; @@ -5963,14 +5934,14 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s } famc1=_num_nodes; famc2=otherC->_num_nodes; - if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr)) + if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of numbering arr on nodes ! One is defined and not other !"; return false; } if(famc1) { - bool const ret=famc1->isEqual(*famc2); + bool ret=famc1->isEqual(*famc2); if(!ret) { what="Numbering arr on nodes differ !"; @@ -5979,14 +5950,14 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s } famc1=_num_cells; famc2=otherC->_num_cells; - if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr)) + if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of numbering arr on cells ! One is defined and not other !"; return false; } if(famc1) { - bool const ret=famc1->isEqual(*famc2); + bool ret=famc1->isEqual(*famc2); if(!ret) { what="Numbering arr on cells differ !"; @@ -5995,14 +5966,14 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s } famc1=_num_faces; famc2=otherC->_num_faces; - if((famc1==nullptr && famc2!=nullptr) || (famc1!=nullptr && famc2==nullptr)) + if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of numbering arr on faces ! One is defined and not other !"; return false; } if(famc1) { - bool const ret=famc1->isEqual(*famc2); + bool ret=famc1->isEqual(*famc2); if(!ret) { what="Numbering arr on faces differ !"; @@ -6011,14 +5982,14 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s } const DataArrayAsciiChar *d1=_names_cells; const DataArrayAsciiChar *d2=otherC->_names_cells; - if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr)) + if((d1==0 && d2!=0) || (d1!=0 && d2==0)) { what="Mismatch of naming arr on cells ! One is defined and not other !"; return false; } if(d1) { - bool const ret=d1->isEqual(*d2); + bool ret=d1->isEqual(*d2); if(!ret) { what="Naming arr on cells differ !"; @@ -6027,14 +5998,14 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s } d1=_names_faces; d2=otherC->_names_faces; - if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr)) + if((d1==0 && d2!=0) || (d1!=0 && d2==0)) { what="Mismatch of naming arr on faces ! One is defined and not other !"; return false; } if(d1) { - bool const ret=d1->isEqual(*d2); + bool ret=d1->isEqual(*d2); if(!ret) { what="Naming arr on faces differ !"; @@ -6043,14 +6014,14 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s } d1=_names_nodes; d2=otherC->_names_nodes; - if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr)) + if((d1==0 && d2!=0) || (d1!=0 && d2==0)) { what="Mismatch of naming arr on nodes ! One is defined and not other !"; return false; } if(d1) { - bool const ret=d1->isEqual(*d2); + bool ret=d1->isEqual(*d2); if(!ret) { what="Naming arr on nodes differ !"; @@ -6108,7 +6079,7 @@ DataArrayIdType *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, c if(!famIds.empty()) da=_fam_nodes->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else - da=_fam_nodes->findIdsEqualList(nullptr,nullptr); + da=_fam_nodes->findIdsEqualList(0,0); if(renum) return MEDFileUMeshSplitL1::Renumber(_num_nodes,da); else @@ -6126,7 +6097,7 @@ DataArrayIdType *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, c if(!famIds.empty()) da=_fam_cells->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else - da=_fam_cells->findIdsEqualList(nullptr,nullptr); + da=_fam_cells->findIdsEqualList(0,0); if(renum) return MEDFileUMeshSplitL1::Renumber(_num_cells,da); else @@ -6144,7 +6115,7 @@ DataArrayIdType *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, c if(!famIds.empty()) da=_fam_faces->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else - da=_fam_faces->findIdsEqualList(nullptr,nullptr); + da=_fam_faces->findIdsEqualList(0,0); if(renum) return MEDFileUMeshSplitL1::Renumber(_num_faces,da); else @@ -6178,7 +6149,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI { case 0: { - mcIdType const nbCells(mesh->getNumberOfCells()); + mcIdType nbCells(mesh->getNumberOfCells()); if(famArr) famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of cells of mesh !"); _fam_cells=famArr; @@ -6186,7 +6157,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI } case 1: { - mcIdType const nbNodes(mesh->getNumberOfNodes()); + mcIdType nbNodes(mesh->getNumberOfNodes()); if(famArr) famArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !"); _fam_nodes=famArr; @@ -6194,7 +6165,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI } case -1: { - mcIdType const nbCells(mesh->getNumberOfCellsOfSubLevelMesh()); + mcIdType nbCells(mesh->getNumberOfCellsOfSubLevelMesh()); if(famArr) famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of faces of mesh !"); _fam_faces=famArr; @@ -6224,21 +6195,21 @@ void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayId { case 0: { - mcIdType const nbCells=mesh->getNumberOfCells(); + mcIdType nbCells=mesh->getNumberOfCells(); renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of cells of mesh !"); _num_cells=renumArr; break; } case 1: { - mcIdType const nbNodes=mesh->getNumberOfNodes(); + mcIdType nbNodes=mesh->getNumberOfNodes(); renumArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !"); _num_nodes=renumArr; break; } case -1: { - mcIdType const nbCells=mesh->getNumberOfCellsOfSubLevelMesh(); + mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh(); renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of faces of mesh !"); _num_faces=renumArr; break; @@ -6266,21 +6237,21 @@ void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArra { case 0: { - mcIdType const nbCells=mesh->getNumberOfCells(); + mcIdType nbCells=mesh->getNumberOfCells(); nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of cells of mesh !"); _names_cells=nameArr; break; } case 1: { - mcIdType const nbNodes=mesh->getNumberOfNodes(); + mcIdType nbNodes=mesh->getNumberOfNodes(); nameArr->checkNbOfTuplesAndComp(nbNodes,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of nodes of mesh !"); _names_nodes=nameArr; break; } case -1: { - mcIdType const nbCells=mesh->getNumberOfCellsOfSubLevelMesh(); + mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh(); nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of faces of mesh !"); _names_faces=nameArr; break; @@ -6292,7 +6263,7 @@ void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArra nameArr->incrRef(); } -void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int /*meshDimRelToMaxExt*/, DataArrayIdType * /*globalNumArr*/) +void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) { throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setGlobalNumFieldAtLevel : not implemented yet !"); } @@ -6422,7 +6393,7 @@ const DataArrayIdType *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshD if((const DataArrayIdType *)_num_cells) { mcIdType pos; - mcIdType const maxValue=_num_cells->getMaxValue(pos); + mcIdType maxValue=_num_cells->getMaxValue(pos); _rev_num_cells=_num_cells->invertArrayN2O2O2N(maxValue+1); return _rev_num_cells; } @@ -6434,7 +6405,7 @@ const DataArrayIdType *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshD if((const DataArrayIdType *)_num_nodes) { mcIdType pos; - mcIdType const maxValue=_num_nodes->getMaxValue(pos); + mcIdType maxValue=_num_nodes->getMaxValue(pos); _rev_num_nodes=_num_nodes->invertArrayN2O2O2N(maxValue+1); return _rev_num_nodes; } @@ -6458,7 +6429,7 @@ const DataArrayAsciiChar *MEDFileStructuredMesh::getNameFieldAtLevel(int meshDim } } -MCAuto MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int /*meshDimRelToMaxExt*/) const +MCAuto MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const { throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !"); } @@ -6537,7 +6508,7 @@ std::vector MEDFileStructuredMesh::getNameArrNonEmptyLevelsExt() const */ bool MEDFileStructuredMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) { - oldCode.clear(); newCode.clear(); o2nRenumCell=nullptr; + oldCode.clear(); newCode.clear(); o2nRenumCell=0; return false; } @@ -6764,7 +6735,7 @@ void MEDFileStructuredMesh::buildImplicitPart() const void MEDFileStructuredMesh::releaseImplicitPartIfAny() const { - _faces_if_necessary=nullptr; + _faces_if_necessary=0; } /*! @@ -6793,7 +6764,7 @@ std::vector MEDFileStructuredMesh::getGeoType } case -1: { - int const mdim(cmesh->getMeshDimension()); + int mdim(cmesh->getMeshDimension()); if(mdim<1) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGeoTypesAtLevel : only one level available for structured meshes ! Input 0 is mandatory or 0D mesh !"); std::vector ret(1,MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(mdim-1)); @@ -6828,10 +6799,10 @@ void MEDFileStructuredMesh::whichAreNodesFetched(const MEDFileField1TSStructItem const DataArrayIdType *arr(globs->getProfile(st[0].getPflName())); const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before mcIdType sz(ToIdType(nodesFetched.size())); - for(long const work : *arr) + for(const mcIdType *work=arr->begin();work!=arr->end();work++) { std::vector conn; - cmesh->getNodeIdsOfCell(work,conn); + cmesh->getNodeIdsOfCell(*work,conn); for(std::vector::const_iterator it=conn.begin();it!=conn.end();it++) if(*it>=0 && *it& famCells, MCAuto& numCells, MCAuto& namesCells) { med_bool chgt=MED_FALSE,trsf=MED_FALSE; - med_geometry_type const geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim); + med_geometry_type geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim); mcIdType nbOfElt(0); nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf); if(nbOfElt>0) @@ -6903,7 +6874,7 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt { if(!mrs || mrs->isNodeFamilyFieldReading()) { - mcIdType const nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); if(nbOfElt>nbNodes) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::loadStrMeshFromFile : invalid size of family node array regarding number of nodes in this ! File seems to be corrupted !"); MCAuto miFamNodes=DataArrayMedInt::New(); @@ -6936,7 +6907,7 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt _names_nodes->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end } } - int const meshDim(getStructuredMesh()->getMeshDimension()); + int meshDim(getStructuredMesh()->getMeshDimension()); LoadStrMeshDAFromFile(fid,meshDim,dt,it,mName,mrs,_fam_cells,_num_cells,_names_cells); if(meshDim>=1) LoadStrMeshDAFromFile(fid,meshDim-1,dt,it,mName,mrs,_fam_faces,_num_faces,_names_faces); @@ -6944,7 +6915,7 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& maa) const { - int const meshDim(getStructuredMesh()->getMeshDimension()); + int meshDim(getStructuredMesh()->getMeshDimension()); med_geometry_type geoTypeReq(GetGeoTypeFromMeshDim(meshDim)),geoTypeReq2(GetGeoTypeFromMeshDim(meshDim-1)); // if((const DataArrayIdType *)_fam_cells) @@ -7015,7 +6986,7 @@ MEDFileCMesh *MEDFileCMesh::New() */ MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,mrs); } @@ -7040,7 +7011,7 @@ MEDFileCMesh *MEDFileCMesh::New(med_idt fid, MEDFileMeshReadSelector *mrs) */ MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,mName,dt,it,mrs); } @@ -7135,7 +7106,7 @@ bool MEDFileCMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh { if(!MEDFileStructuredMesh::isEqual(other,eps,what)) return false; - const auto *otherC=dynamic_cast(other); + const MEDFileCMesh *otherC=dynamic_cast(other); if(!otherC) { what="Mesh types differ ! This is cartesian and other is NOT !"; @@ -7145,14 +7116,14 @@ bool MEDFileCMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh otherC->clearNonDiscrAttributes(); const MEDCouplingCMesh *coo1=_cmesh; const MEDCouplingCMesh *coo2=otherC->_cmesh; - if((coo1==nullptr && coo2!=nullptr) || (coo1!=nullptr && coo2==nullptr)) + if((coo1==0 && coo2!=0) || (coo1!=0 && coo2==0)) { what="Mismatch of cartesian meshes ! One is defined and not other !"; return false; } if(coo1) { - bool const ret=coo1->isEqual(coo2,eps); + bool ret=coo1->isEqual(coo2,eps); if(!ret) { what="cartesian meshes differ !"; @@ -7172,7 +7143,8 @@ void MEDFileCMesh::clearNonDiscrAttributes() const } MEDFileCMesh::MEDFileCMesh() -= default; +{ +} MEDFileCMesh::MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) try @@ -7266,12 +7238,12 @@ void MEDFileCMesh::writeMeshLL(med_idt fid) const MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str); MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str); MEDLoaderBase::safeStrCpy(_dt_unit.c_str(),MED_LNAME_SIZE,dtunit,_too_long_str); - int const spaceDim(_cmesh->getSpaceDimension()); + int spaceDim(_cmesh->getSpaceDimension()); INTERP_KERNEL::AutoPtr comp=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE); for(int i=0;igetCoordsAt(i)->getInfoOnComponent(0)); + std::string info(_cmesh->getCoordsAt(i)->getInfoOnComponent(0)); std::string c,u; MEDLoaderBase::splitIntoNameAndUnit(info,c,u); MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo @@ -7287,7 +7259,7 @@ void MEDFileCMesh::writeMeshLL(med_idt fid) const MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,ToMedInt(da->getNumberOfTuples()),da->getConstPointer())); } // - std::string const meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); + std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); MEDFileStructuredMesh::writeStructuredLL(fid,meshName); } @@ -7314,13 +7286,13 @@ MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(med_idt fid, MEDFileMeshRead MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,mrs); } MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,mName,dt,it,mrs); } @@ -7390,7 +7362,7 @@ bool MEDFileCurveLinearMesh::isEqual(const MEDFileMesh *other, double eps, std:: { if(!MEDFileStructuredMesh::isEqual(other,eps,what)) return false; - const auto *otherC=dynamic_cast(other); + const MEDFileCurveLinearMesh *otherC=dynamic_cast(other); if(!otherC) { what="Mesh types differ ! This is curve linear and other is NOT !"; @@ -7400,14 +7372,14 @@ bool MEDFileCurveLinearMesh::isEqual(const MEDFileMesh *other, double eps, std:: otherC->clearNonDiscrAttributes(); const MEDCouplingCurveLinearMesh *coo1=_clmesh; const MEDCouplingCurveLinearMesh *coo2=otherC->_clmesh; - if((coo1==nullptr && coo2!=nullptr) || (coo1!=nullptr && coo2==nullptr)) + if((coo1==0 && coo2!=0) || (coo1!=0 && coo2==0)) { what="Mismatch of curve linear meshes ! One is defined and not other !"; return false; } if(coo1) { - bool const ret=coo1->isEqual(coo2,eps); + bool ret=coo1->isEqual(coo2,eps); if(!ret) { what="curve linear meshes differ !"; @@ -7480,7 +7452,8 @@ const MEDCouplingStructuredMesh *MEDFileCurveLinearMesh::getStructuredMesh() con } MEDFileCurveLinearMesh::MEDFileCurveLinearMesh() -= default; +{ +} MEDFileCurveLinearMesh::MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) try @@ -7500,8 +7473,8 @@ void MEDFileCurveLinearMesh::writeMeshLL(med_idt fid) const MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str); MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str); MEDLoaderBase::safeStrCpy(_dt_unit.c_str(),MED_LNAME_SIZE,dtunit,_too_long_str); - int const spaceDim=_clmesh->getSpaceDimension(); - int const meshDim=_clmesh->getMeshDimension(); + int spaceDim=_clmesh->getSpaceDimension(); + int meshDim=_clmesh->getMeshDimension(); INTERP_KERNEL::AutoPtr comp=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE); const DataArrayDouble *coords=_clmesh->getCoords(); @@ -7509,7 +7482,7 @@ void MEDFileCurveLinearMesh::writeMeshLL(med_idt fid) const throw INTERP_KERNEL::Exception("MEDFileCurveLinearMesh::writeMeshLL : no coordinates set !"); for(int i=0;igetCoords()->getInfoOnComponent(i)); + std::string info(_clmesh->getCoords()->getInfoOnComponent(i)); std::string c,u; MEDLoaderBase::splitIntoNameAndUnit(info,c,u); MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo @@ -7524,7 +7497,7 @@ void MEDFileCurveLinearMesh::writeMeshLL(med_idt fid) const MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin())); // - std::string const meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); + std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); MEDFileStructuredMesh::writeStructuredLL(fid,meshName); } @@ -7561,7 +7534,7 @@ MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(med_idt fid) MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const std::string& fileName) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid); } @@ -7572,7 +7545,7 @@ MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(med_idt fid, const std::string& mNam MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const std::string& fileName, const std::string& mName) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,mName); } @@ -7662,7 +7635,7 @@ MEDFileJoints * MEDFileMeshMultiTS::getJoints() const { if ( MEDFileMesh* m = getOneTimeStep() ) return m->getJoints(); - return nullptr; + return 0; } /*! @@ -7700,7 +7673,7 @@ void MEDFileMeshMultiTS::writeLL(med_idt fid) const for(std::vector< MCAuto >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) { if ( jointsWritten ) - const_cast(**it).setJoints( nullptr ); + const_cast(**it).setJoints( 0 ); else jointsWritten = true; @@ -7713,18 +7686,19 @@ void MEDFileMeshMultiTS::writeLL(med_idt fid) const void MEDFileMeshMultiTS::loadFromFile(med_idt fid, const std::string& mName) { - MEDFileJoints *joints(nullptr); + MEDFileJoints *joints(0); if ( !_mesh_one_ts.empty() && getOneTimeStep() ) { // joints of mName already read, pass them to MEDFileMesh::New() to prevent repeated reading joints = getOneTimeStep()->getJoints(); } _mesh_one_ts.clear(); //for the moment to be improved - _mesh_one_ts.push_back( MEDFileMesh::New(fid,mName,-1,-1,nullptr, joints )); + _mesh_one_ts.push_back( MEDFileMesh::New(fid,mName,-1,-1,0, joints )); } MEDFileMeshMultiTS::MEDFileMeshMultiTS() -= default; +{ +} MEDFileMeshMultiTS::MEDFileMeshMultiTS(med_idt fid) try @@ -7769,7 +7743,7 @@ MEDFileMeshes *MEDFileMeshes::New(med_idt fid) MEDFileMeshes *MEDFileMeshes::New(const std::string& fileName) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid); } @@ -7907,7 +7881,8 @@ void MEDFileMeshes::loadFromFile(med_idt fid) } MEDFileMeshes::MEDFileMeshes() -= default; +{ +} MEDFileMeshes::MEDFileMeshes(med_idt fid) try @@ -7953,7 +7928,7 @@ std::string MEDFileMeshes::simpleRepr() const void MEDFileMeshes::simpleReprWithoutHeader(std::ostream& oss) const { - int const nbOfMeshes=getNumberOfMeshes(); + int nbOfMeshes=getNumberOfMeshes(); oss << "There are " << nbOfMeshes << " meshes with the following names : \n"; std::vector mns=getMeshesNames(); for(int i=0;igetMeshAtPos(_iter_id++); else - return nullptr; + return 0; } else - return nullptr; + return 0; } INTERP_KERNEL::NormalizedCellType MEDFileMesh::ConvertFromMEDFileGeoType(med_geometry_type geoType) diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 7312faff5..043073d97 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -21,34 +21,15 @@ #ifndef __MEDFILEMESH_HXX__ #define __MEDFILEMESH_HXX__ -#include "MEDCouplingRefCountObject.hxx" -#include "MEDFileUtilities.txx" -#include "MEDCouplingMemArray.hxx" -#include "MCType.hxx" -#include "MEDCouplingMesh.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MEDCoupling1GTUMesh.hxx" -#include "MEDCouplingPointSet.hxx" -#include "MEDCouplingStructuredMesh.hxx" -#include "MEDCouplingCMesh.hxx" -#include "MEDCouplingCurveLinearMesh.hxx" #include "MEDLoaderDefines.hxx" #include "MEDFileMeshLL.hxx" +#include "MEDFileUtilities.txx" #include "MEDCouplingPartDefinition.hxx" #include "MEDFileMeshReadSelector.hxx" #include "MEDFileJoint.hxx" #include "MEDFileEquivalence.hxx" -#include "med.h" -#include "NormalizedGeometricTypes" -#include -#include #include -#include -#include -#include -#include #include #include #include @@ -61,14 +42,14 @@ namespace MEDCoupling class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone { public: - MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=nullptr); - MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=nullptr); + MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT static MEDFileMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } - MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr, MEDFileJoints* joints=nullptr); - MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr, MEDFileJoints* joints=nullptr); - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0, MEDFileJoints* joints=0); + MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0, MEDFileJoints* joints=0); + MEDLOADER_EXPORT void writeLL(med_idt fid) const; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT virtual MEDFileMesh *createNewEmpty() const = 0; MEDLOADER_EXPORT virtual MEDFileMesh *deepCopy() const = 0; MEDLOADER_EXPORT virtual MEDFileMesh *shallowCpy() const = 0; @@ -222,7 +203,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void setJoints( MEDFileJoints* joints ); MEDFileEquivalences *getEquivalences() { return _equiv; } const MEDFileEquivalences *getEquivalences() const { return _equiv; } - void killEquivalences() { _equiv=(MEDFileEquivalences *)nullptr; } + void killEquivalences() { _equiv=(MEDFileEquivalences *)0; } void initializeEquivalences() { _equiv=MEDFileEquivalences::New(this); } MEDLOADER_EXPORT static INTERP_KERNEL::NormalizedCellType ConvertFromMEDFileGeoType(med_geometry_type geoType); MEDLOADER_EXPORT static med_geometry_type ConvertToMEDFileGeoType(INTERP_KERNEL::NormalizedCellType geoType); @@ -247,7 +228,7 @@ namespace MEDCoupling static std::string CreateNameNotIn(const std::string& nameTry, const std::vector& namesToAvoid); static mcIdType PutInThirdComponentOfCodeOffset(std::vector& code, mcIdType strt); void writeJoints(med_idt fid) const; - void loadJointsFromFile(med_idt fid, MEDFileJoints *toUseInstedOfReading=nullptr); + void loadJointsFromFile(med_idt fid, MEDFileJoints *toUseInstedOfReading=0); void loadEquivalences(med_idt fid); void deepCpyEquivalences(const MEDFileMesh& other); bool areEquivalencesEqual(const MEDFileMesh *other, std::string& what) const; @@ -282,10 +263,10 @@ namespace MEDCoupling { friend class MEDFileMesh; public: - MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=nullptr); - MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=nullptr); + MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT static MEDFileUMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem); MEDLOADER_EXPORT static MEDFileUMesh *New(); @@ -294,64 +275,64 @@ namespace MEDCoupling MEDLOADER_EXPORT static MCAuto LoadConnectivityOnlyPartOf(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOfFromUserDistrib(med_idt fid, const std::string& mName, const std::map>& distrib, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); + MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOfFromUserDistrib(med_idt fid, const std::string& mName, const std::map>& distrib, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT static void LoadPartCoords(const std::string& fileName, const std::string& mName, int dt, int it, const std::vector& infosOnComp, mcIdType startNodeId, mcIdType stopNodeId, MCAuto& coords, MCAuto& partCoords, MCAuto& famCoords, MCAuto& numCoords, MCAuto& nameCoords); MEDLOADER_EXPORT static const char *GetSpeStr4ExtMesh() { return SPE_FAM_STR_EXTRUDED_MESH; } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const override; - MEDLOADER_EXPORT MEDFileUMesh *deepCopy() const override; - MEDLOADER_EXPORT MEDFileUMesh *shallowCpy() const override; - MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; + MEDLOADER_EXPORT MEDFileUMesh *deepCopy() const; + MEDLOADER_EXPORT MEDFileUMesh *shallowCpy() const; + MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT void checkConsistency() const; MEDLOADER_EXPORT void checkSMESHConsistency() const; MEDLOADER_EXPORT void clearNodeAndCellNumbers(); - MEDLOADER_EXPORT void clearNonDiscrAttributes() const override; - MEDLOADER_EXPORT void setName(const std::string& name) override; + MEDLOADER_EXPORT void clearNonDiscrAttributes() const; + MEDLOADER_EXPORT void setName(const std::string& name); MEDLOADER_EXPORT const std::vector< MCAuto >& getAccessOfUndergroundEltStrs() const { return _elt_str; } // - MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const override; - MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const override; - MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const override; - MEDLOADER_EXPORT int getMeshDimension() const override; - MEDLOADER_EXPORT int getSpaceDimension() const override; - MEDLOADER_EXPORT std::string simpleRepr() const override; - MEDLOADER_EXPORT std::string advancedRepr() const override; - MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) override; - MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const override; + MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const; + MEDLOADER_EXPORT int getMeshDimension() const; + MEDLOADER_EXPORT int getSpaceDimension() const; + MEDLOADER_EXPORT std::string simpleRepr() const; + MEDLOADER_EXPORT std::string advancedRepr() const; + MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt); + MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT const PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const; - MEDLOADER_EXPORT mcIdType getNumberOfNodes() const override; - MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT bool hasImplicitPart() const override; - MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const override; - MEDLOADER_EXPORT void releaseImplicitPartIfAny() const override; - MEDLOADER_EXPORT std::vector getGeoTypesAtLevel(int meshDimRelToMax) const override; - MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const override; - MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const override; - MEDLOADER_EXPORT MEDFileMesh *cartesianize() const override; - MEDLOADER_EXPORT bool presenceOfStructureElements() const override; - MEDLOADER_EXPORT void killStructureElements() override; - MEDLOADER_EXPORT std::vector getNonEmptyLevels() const override; - MEDLOADER_EXPORT std::vector getNonEmptyLevelsExt() const override; - MEDLOADER_EXPORT std::vector getFamArrNonEmptyLevelsExt() const override; - MEDLOADER_EXPORT std::vector getNumArrNonEmptyLevelsExt() const override; - MEDLOADER_EXPORT std::vector getNameArrNonEmptyLevelsExt() const override; - MEDLOADER_EXPORT std::vector getFamsNonEmptyLevels(const std::vector& fams) const override; - MEDLOADER_EXPORT std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const override; + MEDLOADER_EXPORT mcIdType getNumberOfNodes() const; + MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT bool hasImplicitPart() const; + MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT void releaseImplicitPartIfAny() const; + MEDLOADER_EXPORT std::vector getGeoTypesAtLevel(int meshDimRelToMax) const; + MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; + MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const; + MEDLOADER_EXPORT MEDFileMesh *cartesianize() const; + MEDLOADER_EXPORT bool presenceOfStructureElements() const; + MEDLOADER_EXPORT void killStructureElements(); + MEDLOADER_EXPORT std::vector getNonEmptyLevels() const; + MEDLOADER_EXPORT std::vector getNonEmptyLevelsExt() const; + MEDLOADER_EXPORT std::vector getFamArrNonEmptyLevelsExt() const; + MEDLOADER_EXPORT std::vector getNumArrNonEmptyLevelsExt() const; + MEDLOADER_EXPORT std::vector getNameArrNonEmptyLevelsExt() const; + MEDLOADER_EXPORT std::vector getFamsNonEmptyLevels(const std::vector& fams) const; + MEDLOADER_EXPORT std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; MEDLOADER_EXPORT DataArrayDouble *getCoords() const; MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; - MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const override; - MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const override; - MEDLOADER_EXPORT std::vector getDistributionOfTypes(int meshDimRelToMax) const override; + MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; + MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const; + MEDLOADER_EXPORT std::vector getDistributionOfTypes(int meshDimRelToMax) const; MEDLOADER_EXPORT std::vector< std::pair > getAllDistributionOfTypes() const; MEDLOADER_EXPORT MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const; @@ -370,12 +351,12 @@ MCAuto& coords, MCAuto& partCoords, MCAuto& coords, MCAuto& partCoords, MCAuto> crackAlong(const std::string &grpNameM1, bool grpMustBeFullyDup=true); MEDLOADER_EXPORT void openCrack(const std::map> & c2o2nN, const double & factor); MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated, DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified); - MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) override; + MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell); MEDLOADER_EXPORT DataArrayIdType *zipCoords(); MEDLOADER_EXPORT DataArrayIdType *computeFetchedNodeIds() const; MEDLOADER_EXPORT DataArrayIdType *deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const; @@ -405,21 +386,21 @@ MCAuto& coords, MCAuto& partCoords, MCAuto& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); private: - MEDLOADER_EXPORT ~MEDFileUMesh() override; - void writeMeshLL(med_idt fid) const override; + MEDLOADER_EXPORT ~MEDFileUMesh(); + void writeMeshLL(med_idt fid) const; MEDFileUMesh(); MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, std::function& types, const std::vector&,int,int,MEDFileMeshReadSelector *)> functorOnUMeshL2, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - void loadPartUMeshFromFileFromUserDistrib(med_idt fid, const std::string& mName, const std::map>& distrib, std::function>&,int,int,MEDFileMeshReadSelector *)> functorOnUMeshL2, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) override; + void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, std::function& types, const std::vector&,int,int,MEDFileMeshReadSelector *)> functorOnUMeshL2, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + void loadPartUMeshFromFileFromUserDistrib(med_idt fid, const std::string& mName, const std::map>& distrib, std::function>&,int,int,MEDFileMeshReadSelector *)> functorOnUMeshL2, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); void dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl2, const std::string& mName, MEDFileMeshReadSelector *mrs); const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const; MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt); void checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const; DataArrayDouble *checkMultiMesh(const std::vector& ms) const; - void synchronizeTinyInfoOnLeaves() const override; - void changeFamilyIdArr(mcIdType oldId, mcIdType newId) override; - std::list< MCAuto > getAllNonNullFamilyIds() const override; + void synchronizeTinyInfoOnLeaves() const; + void changeFamilyIdArr(mcIdType oldId, mcIdType newId); + std::list< MCAuto > getAllNonNullFamilyIds() const; MCAuto& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m); static std::vector>> findConnectedComponents( @@ -451,52 +432,52 @@ MCAuto& coords, MCAuto& partCoords, MCAuto getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const override; - MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const override; - MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const override; - MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const override; - MEDLOADER_EXPORT void clearNonDiscrAttributes() const override; - MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const override; - MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) override; - MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr) override; - MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr) override; - MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) override; - MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) override; - MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids) override; - MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) override; - MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT std::vector getNonEmptyLevels() const override; - MEDLOADER_EXPORT std::vector getNonEmptyLevelsExt() const override; - MEDLOADER_EXPORT std::vector getFamArrNonEmptyLevelsExt() const override; - MEDLOADER_EXPORT std::vector getNumArrNonEmptyLevelsExt() const override; - MEDLOADER_EXPORT std::vector getNameArrNonEmptyLevelsExt() const override; - MEDLOADER_EXPORT MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const override; - MEDLOADER_EXPORT std::vector getFamsNonEmptyLevels(const std::vector& fams) const override; - MEDLOADER_EXPORT std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const override; - MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT mcIdType getNumberOfNodes() const override; - MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const override; - MEDLOADER_EXPORT bool hasImplicitPart() const override; - MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const override; - MEDLOADER_EXPORT void releaseImplicitPartIfAny() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const; + MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; + MEDLOADER_EXPORT void clearNonDiscrAttributes() const; + MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; + MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt); + MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr); + MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr); + MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr); + MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr); + MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids); + MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids); + MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT std::vector getNonEmptyLevels() const; + MEDLOADER_EXPORT std::vector getNonEmptyLevelsExt() const; + MEDLOADER_EXPORT std::vector getFamArrNonEmptyLevelsExt() const; + MEDLOADER_EXPORT std::vector getNumArrNonEmptyLevelsExt() const; + MEDLOADER_EXPORT std::vector getNameArrNonEmptyLevelsExt() const; + MEDLOADER_EXPORT MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const; + MEDLOADER_EXPORT std::vector getFamsNonEmptyLevels(const std::vector& fams) const; + MEDLOADER_EXPORT std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; + MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT mcIdType getNumberOfNodes() const; + MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT bool hasImplicitPart() const; + MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT void releaseImplicitPartIfAny() const; MEDLOADER_EXPORT MEDCoupling1SGTUMesh *getImplicitFaceMesh() const; - MEDLOADER_EXPORT std::vector getGeoTypesAtLevel(int meshDimRelToMax) const override; - MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const override; - MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const override; - MEDLOADER_EXPORT bool presenceOfStructureElements() const override { return false; } + MEDLOADER_EXPORT std::vector getGeoTypesAtLevel(int meshDimRelToMax) const; + MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; + MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const; + MEDLOADER_EXPORT bool presenceOfStructureElements() const { return false; } MEDLOADER_EXPORT virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0; // tools - MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) override; + MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell); protected: - ~MEDFileStructuredMesh() override = default; - void changeFamilyIdArr(mcIdType oldId, mcIdType newId) override; - std::list< MCAuto > getAllNonNullFamilyIds() const override; + ~MEDFileStructuredMesh() { } + void changeFamilyIdArr(mcIdType oldId, mcIdType newId); + std::list< MCAuto > getAllNonNullFamilyIds() const; void deepCpyAttributes(); void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); void writeStructuredLL(med_idt fid, const std::string& maa) const; @@ -526,34 +507,34 @@ MCAuto& coords, MCAuto& partCoords, MCAuto(db); } - MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - MEDLOADER_EXPORT static MEDFileCMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); + MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileCMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileCMesh"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const override; - MEDLOADER_EXPORT MEDFileCMesh *deepCopy() const override; - MEDLOADER_EXPORT MEDFileCMesh *shallowCpy() const override; - MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const override; - MEDLOADER_EXPORT int getMeshDimension() const override; - MEDLOADER_EXPORT int getSpaceDimension() const override; - MEDLOADER_EXPORT std::string simpleRepr() const override; - MEDLOADER_EXPORT std::string advancedRepr() const override; - MEDLOADER_EXPORT void clearNonDiscrAttributes() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; + MEDLOADER_EXPORT MEDFileCMesh *deepCopy() const; + MEDLOADER_EXPORT MEDFileCMesh *shallowCpy() const; + MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; + MEDLOADER_EXPORT int getMeshDimension() const; + MEDLOADER_EXPORT int getSpaceDimension() const; + MEDLOADER_EXPORT std::string simpleRepr() const; + MEDLOADER_EXPORT std::string advancedRepr() const; + MEDLOADER_EXPORT void clearNonDiscrAttributes() const; MEDLOADER_EXPORT const MEDCouplingCMesh *getMesh() const; MEDLOADER_EXPORT void setMesh(MEDCouplingCMesh *m); - MEDLOADER_EXPORT MEDFileMesh *cartesianize() const override; + MEDLOADER_EXPORT MEDFileMesh *cartesianize() const; private: - ~MEDFileCMesh() override = default; - const MEDCouplingStructuredMesh *getStructuredMesh() const override; - void writeMeshLL(med_idt fid) const override; + ~MEDFileCMesh() { } + const MEDCouplingStructuredMesh *getStructuredMesh() const; + void writeMeshLL(med_idt fid) const; MEDFileCMesh(); - void synchronizeTinyInfoOnLeaves() const override; + void synchronizeTinyInfoOnLeaves() const; MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) override; + void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); private: MCAuto _cmesh; }; @@ -563,34 +544,34 @@ MCAuto& coords, MCAuto& partCoords, MCAuto(db); } - MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); + MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileCurveLinearMesh"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const override; - MEDLOADER_EXPORT MEDFileCurveLinearMesh *deepCopy() const override; - MEDLOADER_EXPORT MEDFileCurveLinearMesh *shallowCpy() const override; - MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const override; - MEDLOADER_EXPORT int getMeshDimension() const override; - MEDLOADER_EXPORT int getSpaceDimension() const override; - MEDLOADER_EXPORT std::string simpleRepr() const override; - MEDLOADER_EXPORT std::string advancedRepr() const override; - MEDLOADER_EXPORT void clearNonDiscrAttributes() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; + MEDLOADER_EXPORT MEDFileCurveLinearMesh *deepCopy() const; + MEDLOADER_EXPORT MEDFileCurveLinearMesh *shallowCpy() const; + MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; + MEDLOADER_EXPORT int getMeshDimension() const; + MEDLOADER_EXPORT int getSpaceDimension() const; + MEDLOADER_EXPORT std::string simpleRepr() const; + MEDLOADER_EXPORT std::string advancedRepr() const; + MEDLOADER_EXPORT void clearNonDiscrAttributes() const; MEDLOADER_EXPORT const MEDCouplingCurveLinearMesh *getMesh() const; MEDLOADER_EXPORT void setMesh(MEDCouplingCurveLinearMesh *m); - MEDLOADER_EXPORT MEDFileMesh *cartesianize() const override; + MEDLOADER_EXPORT MEDFileMesh *cartesianize() const; private: - ~MEDFileCurveLinearMesh() override = default; + ~MEDFileCurveLinearMesh() { } MEDFileCurveLinearMesh(); MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); - const MEDCouplingStructuredMesh *getStructuredMesh() const override; - void synchronizeTinyInfoOnLeaves() const override; - void writeMeshLL(med_idt fid) const override; - void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) override;//to imp + const MEDCouplingStructuredMesh *getStructuredMesh() const; + void synchronizeTinyInfoOnLeaves() const; + void writeMeshLL(med_idt fid) const; + void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);//to imp private: MCAuto _clmesh; }; @@ -605,21 +586,21 @@ MCAuto& coords, MCAuto& partCoords, MCAuto getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT std::string getName() const; MEDLOADER_EXPORT void setName(const std::string& newMeshName); MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT void cartesianizeMe(); MEDLOADER_EXPORT MEDFileMesh *getOneTimeStep() const; - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT void setOneTimeStep(MEDFileMesh *mesh1TimeStep); MEDLOADER_EXPORT MEDFileJoints *getJoints() const; MEDLOADER_EXPORT void setJoints(MEDFileJoints* joints); MEDLOADER_EXPORT bool presenceOfStructureElements() const; MEDLOADER_EXPORT void killStructureElements(); private: - ~MEDFileMeshMultiTS() override = default; + ~MEDFileMeshMultiTS() { } void loadFromFile(med_idt fid, const std::string& mName); MEDFileMeshMultiTS(); MEDFileMeshMultiTS(med_idt fid); @@ -639,11 +620,11 @@ MCAuto& coords, MCAuto& partCoords, MCAuto getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const; - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT int getNumberOfMeshes() const; MEDLOADER_EXPORT MEDFileMeshesIterator *iterator(); MEDLOADER_EXPORT MEDFileMesh *getMeshAtPos(int i) const; @@ -659,7 +640,7 @@ MCAuto& coords, MCAuto& partCoords, MCAuto -#include -#include #include -#include -#include -#include // From MEDLOader.cxx TU @@ -64,7 +48,7 @@ void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, i med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - _fam=nullptr; + _fam=0; if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { if(!mrs || mrs->isCellFamilyFieldReading()) @@ -76,7 +60,7 @@ void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, i _fam=FromMedIntArray( miFam ); } } - _num=nullptr; + _num=0; if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { if(!mrs || mrs->isCellNumFieldReading()) @@ -84,11 +68,11 @@ void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, i MCAuto miNum=DataArrayMedInt::New(); miNum->alloc(curNbOfElem,1); if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,miNum->getPointer())!=0) - miNum=nullptr; + miNum=0; _num=FromMedIntArray(miNum); } } - _names=nullptr; + _names=0; if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NAME,MED_NODAL,&changement,&transformation)>0) { if(!mrs || mrs->isCellNameFieldReading()) @@ -96,7 +80,7 @@ void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, i _names=DataArrayAsciiChar::New(); _names->alloc(curNbOfElem+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end if(MEDmeshEntityNameRd(fid,mName,dt,it,entity,geoElt,_names->getPointer())!=0) - _names=nullptr; + _names=0; else _names->reAlloc(curNbOfElem);//not a bug to avoid the memory corruption due to last \0 at the end } @@ -121,17 +105,17 @@ MEDFileUMeshPerType *MEDFileUMeshPerType::New(med_idt fid, const char *mName, in { med_entity_type whichEntity; if(!isExisting(fid,mName,dt,it,geoElt,whichEntity)) - return nullptr; + return 0; return new MEDFileUMeshPerType(fid,mName,dt,it,mdim,geoElt,geoElt2,whichEntity,mrs); } MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, mcIdType strt, mcIdType stp, mcIdType step, MEDFileMeshReadSelector *mrs) { - int const geoElt2i((int)geoElt2); + int geoElt2i((int)geoElt2); if(geoElt2i<0 || geoElt2i>=INTERP_KERNEL::NORM_MAXTYPE) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::NewPart : Not recognized MEDCoupling/MEDLoader geometric type !"); - med_geometry_type const geoElt(typmai3[geoElt2]); + med_geometry_type geoElt(typmai3[geoElt2]); med_entity_type whichEntity; if(!isExisting(fid,mName,dt,it,geoElt,whichEntity)) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::NewPart : The specified geo type is not present in the specified mesh !"); @@ -142,10 +126,10 @@ MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, const std::vector& distrib, MEDFileMeshReadSelector *mrs) { - int const geoElt2i((int)geoElt2); + int geoElt2i((int)geoElt2); if(geoElt2i<0 || geoElt2i>=INTERP_KERNEL::NORM_MAXTYPE) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::NewPart : Not recognized MEDCoupling/MEDLoader geometric type !"); - med_geometry_type const geoElt(typmai3[geoElt2]); + med_geometry_type geoElt(typmai3[geoElt2]); med_entity_type whichEntity; if(!isExisting(fid,mName,dt,it,geoElt,whichEntity)) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::NewPart : The specified geo type is not present in the specified mesh !"); @@ -173,7 +157,7 @@ bool MEDFileUMeshPerType::isExisting(med_idt fid, const char *mName, int dt, int for(int i=0;i<3;i++) { med_bool changement,transformation; - mcIdType const tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); + mcIdType tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); if(tmp>nbOfElt) { nbOfElt=tmp; @@ -191,13 +175,14 @@ int MEDFileUMeshPerType::getDim() const } MEDFileUMeshPerType::MEDFileUMeshPerType() -= default; +{ +} MEDFileUMeshPerType::MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); + mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type)); if(!cm.isDynamic()) { @@ -217,7 +202,7 @@ void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int i med_entity_type entity, const std::vector& distrib, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); + mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type)); MCAuto listOfIds=DataArrayIdType::New(); listOfIds->useArray(distrib.data(),false,DeallocType::C_DEALLOC,distrib.size(),1); @@ -234,7 +219,7 @@ void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int i med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); + mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type)); _pd=PartDefinition::New(strt,end,step); if(!cm.isDynamic()) @@ -246,13 +231,13 @@ void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int i } -void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int /*mdim*/, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, +void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, med_entity_type entity, MEDFileMeshReadSelector *mrs) { _m=MEDCoupling1SGTUMesh::New(mName,type); - auto *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); + MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); MCAuto conn(DataArrayMedInt::New()); - mcIdType const nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); + mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); conn->alloc(nbOfNodesPerCell*curNbOfElem,1); MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer())); std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind(std::plus(),std::placeholders::_1,-1)); @@ -264,12 +249,12 @@ void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int med_entity_type entity, MEDFileMeshReadSelector *mrs) { _m=MEDCoupling1SGTUMesh::New(mName,type); - auto *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); + MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); MCAuto conn(DataArrayMedInt::New()); - mcIdType const nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); + mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); if(!_pd) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : no part definition !"); - mcIdType const nbOfEltsToLoad(_pd->getNumberOfElems()); + mcIdType nbOfEltsToLoad(_pd->getNumberOfElems()); conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1); { MEDFilterEntity filter; @@ -284,13 +269,13 @@ void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int } -void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, int dt, int it, int /*mdim*/, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; if(!_pd) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartOfCellCommonPart : no part definition !"); - mcIdType const nbOfEltsToLoad(_pd->getNumberOfElems()); - _fam=nullptr; + mcIdType nbOfEltsToLoad(_pd->getNumberOfElems()); + _fam=0; if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { if(!mrs || mrs->isCellFamilyFieldReading()) @@ -306,7 +291,7 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam _fam=FromMedIntArray(miFam); } } - _num=nullptr; + _num=0; if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { if(!mrs || mrs->isCellNumFieldReading()) @@ -322,7 +307,7 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam _num=FromMedIntArray(miNum); } } - _names=nullptr; + _names=0; if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NAME,MED_NODAL,&changement,&transformation)>0) { if(!mrs || mrs->isCellNameFieldReading()) @@ -334,18 +319,18 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, _pd); if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NAME,dt,it,entity,geoElt,filter.getPtr(),_names->getPointer())!=0) - _names=nullptr; + _names=0; else _names->reAlloc(nbOfEltsToLoad);//not a bug to avoid the memory corruption due to last \0 at the end } } } -void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int /*mdim*/, mcIdType arraySize, med_geometry_type geoElt, +void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType arraySize, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1); + mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1); _m=MEDCoupling1DGTUMesh::New(mName,geoElt==MED_POLYGON?INTERP_KERNEL::NORM_POLYGON:INTERP_KERNEL::NORM_QPOLYG); MCAuto mc(DynamicCast(_m)); MCAuto conn(DataArrayMedInt::New()),connI(DataArrayMedInt::New()); @@ -357,12 +342,12 @@ void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs); } -void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int /*mdim*/, mcIdType connFaceLgth, med_geometry_type /*geoElt*/, +void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType connFaceLgth, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - med_int const indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)); - mcIdType const curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1); + med_int indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)); + mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1); _m=MEDCoupling1DGTUMesh::New(mName,INTERP_KERNEL::NORM_POLYHED); MCAuto mc(DynamicCastSafe(_m)); INTERP_KERNEL::AutoPtr index=new med_int[curNbOfElem+1]; @@ -393,19 +378,19 @@ void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int loadCommonPart(fid,mName,dt,it,curNbOfElem,MED_POLYHEDRON,entity,mrs); } -void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int /*mdim*/, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names) +void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names) { - mcIdType const nbOfCells=m->getNumberOfCells(); + mcIdType nbOfCells=m->getNumberOfCells(); if(nbOfCells<1) return ; int dt,it; - double const timm=m->getTime(dt,it); - INTERP_KERNEL::NormalizedCellType const ikt=m->getTypeOfCell(0); + double timm=m->getTime(dt,it); + INTERP_KERNEL::NormalizedCellType ikt=m->getTypeOfCell(0); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(ikt); - med_geometry_type const curMedType=typmai3[(int)ikt]; + med_geometry_type curMedType=typmai3[(int)ikt]; if(!cm.isDynamic()) { - const auto *m0(dynamic_cast(m)); + const MEDCoupling1SGTUMesh *m0(dynamic_cast(m)); if(!m0) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !"); MCAuto arr(DataArrayMedInt_Copy(m0->getNodalConnectivity())); @@ -414,7 +399,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int /*md } else { - const auto *m0(dynamic_cast(m)); + const MEDCoupling1DGTUMesh *m0(dynamic_cast(m)); if(!m0) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #2 !"); if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG) @@ -427,8 +412,8 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int /*md else { const mcIdType *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin()); - mcIdType const meshLgth=m0->getNodalConnectivityLength(); - mcIdType const nbOfFaces=ToIdType(std::count(conn,conn+meshLgth,-1)+nbOfCells); + mcIdType meshLgth=m0->getNodalConnectivityLength(); + mcIdType nbOfFaces=ToIdType(std::count(conn,conn+meshLgth,-1)+nbOfCells); INTERP_KERNEL::AutoPtr tab1=new med_int[nbOfCells+1]; med_int *w1=tab1; *w1=1; INTERP_KERNEL::AutoPtr tab2=new med_int[nbOfFaces+1]; @@ -442,7 +427,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int /*md { const mcIdType *wend=std::find(w,conn+connI[i+1],-1); bt=std::transform(w,wend,bt,std::bind(std::plus(),std::placeholders::_1,1)); - std::size_t const nbOfNode=std::distance(w,wend); + std::size_t nbOfNode=std::distance(w,wend); w2[1]=w2[0]+(med_int)nbOfNode; if(wend!=conn+connI[i+1]) w=wend+1; diff --git a/src/MEDLoader/MEDFileMeshElt.hxx b/src/MEDLoader/MEDFileMeshElt.hxx index 5258aef7a..7975553b0 100644 --- a/src/MEDLoader/MEDFileMeshElt.hxx +++ b/src/MEDLoader/MEDFileMeshElt.hxx @@ -21,19 +21,14 @@ #ifndef __MEDFILEMESHELT_HXX__ #define __MEDFILEMESHELT_HXX__ -#include "MCType.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingPartDefinition.hxx" #include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "NormalizedGeometricTypes" +#include "NormalizedUnstructuredMesh.hxx" #include "med.h" -#include -#include -#include namespace MEDCoupling { @@ -47,8 +42,8 @@ namespace MEDCoupling std::string getClassName() const override { return std::string("MEDFileUMeshPerTypeCommon"); } void loadCommonPart(med_idt fid, const char *mName, int dt, int it, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; const DataArrayIdType *getFam() const { return _fam; } const DataArrayIdType *getNum() const { return _num; } const DataArrayAsciiChar *getNames() const { return _names; } @@ -67,8 +62,8 @@ namespace MEDCoupling std::string getClassName() const override { return std::string("MEDFileUMeshPerType"); } static bool isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity); - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; int getDim() const; MEDCoupling1GTUMesh *getMesh() const { return const_cast((const MEDCoupling1GTUMesh *)_m); } const PartDefinition *getPartDef() const { return _pd; } diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index f2341131f..5baacd48a 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -19,19 +19,7 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDFileMeshLL.hxx" -#include "MEDCouplingCurveLinearMesh.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingMemArray.txx" -#include "MEDFileBasis.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingMap.txx" -#include "MEDCouplingPartDefinition.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCIdType.hxx" -#include "MEDCoupling1GTUMesh.hxx" #include "MEDFileMesh.hxx" -#include "MEDFileMeshElt.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileSafeCaller.txx" #include "MEDFileMeshReadSelector.hxx" @@ -44,22 +32,7 @@ #include "CellModel.hxx" #include "MEDFilterEntity.hxx" -#include "med.h" -#include "NormalizedGeometricTypes" -#include "medmesh.h" -#include -#include -#include "medfamily.h" -#include "medstructelement.h" -#include -#include -#include -#include #include -#include -#include -#include -#include #include // From MEDLOader.cxx TU @@ -79,11 +52,11 @@ std::vector MeshCls::getAxisInfoOnMesh(med_idt fid, const std::stri med_int spaceDim, meshDim, nbSteps; med_sorting_type stype; med_axis_type axistype; - med_int const naxis(MEDmeshnAxis(fid,getID())); + med_int naxis(MEDmeshnAxis(fid,getID())); INTERP_KERNEL::AutoPtr nameTmp(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)); INTERP_KERNEL::AutoPtr axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)); - INTERP_KERNEL::AutoPtr const univTmp(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE)); + INTERP_KERNEL::AutoPtr univTmp(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE)); if(MEDmeshInfo(fid,getID(),nameTmp,&spaceDim,&meshDim,&type_maillage,description.getPointer(),dtunit.getPointer(), &stype,&nbSteps,&axistype,axisname,axisunit)!=0) throw INTERP_KERNEL::Exception("A problem has been detected when trying to get info on mesh !"); @@ -123,7 +96,7 @@ std::vector MeshCls::getAxisInfoOnMesh(med_idt fid, const std::stri std::vector infosOnComp(naxis); for(int i=0;i StructMeshCls::getAxisInfoOnMesh(med_idt fid, const std::string& /*mName*/, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& /*Mdim*/, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const +std::vector StructMeshCls::getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const { INTERP_KERNEL::AutoPtr msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr zeDescription(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); med_axis_type medAxType; - med_int const nAxis(MEDsupportMeshnAxis(fid,getID())); + med_int nAxis(MEDsupportMeshnAxis(fid,getID())); INTERP_KERNEL::AutoPtr axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]); med_int spaceDim(0),meshDim(0); MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,getID(),msn,&spaceDim,&meshDim,zeDescription,&medAxType,axisName,axisUnit)); - std::string const descriptionCpp(MEDLoaderBase::buildStringFromFortran(zeDescription,MED_COMMENT_SIZE)); + std::string descriptionCpp(MEDLoaderBase::buildStringFromFortran(zeDescription,MED_COMMENT_SIZE)); description.set(descriptionCpp.c_str()); dtunit.clear(); univName.clear(); meshType=UNSTRUCTURED; nstep=1; axType=MEDFileMeshL2::TraduceAxisType(medAxType); @@ -172,14 +145,14 @@ std::vector StructMeshCls::getAxisInfoOnMesh(med_idt fid, const std std::vector ret; for(int i=0;i MEDFileMeshL2::GetMeshIdFromName( char dtunit[MED_LNAME_SIZE+1]; med_int spaceDim,dim; char nommaa[MED_NAME_SIZE+1]; - med_int const n=MEDnMesh(fid); + med_int n=MEDnMesh(fid); char found(0); int ret=-1; med_sorting_type stype; @@ -214,11 +187,11 @@ INTERP_KERNEL::AutoCppPtr MEDFileMeshL2::GetMeshIdFromName( med_axis_type axistype=MED_UNDEF_AXIS_TYPE; for(int i=0;i axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)),axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)); MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&spaceDim,&dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit)); dtunit1=MEDLoaderBase::buildStringFromFortran(dtunit,sizeof(dtunit)); - std::string const cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa))); + std::string cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa))); ms.push_back(cur); if(cur==mName) { @@ -228,13 +201,13 @@ INTERP_KERNEL::AutoCppPtr MEDFileMeshL2::GetMeshIdFromName( } if(found==0) {//last chance ! Is it a support mesh ? - med_int const nbSM(MEDnSupportMesh(fid)); + med_int nbSM(MEDnSupportMesh(fid)); for(int i=0;i axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)),axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)); MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,nommaa,&spaceDim,&dim,maillage_description,&axistype,axisname,axisunit)); - std::string const cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa))); + std::string cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa))); ms.push_back(cur); if(cur==mName) { @@ -315,29 +288,29 @@ void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName return ; char nomfam[MED_NAME_SIZE+1]; med_int numfam; - med_int const nfam=MEDnFamily(fid,meshName.c_str()); + med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector< std::pair > > > crudeFams(nfam); for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); - std::string const famName(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE)); + std::string famName(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE)); std::vector grps2(ngro); for(int j=0;j > >(famName,std::pair >(numfam,grps2)); } RenameFamiliesFromFileToMemInternal(crudeFams); - for(const auto & crudeFam : crudeFams) + for(std::vector< std::pair > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++) { - fams[crudeFam.first]=crudeFam.second.first; - for(auto it1=crudeFam.second.second.begin();it1!=crudeFam.second.second.end();it1++) - grps[*it1].push_back(crudeFam.first); + fams[(*it0).first]=(*it0).second.first; + for(std::vector::const_iterator it1=(*it0).second.second.begin();it1!=(*it0).second.second.end();it1++) + grps[*it1].push_back((*it0).first); } } @@ -345,27 +318,27 @@ void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, { std::vector< std::pair > > > crudeFams(fams.size()); std::size_t ii(0); - for(auto it=fams.begin();it!=fams.end();it++,ii++) + for(std::map::const_iterator it=fams.begin();it!=fams.end();it++,ii++) { std::vector grpsOfFam; - for(const auto & grp : grps) + for(std::map >::const_iterator it1=grps.begin();it1!=grps.end();it1++) { - if(std::find(grp.second.begin(),grp.second.end(),(*it).first)!=grp.second.end()) - grpsOfFam.push_back(grp.first); + if(std::find((*it1).second.begin(),(*it1).second.end(),(*it).first)!=(*it1).second.end()) + grpsOfFam.push_back((*it1).first); } crudeFams[ii]=std::pair > >((*it).first,std::pair >((*it).second,grpsOfFam)); } RenameFamiliesFromMemToFileInternal(crudeFams); - for(const auto & crudeFam : crudeFams) + for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++) { - std::size_t const ngro(crudeFam.second.second.size()); + std::size_t ngro((*it).second.second.size()); INTERP_KERNEL::AutoPtr groName=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE*ngro); int i=0; - for(auto it2=crudeFam.second.second.begin();it2!=crudeFam.second.second.end();it2++,i++) + for(std::vector::const_iterator it2=(*it).second.second.begin();it2!=(*it).second.second.end();it2++,i++) MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE,groName+i*MED_LNAME_SIZE,tooLongStrPol); INTERP_KERNEL::AutoPtr famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - MEDLoaderBase::safeStrCpy(crudeFam.first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol); - med_int ret=MEDfamilyCr(fid,mname.c_str(),famName,ToMedInt(crudeFam.second.first),ToMedInt(ngro),groName); + MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol); + med_int ret=MEDfamilyCr(fid,mname.c_str(),famName,ToMedInt((*it).second.first),ToMedInt(ngro),groName); ret++; } } @@ -379,7 +352,7 @@ void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++) (*it).first=fams[ii]; } @@ -396,21 +369,21 @@ bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famN { std::map m; std::set s; - for(const auto & famName : famNames) + for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++) { - if(s.find(famName)!=s.end()) - m[famName]=0; - s.insert(famName); + if(s.find(*it)!=s.end()) + m[*it]=0; + s.insert(*it); } if(m.empty()) return false;// the general case ! - for(auto & famName : famNames) + for(std::vector< std::string >::iterator it=famNames.begin();it!=famNames.end();it++) { - auto const it2(m.find(famName)); + std::map::iterator it2(m.find(*it)); if(it2!=m.end()) { - std::ostringstream oss; oss << famName << ZE_SEP_FOR_FAMILY_KILLERS << std::setfill('0') << std::setw(ZE_SEP2_FOR_FAMILY_KILLERS) << (*it2).second++; - famName=oss.str(); + std::ostringstream oss; oss << *it << ZE_SEP_FOR_FAMILY_KILLERS << std::setfill('0') << std::setw(ZE_SEP2_FOR_FAMILY_KILLERS) << (*it2).second++; + *it=oss.str(); } } return true; @@ -428,9 +401,9 @@ void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair& famNames) { bool isSmthingStrange(false); - for(const auto & famName : famNames) + for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++) { - std::size_t const found(famName.find(ZE_SEP_FOR_FAMILY_KILLERS)); + std::size_t found((*it).find(ZE_SEP_FOR_FAMILY_KILLERS)); if(found!=std::string::npos) isSmthingStrange=true; } @@ -438,22 +411,22 @@ bool MEDFileMeshL2::RenameFamiliesFromMemToFile(std::vector< std::string >& famN return false; // pattern matching std::map< std::string, std::vector > m; - for(const auto & famName : famNames) + for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++) { - std::size_t const found(famName.find(ZE_SEP_FOR_FAMILY_KILLERS)); + std::size_t found((*it).find(ZE_SEP_FOR_FAMILY_KILLERS)); if(found!=std::string::npos && found>=1) { - std::string const s1(famName.substr(found+sizeof(ZE_SEP_FOR_FAMILY_KILLERS)-1)); + std::string s1((*it).substr(found+sizeof(ZE_SEP_FOR_FAMILY_KILLERS)-1)); if((int)s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS) continue; int k(-1); std::istringstream iss(s1); iss >> k; - bool const isOK((iss.rdstate() & ( std::istream::failbit | std::istream::eofbit)) == std::istream::eofbit); + bool isOK((iss.rdstate() & ( std::istream::failbit | std::istream::eofbit)) == std::istream::eofbit); if(isOK && k>=0) { - std::string const s0(famName.substr(0,found)); - m[s0].push_back(famName); + std::string s0((*it).substr(0,found)); + m[s0].push_back(*it); } } } @@ -465,17 +438,17 @@ bool MEDFileMeshL2::RenameFamiliesFromMemToFile(std::vector< std::string >& famN { if((*it).second.size()==1) continue; - for(auto it1=(*it).second.begin();it1!=(*it).second.end();it1++) + for(std::vector::const_iterator it1=(*it).second.begin();it1!=(*it).second.end();it1++) zeMap[*it1]=(*it).first; } if(zeMap.empty()) return false; // traduce - for(auto & famName : famNames) + for(std::vector< std::string >::iterator it=famNames.begin();it!=famNames.end();it++) { - auto const it1(zeMap.find(famName)); + std::map::iterator it1(zeMap.find(*it)); if(it1!=zeMap.end()) - famName=(*it1).second; + *it=(*it1).second; } return true; } @@ -541,7 +514,8 @@ med_grid_type MEDFileMeshL2::TraduceAxisTypeRevStruct(MEDCoupling::MEDCouplingAx } MEDFileUMeshL2::MEDFileUMeshL2() -= default; +{ +} std::vector MEDFileUMeshL2::loadCommonPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, int& Mdim) { @@ -567,7 +541,7 @@ std::vector MEDFileUMeshL2::loadCommonPart(med_idt fid, const MeshO void MEDFileUMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { int Mdim; - std::vector const infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim)); + std::vector infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim)); if(Mdim==-4) return ; loadConnectivity(fid,Mdim,mName,dt,it,mrs);//to improve check (dt,it) coherency @@ -580,32 +554,32 @@ void MEDFileUMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const * - dealing with optimized load of coordinates (loading only points fetched by the already loaded cells) * - update the connectivity in \a this to fit the coordinates loaded just above */ -void MEDFileUMeshL2::dealWithCoordsInLoadPart(med_idt fid, const MeshOrStructMeshCls * /*mId*/, const std::string& mName, const std::vector& infosOnComp, const std::vector& /*types*/, const std::vector& /*slicPerTyp*/, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshL2::dealWithCoordsInLoadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector& infosOnComp, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - mcIdType const nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); + mcIdType nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); std::vector fetchedNodeIds(nCoords,false); - for(const auto & it0 : _per_type_mesh) - for(const auto & it1 : it0) - it1->getMesh()->computeNodeIdsAlg(fetchedNodeIds); + for(std::vector< std::vector< MCAuto > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + (*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds); if(!mrs || mrs->getNumberOfCoordsLoadSessions()==1) { - mcIdType const nMin(ToIdType(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true)))); + mcIdType nMin(ToIdType(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true)))); mcIdType nMax(ToIdType(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true)))); nMax=nCoords-nMax; - for(const auto & it0 : _per_type_mesh) - for(const auto & it1 : it0) - it1->getMesh()->renumberNodesWithOffsetInConn(-nMin); + for(std::vector< std::vector< MCAuto > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + (*it1)->getMesh()->renumberNodesWithOffsetInConn(-nMin); this->loadPartCoords(fid,infosOnComp,mName,dt,it,nMin,nMax); } else { - mcIdType const nbOfCooLS(mrs->getNumberOfCoordsLoadSessions()); + mcIdType nbOfCooLS(mrs->getNumberOfCoordsLoadSessions()); MCAuto fni(DataArrayIdType::BuildListOfSwitchedOn(fetchedNodeIds)); MCAuto< MapKeyVal > o2n(fni->invertArrayN2O2O2NOptimized()); - for(const auto & it0 : _per_type_mesh) - for(const auto & it1 : it0) - it1->getMesh()->renumberNodesInConn(o2n->data()); + for(std::vector< std::vector< MCAuto > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + (*it1)->getMesh()->renumberNodesInConn(o2n->data()); this->loadPartCoordsSlice(fid,infosOnComp,mName,dt,it,fni,nbOfCooLS); } } @@ -622,7 +596,7 @@ std::vector MEDFileUMeshL2::loadPartConnectivityOnly(med_idt fid, c void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { int Mdim; - std::vector const infosOnComp(loadPartConnectivityOnly(fid,mId,mName,types,slicPerTyp,dt,it,mrs,Mdim)); + std::vector infosOnComp(loadPartConnectivityOnly(fid,mId,mName,types,slicPerTyp,dt,it,mrs,Mdim)); if(Mdim==-4) return ; loadPartOfConnectivity(fid,Mdim,mName,types,slicPerTyp,dt,it,mrs); @@ -638,7 +612,7 @@ void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const void MEDFileUMeshL2::loadPartFromUserDistrib(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::map>& distrib, int dt, int it, MEDFileMeshReadSelector *mrs) { int Mdim; - std::vector const infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim)); + std::vector infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim)); if(Mdim==-4) return ; @@ -647,11 +621,11 @@ void MEDFileUMeshL2::loadPartFromUserDistrib(med_idt fid, const MeshOrStructMesh /* Second step : loading nodes */ med_bool changement,transformation; - mcIdType const nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); + mcIdType nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); std::vector fetchedNodeIds(nCoords,false); - for(const auto & it0 : _per_type_mesh) - for(const auto & it1 : it0) - it1->getMesh()->computeNodeIdsAlg(fetchedNodeIds); // for each node in the original mesh, which ones are laying on the current single geometrical type partial mesh + for(std::vector< std::vector< MCAuto > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + (*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds); // for each node in the original mesh, which ones are laying on the current single geometrical type partial mesh if(!mrs || mrs->getNumberOfCoordsLoadSessions()==1) { @@ -661,9 +635,9 @@ void MEDFileUMeshL2::loadPartFromUserDistrib(med_idt fid, const MeshOrStructMesh // thus we want each node to be renumbered so that the sequence of their numbers form a range MCAuto fni(DataArrayIdType::BuildListOfSwitchedOn(fetchedNodeIds)); MCAuto< MapKeyVal > o2n(fni->invertArrayN2O2O2NOptimized()); - for(const auto & it0 : _per_type_mesh) - for(const auto & it1 : it0) - it1->getMesh()->renumberNodesInConn(o2n->data()); + for(std::vector< std::vector< MCAuto > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + (*it1)->getMesh()->renumberNodesInConn(o2n->data()); // loading coordinates of fetched nodes std::vector distribNodes; @@ -690,10 +664,10 @@ void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const std::string& void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { - std::size_t const nbOfTypes(types.size()); + std::size_t nbOfTypes(types.size()); if(slicPerTyp.size()!=3*nbOfTypes) throw INTERP_KERNEL::Exception("MEDFileUMeshL2::loadPartOfConnectivity : The size of slicPerTyp array is expected to be equal to 3 times size of array types !"); - std::set const types2(types.begin(),types.end()); + std::set types2(types.begin(),types.end()); if(types2.size()!=nbOfTypes) throw INTERP_KERNEL::Exception("MEDFileUMeshL2::loadPartOfConnectivity : the geometric types in types array must appear once !"); _per_type_mesh.resize(1); @@ -701,7 +675,7 @@ void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::st for(std::size_t ii=0;ii const tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs)); + MCAuto tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs)); _per_type_mesh[0].push_back(tmp); } sortTypes(); @@ -718,7 +692,7 @@ void MEDFileUMeshL2::loadPartOfConnectivityFromUserDistrib(med_idt fid, int mdim std::map>::const_iterator iter; for (iter = distrib.begin(); iter != distrib.end(); iter++) { - MCAuto const tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,iter->first/*type*/,iter->second/*distrib over the current type*/,mrs)); + MCAuto tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,iter->first/*type*/,iter->second/*distrib over the current type*/,mrs)); _per_type_mesh[0].push_back(tmp); } sortTypes(); @@ -726,9 +700,9 @@ void MEDFileUMeshL2::loadPartOfConnectivityFromUserDistrib(med_idt fid, int mdim void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it) { - int const spaceDim((int)infosOnComp.size()); + int spaceDim((int)infosOnComp.size()); med_bool changement,transformation; - med_int const nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); + med_int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); _coords=DataArrayDouble::New(); _coords->alloc(nCoords,spaceDim); double *coordsPtr(_coords->getPointer()); @@ -742,7 +716,7 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf _fam_coords=FromMedIntArray(miFamCoord); } else - _fam_coords=nullptr; + _fam_coords=0; if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { MCAuto miNumCoord=DataArrayMedInt::New(); @@ -751,7 +725,7 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf _num_coords=FromMedIntArray(miNumCoord); } else - _num_coords=nullptr; + _num_coords=0; if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0) { _name_coords=DataArrayAsciiChar::New(); @@ -760,7 +734,7 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf _name_coords->reAlloc(nCoords);//not a bug to avoid the memory corruption due to last \0 at the end } else - _name_coords=nullptr; + _name_coords=0; if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_GLOBAL_NUMBER,MED_NODAL,&changement,&transformation)>0) { MCAuto miNumCoord=DataArrayMedInt::New(); @@ -776,7 +750,7 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf void MEDFileUMeshL2::LoadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, const std::vector& distribNodes, MCAuto& _coords, MCAuto& _part_coords, MCAuto& _fam_coords, MCAuto& _num_coords, MCAuto& _name_coords) { - med_int const spaceDim((int)infosOnComp.size()); + med_int spaceDim((int)infosOnComp.size()); allocCoordsPartCoords(spaceDim,distribNodes,_coords,_part_coords); _coords->setInfoOnComponents(infosOnComp); fillPartCoords(fid,spaceDim,mName,dt,it,_part_coords,_coords,_fam_coords,_num_coords,_name_coords); @@ -785,7 +759,7 @@ MCAuto& _coords, MCAuto& _part_coords, MCAuto& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax, MCAuto& _coords, MCAuto& _part_coords, MCAuto& _fam_coords, MCAuto& _num_coords, MCAuto& _name_coords) { - med_int const spaceDim((int)infosOnComp.size()); + med_int spaceDim((int)infosOnComp.size()); allocCoordsPartCoords(spaceDim,nMin,nMax,_coords,_part_coords); _coords->setInfoOnComponents(infosOnComp); fillPartCoords(fid,spaceDim,mName,dt,it,_part_coords,_coords,_fam_coords,_num_coords,_name_coords); @@ -796,7 +770,7 @@ MCAuto& _coords, MCAuto& _part_coords, MCAuto& nodeIds, MCAuto& _coords, MCAuto& _part_coords) { - mcIdType const nbNodesToLoad(nodeIds.size()); + mcIdType nbNodesToLoad(nodeIds.size()); _coords=DataArrayDouble::New(); _coords->alloc(nbNodesToLoad,spaceDim); @@ -811,7 +785,7 @@ void MEDFileUMeshL2::allocCoordsPartCoords(mcIdType spaceDim, const std::vector< void MEDFileUMeshL2::allocCoordsPartCoords(mcIdType spaceDim, mcIdType nMin, mcIdType nMax, MCAuto& _coords, MCAuto& _part_coords) { _coords=DataArrayDouble::New(); - mcIdType const nbNodesToLoad(nMax-nMin); + mcIdType nbNodesToLoad(nMax-nMin); _coords->alloc(nbNodesToLoad,spaceDim); _part_coords=PartDefinition::New(nMin,nMax,1); @@ -824,8 +798,8 @@ void MEDFileUMeshL2::fillPartCoords(med_idt fid, mcIdType spaceDim, const std::s MCAuto& _coords, MCAuto& _fam_coords, MCAuto& _num_coords, MCAuto& _name_coords) { med_bool changement,transformation; - med_int const nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); - mcIdType const nbNodesToLoad = partCoords->getNumberOfElems(); + med_int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); + mcIdType nbNodesToLoad = partCoords->getNumberOfElems(); // Based on the ids in \a partCoords, defining the appropriate med_filter (filter of block if the ids form a slice, a generic filter otherwise) { @@ -932,7 +906,7 @@ void MEDFileUMeshL2::loadPartCoordsSlice(med_idt fid, const std::vector idsNodeIdsToKeep(nodeIds->findIdsInRange(partStart,partStop)); - MCAuto const nodeIdsToKeep( nodeIds->selectByTupleIdSafe(idsNodeIdsToKeep->begin(),idsNodeIdsToKeep->end()) ); + MCAuto nodeIdsToKeep( nodeIds->selectByTupleIdSafe(idsNodeIdsToKeep->begin(),idsNodeIdsToKeep->end()) ); LoadPartCoordsArray(fid,infosOnComp,mName,dt,it,nodeIdsToKeep,coords[ipart],famCoords[ipart],numCoords[ipart],nameCoords[ipart]); } _coords = DataArrayDouble::Aggregate(ToConstVect(coords)); @@ -953,25 +927,25 @@ void MEDFileUMeshL2::loadPartCoordsSlice(med_idt fid, const std::vector mdims; - std::vector< MCAuto > const tmp(_per_type_mesh[0]); + std::vector< MCAuto > tmp(_per_type_mesh[0]); _per_type_mesh.clear(); - for(const auto & it : tmp) - mdims.insert(it->getDim()); + for(std::vector< MCAuto >::const_iterator it=tmp.begin();it!=tmp.end();it++) + mdims.insert((*it)->getDim()); if(mdims.empty()) return; - int const mdim=*mdims.rbegin(); + int mdim=*mdims.rbegin(); _per_type_mesh.resize(mdim+1); for(int dim=mdim+1;dim!=0;dim--) { std::vector< MCAuto >& elt=_per_type_mesh[mdim+1-dim]; - for(const auto & it : tmp) - if(it->getDim()==dim-1) - elt.push_back(it); + for(std::vector< MCAuto >::const_iterator it=tmp.begin();it!=tmp.end();it++) + if((*it)->getDim()==dim-1) + elt.push_back(*it); } // suppression of contiguous empty levels at the end of _per_type_mesh. int nbOfUselessLev=0; bool isFirst=true; - for(auto it2=_per_type_mesh.rbegin();it2!=_per_type_mesh.rend();it2++) + for(std::vector< std::vector< MCAuto > >::reverse_iterator it2=_per_type_mesh.rbegin();it2!=_per_type_mesh.rend();it2++) { if((*it2).empty() && isFirst) { @@ -1008,24 +982,24 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const { - for(const auto & it : _per_type_mesh[levId]) - if(it->getFam()==nullptr) + for(std::vector< MCAuto >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++) + if((*it)->getFam()==0) return false; return true; } bool MEDFileUMeshL2::isNumDefinedOnLev(int levId) const { - for(const auto & it : _per_type_mesh[levId]) - if(it->getNum()==nullptr) + for(std::vector< MCAuto >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++) + if((*it)->getNum()==0) return false; return true; } bool MEDFileUMeshL2::isNamesDefinedOnLev(int levId) const { - for(const auto & it : _per_type_mesh[levId]) - if(it->getNames()==nullptr) + for(std::vector< MCAuto >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++) + if((*it)->getNames()==0) return false; return true; } @@ -1056,9 +1030,9 @@ void MEDFileCMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const _cmesh=MEDCouplingCMesh::New(); for(int i=0;i da=DataArrayDouble::New(); da->alloc(nbOfElt,1); da->setInfoOnComponent(0,infosOnComp[i]); @@ -1083,7 +1057,8 @@ med_data_type MEDFileCMeshL2::GetDataTypeCorrespondingToSpaceId(int id) } MEDFileCLMeshL2::MEDFileCLMeshL2() -= default; +{ +} void MEDFileCLMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it) { @@ -1092,7 +1067,7 @@ void MEDFileCLMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const int Mdim; MEDCoupling::MEDCouplingMeshType meshType; MEDCoupling::MEDCouplingAxisType dummy3; - std::vector const infosOnComp(getAxisInfoOnMesh(fid,mId,mName,meshType,dummy3,nstep,Mdim)); + std::vector infosOnComp(getAxisInfoOnMesh(fid,mId,mName,meshType,dummy3,nstep,Mdim)); if(meshType!=CURVE_LINEAR) throw INTERP_KERNEL::Exception("Invalid mesh type ! You are expected a structured one whereas in file it is not a structured !"); _time=mId->checkMeshTimeStep(fid,mName,nstep,dt,it); @@ -1106,7 +1081,7 @@ void MEDFileCLMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const MCAuto stGrid=FromMedIntArray(miStGrid); _clmesh->setNodeGridStructure(stGrid->begin(),stGrid->end()); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - med_int const nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf)); + med_int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf)); MCAuto da=DataArrayDouble::New(); da->alloc(nbNodes,infosOnComp.size()); da->setInfoOnComponents(infosOnComp); @@ -1124,7 +1099,7 @@ MEDFileUMeshPermCompute::MEDFileUMeshPermCompute(const MEDFileUMeshSplitL1* st): MEDFileUMeshPermCompute::operator MEDCouplingUMesh *() const { _st->_num->updateTime(); - if((MEDCouplingUMesh *)_m==nullptr) + if((MEDCouplingUMesh *)_m==0) { updateTime(); _m=static_cast(_st->_m_by_types.getUmesh()->deepCopy()); @@ -1172,12 +1147,12 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other):RefCo { } -MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& /*mName*/, int id):_m(this) +MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id):_m(this) { const std::vector< MCAuto >& v=l2.getLev(id); if(v.empty()) return; - std::size_t const sz=v.size(); + std::size_t sz=v.size(); std::vector ms(sz); std::vector fams(sz),nums(sz); std::vector names(sz); @@ -1291,12 +1266,12 @@ void MEDFileUMeshSplitL1::checkConsistency() const { if (!_fam || _fam->getNumberOfTuples() != getSize()) throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): internal family array has an invalid size!"); - mcIdType const nbCells = getSize(); + mcIdType nbCells = getSize(); if (_num) { _num->checkNbOfTuplesAndComp(nbCells,1,"MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal node numbering array!"); mcIdType pos; - mcIdType const maxValue=_num->getMaxValue(pos); + mcIdType maxValue=_num->getMaxValue(pos); if (!_rev_num || _rev_num->getNumberOfTuples() != (maxValue+1)) throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal revert node numbering array!"); } @@ -1316,7 +1291,7 @@ bool MEDFileUMeshSplitL1::isEqual(const MEDFileUMeshSplitL1 *other, double eps, return false; const DataArrayIdType *d1=_fam; const DataArrayIdType *d2=other->_fam; - if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr)) + if((d1==0 && d2!=0) || (d1!=0 && d2==0)) { what="Presence of family arr in one sublevel and not in other!"; return false; @@ -1329,7 +1304,7 @@ bool MEDFileUMeshSplitL1::isEqual(const MEDFileUMeshSplitL1 *other, double eps, } d1=_num; d2=other->_num; - if((d1==nullptr && d2!=nullptr) || (d1!=nullptr && d2==nullptr)) + if((d1==0 && d2!=0) || (d1!=0 && d2==0)) { what="Presence of cell numbering arr in one sublevel and not in other!"; return false; @@ -1342,7 +1317,7 @@ bool MEDFileUMeshSplitL1::isEqual(const MEDFileUMeshSplitL1 *other, double eps, } const DataArrayAsciiChar *e1=_names; const DataArrayAsciiChar *e2=other->_names; - if((e1==nullptr && e2!=nullptr) || (e1!=nullptr && e2==nullptr)) + if((e1==0 && e2!=0) || (e1!=0 && e2==0)) { what="Presence of cell names arr in one sublevel and not in other!"; return false; @@ -1455,10 +1430,10 @@ int MEDFileUMeshSplitL1::getMeshDimension() const void MEDFileUMeshSplitL1::simpleRepr(std::ostream& oss) const { std::vector code=_m_by_types.getDistributionOfTypes(); - std::size_t const nbOfTypes=code.size()/3; + std::size_t nbOfTypes=code.size()/3; for(std::size_t i=0;i eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd); - auto *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true); + MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true); if(renum) return renumIfNeeded(m,eltsToKeep->begin()); return m; @@ -1514,7 +1489,7 @@ DataArrayIdType *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL: { const DataArrayIdType *fam(_fam); if(!fam) - return nullptr; + return 0; mcIdType start(0),stop(0); _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); return fam->selectByTupleIdSafeSlice(start,stop,1); @@ -1524,7 +1499,7 @@ DataArrayIdType *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL: { const DataArrayIdType *num(_num); if(!num) - return nullptr; + return 0; mcIdType start(0),stop(0); _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); return num->selectByTupleIdSafeSlice(start,stop,1); @@ -1534,7 +1509,7 @@ DataArrayIdType *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField() { if((DataArrayIdType *)_fam) return _fam; - mcIdType const nbOfTuples=_m_by_types.getSize(); + mcIdType nbOfTuples=_m_by_types.getSize(); _fam=DataArrayIdType::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero(); return _fam; } @@ -1573,15 +1548,15 @@ void MEDFileUMeshSplitL1::eraseFamilyField() * This method ignores _m and _m_by_types. */ void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector& ms, std::map& familyIds, - std::map >& /*groups*/) + std::map >& groups) { std::vector< DataArrayIdType * > corr; _m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr); - std::vector< MCAuto > const corrMSafe(corr.begin(),corr.end()); + std::vector< MCAuto > corrMSafe(corr.begin(),corr.end()); std::vector< std::vector > fidsOfGroups; - std::vector< const DataArrayIdType * > const corr2(corr.begin(),corr.end()); + std::vector< const DataArrayIdType * > corr2(corr.begin(),corr.end()); _fam=DataArrayIdType::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups); - mcIdType const nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells(); + mcIdType nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells(); std::map newfams; std::map famIdTrad; TraduceFamilyNumber(fidsOfGroups,familyIds,famIdTrad,newfams); @@ -1592,7 +1567,7 @@ void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector const ms(_m_by_types.getParts()); + std::vector ms(_m_by_types.getParts()); for(auto mesh : ms) { if(mesh) @@ -1603,12 +1578,12 @@ void MEDFileUMeshSplitL1::checkCoordsConsistency(const DataArrayDouble *coords) void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) const { - std::vector const ms(_m_by_types.getParts()); + std::vector ms(_m_by_types.getParts()); mcIdType start=0; - for(auto m : ms) + for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) { - mcIdType const nbCells=m->getNumberOfCells(); - mcIdType const end=start+nbCells; + mcIdType nbCells=(*it)->getNumberOfCells(); + mcIdType end=start+nbCells; MCAuto fam,num; MCAuto names; if((const DataArrayIdType *)_fam) @@ -1617,7 +1592,7 @@ void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) num=_num->subArray(start,end); if((const DataArrayAsciiChar *)_names) names=static_cast(_names->subArray(start,end)); - MEDFileUMeshPerType::Write(fid,mName,mdim,m,fam,num,names); + MEDFileUMeshPerType::Write(fid,mName,mdim,(*it),fam,num,names); start=end; } } @@ -1652,10 +1627,10 @@ void MEDFileUMeshSplitL1::setFamilyArr(DataArrayIdType *famArr) { if(!famArr) { - _fam=nullptr; + _fam=0; return ; } - mcIdType const sz(_m_by_types.getSize()); + mcIdType sz(_m_by_types.getSize()); famArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setFamilyArr : Problem in size of Family arr ! "); famArr->incrRef(); _fam=famArr; @@ -1670,11 +1645,11 @@ void MEDFileUMeshSplitL1::setRenumArr(DataArrayIdType *renumArr) { if(!renumArr) { - _num=nullptr; - _rev_num=nullptr; + _num=0; + _rev_num=0; return ; } - mcIdType const sz(_m_by_types.getSize()); + mcIdType sz(_m_by_types.getSize()); renumArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setRenumArr : Problem in size of numbering arr ! "); renumArr->incrRef(); _num=renumArr; @@ -1685,10 +1660,10 @@ void MEDFileUMeshSplitL1::setNameArr(DataArrayAsciiChar *nameArr) { if(!nameArr) { - _names=nullptr; + _names=0; return ; } - mcIdType const sz(_m_by_types.getSize()); + mcIdType sz(_m_by_types.getSize()); nameArr->checkNbOfTuplesAndComp(sz,MED_SNAME_SIZE,"MEDFileUMeshSplitL1::setNameArr : Problem in size of name arr ! "); nameArr->incrRef(); _names=nameArr; @@ -1696,9 +1671,9 @@ void MEDFileUMeshSplitL1::setNameArr(DataArrayAsciiChar *nameArr) MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds) { - if(renum==nullptr) + if(renum==0) return m; - if(cellIds==nullptr) + if(cellIds==0) m->renumberCells(renum->begin(),true); else { @@ -1722,7 +1697,7 @@ MEDCouplingUMesh *MEDFileUMeshSplitL1::renumIfNeeded(MEDCouplingUMesh *m, const DataArrayIdType *MEDFileUMeshSplitL1::Renumber(const DataArrayIdType *renum, const DataArrayIdType *da) { - if((const DataArrayIdType *)renum==nullptr) + if((const DataArrayIdType *)renum==0) { da->incrRef(); return const_cast(da); @@ -1738,8 +1713,8 @@ DataArrayIdType *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayIdType *da std::vector MEDFileUMeshSplitL1::GetNewFamiliesNumber(mcIdType nb, const std::map& families) { mcIdType id=-1; - for(const auto & familie : families) - id=std::max(id,familie.second); + for(std::map::const_iterator it=families.begin();it!=families.end();it++) + id=std::max(id,(*it).second); if(id==-1) id=0; std::vector ret(nb); @@ -1748,10 +1723,10 @@ std::vector MEDFileUMeshSplitL1::GetNewFamiliesNumber(mcIdType nb, con return ret; } -void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector >& /*fidsGrps*/, std::map& /*familyIds*/, - std::map& /*famIdTrad*/, std::map& /*newfams*/) +void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector >& fidsGrps, std::map& familyIds, + std::map& famIdTrad, std::map& newfams) { - std::set const allfids; + std::set allfids; //tony } @@ -1760,7 +1735,7 @@ void MEDFileUMeshSplitL1::computeRevNum() const mcIdType pos; if(!_num->empty()) { - mcIdType const maxValue=_num->getMaxValue(pos); + mcIdType maxValue=_num->getMaxValue(pos); _rev_num=_num->invertArrayN2O2O2N(maxValue+1); } else @@ -1787,9 +1762,9 @@ void MEDFileUMeshAggregateCompute::setName(const std::string& name) } if(_mp_time>=_m_time) { - for(auto & _m_part : _m_parts) + for(std::vector< MCAuto >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) { - MEDCoupling1GTUMesh *tmp(_m_part); + MEDCoupling1GTUMesh *tmp(*it); if(tmp) tmp->setName(name); } @@ -1798,7 +1773,7 @@ void MEDFileUMeshAggregateCompute::setName(const std::string& name) void MEDFileUMeshAggregateCompute::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts) { - std::size_t const sz(mParts.size()); + std::size_t sz(mParts.size()); std::vector< MCAuto > ret(sz); for(std::size_t i=0;i& partDefs) { if(_mp_time<_m_time) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::assignDefParts : the parts require a computation !"); - std::size_t const sz(partDefs.size()); + std::size_t sz(partDefs.size()); if(_part_def.size()!=partDefs.size() || _part_def.size()!=_m_parts.size()) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::assignDefParts : sizes of vectors of part definition mismatch !"); for(std::size_t i=0;igetNumberOfCells(); mcIdType ret(0); - for(const auto & _m_part : _m_parts) - ret+=_m_part->getNumberOfCells(); + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + ret+=(*it)->getNumberOfCells(); return ret; } @@ -1862,7 +1837,7 @@ std::vector MEDFileUMeshAggregateCompute::get { if(_mp_time>=_m_time) { - std::size_t const sz(_m_parts.size()); + std::size_t sz(_m_parts.size()); std::vector ret(sz); for(std::size_t i=0;igetCellModelEnum(); @@ -1876,9 +1851,9 @@ mcIdType MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::N { if(_mp_time>=_m_time) { - for(const auto & _m_part : _m_parts) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { - const MEDCoupling1GTUMesh *elt(_m_part); + const MEDCoupling1GTUMesh *elt(*it); if(elt && elt->getCellModelEnum()==ct) return elt->getNumberOfCells(); } @@ -1923,7 +1898,7 @@ void MEDFileUMeshAggregateCompute::highlightUsedNodes(std::vector& nodesTo MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const { std::vector v(retrievePartsWithoutComputation()); - std::size_t const sz(v.size()); + std::size_t sz(v.size()); for(std::size_t i=0;i v(retrievePartsWithoutComputation()); - std::size_t const sz(v.size()); + std::size_t sz(v.size()); for(std::size_t i=0;i_m_time) { - for(auto & _m_part : _m_parts) + for(std::vector< MCAuto >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) { - MEDCoupling1GTUMesh *m(_m_part); + MEDCoupling1GTUMesh *m(*it); if(m) m->renumberNodesInConn(newNodeNumbersO2N); } @@ -1988,8 +1963,8 @@ void MEDFileUMeshAggregateCompute::forceComputationOfPartsFromUMesh() const return ;// no needs to compte parts they are already here ! } std::vector ms(m->splitByType()); - std::vector< MCAuto > const msMSafe(ms.begin(),ms.end()); - std::size_t const sz(msMSafe.size()); + std::vector< MCAuto > msMSafe(ms.begin(),ms.end()); + std::size_t sz(msMSafe.size()); _m_parts.resize(sz); for(std::size_t i=0;i& tinyInt, std { if(_mp_time<_m_time) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : the parts require a computation !"); - std::size_t const sz(_m_parts.size()); + std::size_t sz(_m_parts.size()); tinyInt.push_back((mcIdType)sz); for(std::size_t i=0;i& tinyInt, std if(!mesh) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : one part is empty !"); tinyInt.push_back(mesh->getCellModelEnum()); - const auto *mesh1(dynamic_cast(mesh)); - const auto *mesh2(dynamic_cast(mesh)); + const MEDCoupling1SGTUMesh *mesh1(dynamic_cast(mesh)); + const MEDCoupling1DGTUMesh *mesh2(dynamic_cast(mesh)); if(mesh1) { DataArrayIdType *elt(mesh1->getNodalConnectivity()); if(elt) elt->incrRef(); - MCAuto const elt1(elt); + MCAuto elt1(elt); bigArraysI.push_back(elt1); } else if(mesh2) @@ -2070,16 +2045,16 @@ void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { - mcIdType const nbParts(tinyInt.back()); tinyInt.pop_back(); + mcIdType nbParts(tinyInt.back()); tinyInt.pop_back(); _part_def.clear(); _part_def.resize(nbParts); _m_parts.clear(); _m_parts.resize(nbParts); for(mcIdType i=0;i mesh(MEDCoupling1GTUMesh::New(name,tp)); mesh->setCoords(coo); - auto *mesh1(dynamic_cast((MEDCoupling1GTUMesh *) mesh)); - auto *mesh2(dynamic_cast((MEDCoupling1GTUMesh *) mesh)); + MEDCoupling1SGTUMesh *mesh1(dynamic_cast((MEDCoupling1GTUMesh *) mesh)); + MEDCoupling1DGTUMesh *mesh2(dynamic_cast((MEDCoupling1GTUMesh *) mesh)); if(mesh1) { mesh1->setNodalConnectivity(bigArraysI.back()); bigArraysI.pop_back(); @@ -2094,7 +2069,7 @@ void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArra else throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::unserialize : unrecognized single geo type mesh !"); _m_parts[i]=mesh; - mcIdType const pdid(tinyInt.back()); tinyInt.pop_back(); + mcIdType pdid(tinyInt.back()); tinyInt.pop_back(); if(pdid!=-1) _part_def[i]=PartDefinition::Unserialize(tinyInt,bigArraysI); _mp_time=std::max(_mp_time,_m_time)+1; @@ -2121,9 +2096,9 @@ std::size_t MEDFileUMeshAggregateCompute::getTimeOfThis() const std::size_t MEDFileUMeshAggregateCompute::getTimeOfParts() const { std::size_t ret(0); - for(const auto & _m_part : _m_parts) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { - const MEDCoupling1GTUMesh *elt(_m_part); + const MEDCoupling1GTUMesh *elt(*it); if(!elt) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getTimeOfParts : null obj in parts !"); ret=std::max(ret,elt->getTimeOfThis()); @@ -2143,15 +2118,15 @@ std::size_t MEDFileUMeshAggregateCompute::getTimeOfUMesh() const std::size_t MEDFileUMeshAggregateCompute::getHeapMemorySizeWithoutChildren() const { - std::size_t const ret(_m_parts.size()*sizeof(MCAuto)); + std::size_t ret(_m_parts.size()*sizeof(MCAuto)); return ret; } std::vector MEDFileUMeshAggregateCompute::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _m_part : _m_parts) - ret.push_back((const MEDCoupling1GTUMesh *)_m_part); + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + ret.push_back((const MEDCoupling1GTUMesh *)*it); ret.push_back((const MEDCouplingUMesh *)_m); return ret; } @@ -2175,7 +2150,7 @@ MEDFileUMeshAggregateCompute MEDFileUMeshAggregateCompute::deepCopy(DataArrayDou ret._m=static_cast(_m->deepCopy()); ret._m->setCoords(coords); } - std::size_t const sz(_part_def.size()); + std::size_t sz(_part_def.size()); ret._part_def.clear(); ret._part_def.resize(sz); for(std::size_t i=0;i >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) { - const MEDCoupling1GTUMesh *elt(_m_part); + const MEDCoupling1GTUMesh *elt(*it); if(elt) { MCAuto elt2(elt->clone(false)); - _m_part=DynamicCastSafe(elt2); + *it=DynamicCastSafe(elt2); } } const MEDCouplingUMesh *m(_m); @@ -2206,7 +2181,7 @@ bool MEDFileUMeshAggregateCompute::isEqual(const MEDFileUMeshAggregateCompute& o { const MEDCouplingUMesh *m1(getUmesh()); const MEDCouplingUMesh *m2(other.getUmesh()); - if((m1==nullptr && m2!=nullptr) || (m1!=nullptr && m2==nullptr)) + if((m1==0 && m2!=0) || (m1!=0 && m2==0)) { what="Presence of mesh in one sublevel and not in other!"; return false; @@ -2220,7 +2195,7 @@ bool MEDFileUMeshAggregateCompute::isEqual(const MEDFileUMeshAggregateCompute& o return false; } } - std::size_t const sz(_part_def.size()); + std::size_t sz(_part_def.size()); if(sz!=other._part_def.size()) { what=std::string("number of subdivision per geo type for part definition is not the same !"); @@ -2236,7 +2211,7 @@ bool MEDFileUMeshAggregateCompute::isEqual(const MEDFileUMeshAggregateCompute& o what=std::string("a cell part def is defined only for one among this or other !"); return false; } - bool const ret(pd0->isEqual(pd1,what)); + bool ret(pd0->isEqual(pd1,what)); if(!ret) return false; } @@ -2246,24 +2221,25 @@ bool MEDFileUMeshAggregateCompute::isEqual(const MEDFileUMeshAggregateCompute& o void MEDFileUMeshAggregateCompute::checkConsistency() const { if(_mp_time >= _m_time) - for(const auto & _m_part : _m_parts) - _m_part->checkConsistency(); + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin(); + it!=_m_parts.end(); it++) + (*it)->checkConsistency(); else _m->checkConsistency(); } void MEDFileUMeshAggregateCompute::clearNonDiscrAttributes() const { - for(const auto & _m_part : _m_parts) - MEDFileUMeshSplitL1::ClearNonDiscrAttributes(_m_part); + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + MEDFileUMeshSplitL1::ClearNonDiscrAttributes(*it); MEDFileUMeshSplitL1::ClearNonDiscrAttributes(_m); } void MEDFileUMeshAggregateCompute::synchronizeTinyInfo(const MEDFileMesh& master) const { - for(const auto & _m_part : _m_parts) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { - const MEDCoupling1GTUMesh *tmp(_m_part); + const MEDCoupling1GTUMesh *tmp(*it); if(tmp) { (const_cast(tmp))->setName(master.getName().c_str()); @@ -2285,7 +2261,7 @@ void MEDFileUMeshAggregateCompute::synchronizeTinyInfo(const MEDFileMesh& master bool MEDFileUMeshAggregateCompute::empty() const { if(_mp_time<_m_time) - return ((const MEDCouplingUMesh *)_m)==nullptr; + return ((const MEDCouplingUMesh *)_m)==0; //else _mp_time>=_m_time) return _m_parts.empty(); } @@ -2322,9 +2298,9 @@ std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() con else { std::vector ret; - for(const auto & _m_part : _m_parts) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { - const MEDCoupling1GTUMesh *tmp(_m_part); + const MEDCoupling1GTUMesh *tmp(*it); if(!tmp) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getDistributionOfTypes : part mesh contains null instance !"); std::vector ret0(tmp->getDistributionOfTypes()); @@ -2346,9 +2322,9 @@ mcIdType MEDFileUMeshAggregateCompute::getSize() const else { mcIdType ret=0; - for(const auto & _m_part : _m_parts) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { - const MEDCoupling1GTUMesh *m(_m_part); + const MEDCoupling1GTUMesh *m(*it); if(!m) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getSize : part mesh contains null instance !"); ret+=m->getNumberOfCells(); @@ -2359,11 +2335,11 @@ mcIdType MEDFileUMeshAggregateCompute::getSize() const void MEDFileUMeshAggregateCompute::setCoords(DataArrayDouble *coords) { - for(auto & _m_part : _m_parts) + for(std::vector< MCAuto >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) { - MEDCoupling1GTUMesh *tmp(_m_part); + MEDCoupling1GTUMesh *tmp(*it); if(tmp) - _m_part->setCoords(coords); + (*it)->setCoords(coords); } MEDCouplingUMesh *m(_m); if(m) @@ -2385,8 +2361,8 @@ std::vector MEDFileEltStruct4Mesh::getDirec std::vector ret; ret.push_back(_conn); ret.push_back(_common); - for(const auto & _var : _vars) - ret.push_back(_var); + for(std::vector< MCAuto >::const_iterator it=_vars.begin();it!=_vars.end();it++) + ret.push_back(*it); return ret; } @@ -2404,7 +2380,7 @@ MEDFileEltStruct4Mesh::MEDFileEltStruct4Mesh(med_idt fid, const std::string& mNa } MCAuto mss(MEDFileMeshSupports::New(fid)); MCAuto mse(MEDFileStructureElements::New(fid,mss)); - mcIdType const nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name)); + mcIdType nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name)); MCAuto miConn=DataArrayMedInt::New(); miConn->alloc(nCells*nbEntities); MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,miConn->getPointer())); _conn=FromMedIntArray(miConn); @@ -2413,7 +2389,7 @@ MEDFileEltStruct4Mesh::MEDFileEltStruct4Mesh(med_idt fid, const std::string& mNa _common=MEDFileUMeshPerTypeCommon::New(); _common->loadCommonPart(fid,mName.c_str(),dt,it,nCells,geoType,MED_STRUCT_ELEMENT,mrs); std::vector vns(mse->getVarAttsOf(_geo_type_name)); - std::size_t const sz(vns.size()); + std::size_t sz(vns.size()); _vars.resize(sz); for(std::size_t i=0;i #include -#include -#include -#include -#include namespace MEDCoupling { @@ -56,7 +46,7 @@ namespace MEDCoupling protected: MeshOrStructMeshCls(int mid):_mid(mid) { } public: - virtual ~MeshOrStructMeshCls() = default; + virtual ~MeshOrStructMeshCls() {} int getID() const { return _mid; } virtual std::vector getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const = 0; virtual double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const = 0; @@ -68,24 +58,24 @@ namespace MEDCoupling { public: MeshCls(int mid):MeshOrStructMeshCls(mid) { } - std::vector getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const override; - double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const override; + std::vector getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const; + double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const; }; class StructMeshCls : public MeshOrStructMeshCls { public: StructMeshCls(int mid):MeshOrStructMeshCls(mid) { } - std::vector getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const override; - double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const override; + std::vector getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const; + double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const; }; class MEDFileMeshL2 : public RefCountObject { public: MEDFileMeshL2(); - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; const char *getName() const { return _name.getReprForWrite(); } const char *getDescription() const { return _description.getReprForWrite(); } const char *getUnivName() const { return _univ_name.getReprForWrite(); } @@ -215,8 +205,8 @@ MCAuto& _coords, MCAuto& _fam_coords, MCAuto getDirectChildrenWithNull() const override; - std::size_t getHeapMemorySizeWithoutChildren() const override; + std::vector getDirectChildrenWithNull() const; + std::size_t getHeapMemorySizeWithoutChildren() const; private: const MEDFileUMeshSplitL1 *_st; mutable std::size_t _mpt_time; @@ -245,8 +235,8 @@ MCAuto& _coords, MCAuto& _fam_coords, MCAuto getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileUMeshAggregateCompute deepCopy(DataArrayDouble *coords) const; void shallowCpyMeshes(); bool isEqual(const MEDFileUMeshAggregateCompute& other, double eps, std::string& what) const; @@ -286,8 +276,8 @@ MCAuto& _coords, MCAuto& _fam_coords, MCAuto getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileUMeshSplitL1 *shallowCpyUsingCoords(DataArrayDouble *coords) const; MEDFileUMeshSplitL1 *deepCopy(DataArrayDouble *coords) const; void checkConsistency() const; @@ -373,10 +363,10 @@ MCAuto& _coords, MCAuto& _fam_coords, MCAuto getMeshDef() const { return _common; } const std::vector< MCAuto >& getVars() const { return _vars; } private: - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector getDirectChildrenWithNull() const; private: - ~MEDFileEltStruct4Mesh() override = default; + ~MEDFileEltStruct4Mesh() { } private: MEDFileEltStruct4Mesh(med_idt fid, const std::string& mName, int dt, int it, int iterOnStEltOfMesh, MEDFileMeshReadSelector *mrs); private: diff --git a/src/MEDLoader/MEDFileMeshReadSelector.cxx b/src/MEDLoader/MEDFileMeshReadSelector.cxx index fda219370..235ffa282 100644 --- a/src/MEDLoader/MEDFileMeshReadSelector.cxx +++ b/src/MEDLoader/MEDFileMeshReadSelector.cxx @@ -21,10 +21,8 @@ #include "MEDFileMeshReadSelector.hxx" #include "InterpKernelException.hxx" -#include "MCIdType.hxx" -#include -#include +#include using namespace MEDCoupling; @@ -91,7 +89,7 @@ bool MEDFileMeshReadSelector::isGlobalNodeNumFieldReading() const void MEDFileMeshReadSelector::setCellFamilyFieldReading(bool b) { unsigned int code(_code & 0xFFFFFFFE); - unsigned int const b2=b?1:0; + unsigned int b2=b?1:0; //b2<<=0; code+=b2; _code=code; diff --git a/src/MEDLoader/MEDFileMeshReadSelector.hxx b/src/MEDLoader/MEDFileMeshReadSelector.hxx index f88075294..a1f1e3205 100644 --- a/src/MEDLoader/MEDFileMeshReadSelector.hxx +++ b/src/MEDLoader/MEDFileMeshReadSelector.hxx @@ -24,7 +24,6 @@ #include "MCIdType.hxx" -#include #include namespace MEDCoupling diff --git a/src/MEDLoader/MEDFileMeshSupport.cxx b/src/MEDLoader/MEDFileMeshSupport.cxx index 15c280db9..b6e9a605c 100644 --- a/src/MEDLoader/MEDFileMeshSupport.cxx +++ b/src/MEDLoader/MEDFileMeshSupport.cxx @@ -19,31 +19,17 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileMeshSupport.hxx" -#include "MCAuto.hxx" -#include "MEDFileUtilities.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "CellModel.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileMeshLL.hxx" #include "MEDFileSafeCaller.txx" #include "InterpKernelAutoPtr.hxx" -#include -#include -#include -#include "med.h" -#include "medmesh.h" -#include -#include -#include -#include "NormalizedGeometricTypes" using namespace MEDCoupling; MEDFileMeshSupports *MEDFileMeshSupports::New(const std::string& fileName) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid); } @@ -59,31 +45,33 @@ MEDFileMeshSupports *MEDFileMeshSupports::New() MEDFileMeshSupports::MEDFileMeshSupports(med_idt fid) { - med_int const nbSM(MEDnSupportMesh(fid)); + med_int nbSM(MEDnSupportMesh(fid)); _supports.resize(nbSM); for(int i=0;i msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr description(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); med_axis_type axType; - med_int const nAxis(MEDsupportMeshnAxis(fid,i+1)); + med_int nAxis(MEDsupportMeshnAxis(fid,i+1)); INTERP_KERNEL::AutoPtr axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]); med_int spaceDim(0),meshDim(0); MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,msn,&spaceDim,&meshDim,description,&axType,axisName,axisUnit)); - std::string const name(MEDLoaderBase::buildStringFromFortran(msn,MED_NAME_SIZE)); + std::string name(MEDLoaderBase::buildStringFromFortran(msn,MED_NAME_SIZE)); _supports[i]=MEDFileUMesh::New(fid,name); } } MEDFileMeshSupports::MEDFileMeshSupports() -= default; +{ +} MEDFileMeshSupports::~MEDFileMeshSupports() -= default; +{ +} std::vector MEDFileMeshSupports::getDirectChildrenWithNull() const { - std::size_t const sz(_supports.size()); + std::size_t sz(_supports.size()); std::vector ret(sz); for(std::size_t i=0;iwriteLL(fid); + for(std::vector< MCAuto >::const_iterator it=_supports.begin();it!=_supports.end();it++) + if((*it).isNotNull()) + (*it)->writeLL(fid); } std::vector MEDFileMeshSupports::getSupMeshNames() const { std::vector ret; - for(const auto & _support : _supports) - if(_support.isNotNull()) - ret.push_back(_support->getName()); + for(std::vector< MCAuto >::const_iterator it=_supports.begin();it!=_supports.end();it++) + if((*it).isNotNull()) + ret.push_back((*it)->getName()); return ret; } const MEDFileUMesh *MEDFileMeshSupports::getSupMeshWithName(const std::string& name) const { std::vector mns; - for(const auto & _support : _supports) + for(std::vector< MCAuto >::const_iterator it=_supports.begin();it!=_supports.end();it++) { - if(_support.isNotNull()) + if((*it).isNotNull()) { - std::string const na(_support->getName()); + std::string na((*it)->getName()); if(na==name) - return _support; + return *it; else mns.push_back(na); } diff --git a/src/MEDLoader/MEDFileMeshSupport.hxx b/src/MEDLoader/MEDFileMeshSupport.hxx index b51ed45e0..7291e7ea0 100644 --- a/src/MEDLoader/MEDFileMeshSupport.hxx +++ b/src/MEDLoader/MEDFileMeshSupport.hxx @@ -21,18 +21,11 @@ #ifndef __MEDFILEMESHSUPPORT_HXX__ #define __MEDFILEMESHSUPPORT_HXX__ -#include "MCAuto.hxx" -#include "MEDFileUtilities.hxx" -#include "MCType.hxx" #include "MEDLoaderDefines.hxx" +#include "MEDFileUtilities.txx" #include "MEDFileMesh.hxx" #include "MEDCouplingRefCountObject.hxx" -#include -#include "med.h" -#include -#include -#include "NormalizedGeometricTypes" namespace MEDCoupling { @@ -44,16 +37,16 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileMeshSupports *New(); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileMeshSupports"); } public: - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::vector getSupMeshNames() const; MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const; MEDLOADER_EXPORT mcIdType getNumberOfNodesInConnOf(TypeOfField entity, INTERP_KERNEL::NormalizedCellType gt, const std::string& name) const; private: MEDFileMeshSupports(med_idt fid); MEDFileMeshSupports(); - ~MEDFileMeshSupports() override; + ~MEDFileMeshSupports(); private: std::vector< MCAuto > _supports; }; diff --git a/src/MEDLoader/MEDFileParameter.cxx b/src/MEDLoader/MEDFileParameter.cxx index c8de1c530..0c8473f16 100644 --- a/src/MEDLoader/MEDFileParameter.cxx +++ b/src/MEDLoader/MEDFileParameter.cxx @@ -19,29 +19,13 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDFileParameter.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCAuto.hxx" #include "MEDFileSafeCaller.txx" -#include "MEDFileUtilities.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileBasis.hxx" #include "InterpKernelAutoPtr.hxx" -#include "med.h" -#include "medparameter.h" -#include "medfile.h" - -#include -#include -#include -#include -#include -#include + #include -#include -#include -#include -#include using namespace MEDCoupling; @@ -76,7 +60,7 @@ bool MEDFileParameterDouble1TSWTI::isEqual(const MEDFileParameter1TS *other, dou { if(!MEDFileParameter1TS::isEqual(other,eps,what)) return false; - const auto *otherC=dynamic_cast(other); + const MEDFileParameterDouble1TSWTI *otherC=dynamic_cast(other); if(!otherC) { what="IsEqual fails because this is double parameter other no !"; return false; } if(fabs(_arr-otherC->_arr)>eps) @@ -103,7 +87,7 @@ std::string MEDFileParameterDouble1TSWTI::simpleRepr() const void MEDFileParameterDouble1TSWTI::simpleRepr2(int bkOffset, std::ostream& oss) const { - std::string const startOfLine(bkOffset,' '); + std::string startOfLine(bkOffset,' '); oss << startOfLine << "ParameterDoubleItem with (iteration,order) = (" << _iteration << "," << _order << ")" << std::endl; oss << startOfLine << "Time associacited = " << _time << std::endl; oss << startOfLine << "The value is ***** " << _arr << " *****" << std::endl; @@ -195,7 +179,7 @@ void MEDFileParameterTinyInfo::writeLLHeader(med_idt fid, med_parameter_type typ void MEDFileParameterTinyInfo::mainRepr(int bkOffset, std::ostream& oss) const { - std::string const startOfLine(bkOffset,' '); + std::string startOfLine(bkOffset,' '); oss << startOfLine << "Parameter with name \"" << _name << "\"" << std::endl; oss << startOfLine << "Parameter with description \"" << _desc_name << "\"" << std::endl; oss << startOfLine << "Parameter with unit name \"" << _dt_unit << "\"" << std::endl; @@ -222,13 +206,14 @@ MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fil } MEDFileParameterDouble1TS::MEDFileParameterDouble1TS() -= default; +{ +} MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - med_int const nbPar=MEDnParameter(fid); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); + med_int nbPar=MEDnParameter(fid); std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : "; INTERP_KERNEL::AutoPtr pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); @@ -238,7 +223,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName { med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps)); - std::string const paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE); + std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE); if(paramNameCpp==paramName && paramType==MED_FLOAT64) { _dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE); @@ -259,8 +244,8 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - med_int const nbPar=MEDnParameter(fid); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); + med_int nbPar=MEDnParameter(fid); std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : "; INTERP_KERNEL::AutoPtr pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); @@ -270,7 +255,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName { med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps)); - std::string const paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE); + std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE); if(paramNameCpp==paramName && paramType==MED_FLOAT64) { if(nbOfSteps>0) @@ -299,8 +284,8 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName) { MEDFileUtilities::CheckFileForRead(fileName); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - med_int const nbPar=MEDnParameter(fid); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); + med_int nbPar=MEDnParameter(fid); if(nbPar<1) { std::ostringstream oss2; oss2 << "No parameter in file \"" << fileName << "\" !"; @@ -312,7 +297,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName med_parameter_type paramType; med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps)); - std::string const paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE); + std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE); if(paramType==MED_FLOAT64) { if(nbOfSteps>0) @@ -340,7 +325,7 @@ bool MEDFileParameterDouble1TS::isEqual(const MEDFileParameter1TS *other, double { if(!MEDFileParameterDouble1TSWTI::isEqual(other,eps,what)) return false; - const auto *otherC=dynamic_cast(other); + const MEDFileParameterDouble1TS *otherC=dynamic_cast(other); if(!otherC) { what="Other is not of type MEDFileParameterDouble1TS as this"; return false; } if(!isEqualStrings(*otherC,what)) @@ -373,8 +358,8 @@ std::vector MEDFileParameterDouble1TS::getDirectChildre void MEDFileParameterDouble1TS::write(const std::string& fileName, int mode) const { - med_access_mode const medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),medmod); + med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); MEDFileParameterTinyInfo::writeLLHeader(fid,MED_FLOAT64); MEDFileParameterDouble1TSWTI::writeAdvanced(fid,_name,*this); } @@ -386,7 +371,7 @@ MEDFileParameterMultiTS *MEDFileParameterMultiTS::New() MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid); } @@ -397,7 +382,7 @@ MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(med_idt fid) MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName, const std::string& paramName) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,paramName); } @@ -407,22 +392,23 @@ MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(med_idt fid, const std::st } MEDFileParameterMultiTS::MEDFileParameterMultiTS() -= default; +{ +} MEDFileParameterMultiTS::MEDFileParameterMultiTS(const MEDFileParameterMultiTS& other, bool deepCopy):MEDFileParameterTinyInfo(other),_param_per_ts(other._param_per_ts) { if(deepCopy) - for(auto & _param_per_t : _param_per_ts) + for(std::size_t i=0;i<_param_per_ts.size();i++) { - const MEDFileParameter1TS *elt=_param_per_t; + const MEDFileParameter1TS *elt=_param_per_ts[i]; if(elt) - _param_per_t=elt->deepCopy(); + _param_per_ts[i]=elt->deepCopy(); } } MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid) { - med_int const nbPar(MEDnParameter(fid)); + med_int nbPar(MEDnParameter(fid)); if(nbPar<1) { std::ostringstream oss; oss << "MEDFileParameterMultiTS : no parameter in file \"" << FileNameFromFID(fid) << "\" !" ; @@ -434,7 +420,7 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid) med_parameter_type paramType; med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps)); - std::string const paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE)); + std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE)); _dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE); _name=paramNameCpp; _desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE); @@ -443,7 +429,7 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid) MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid, const std::string& paramName) { - med_int const nbPar(MEDnParameter(fid)); + med_int nbPar(MEDnParameter(fid)); std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : "; INTERP_KERNEL::AutoPtr pName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); @@ -453,7 +439,7 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid, const std::string& { med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps)); - std::string const paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE)); + std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE)); if(paramNameCpp==paramName) { if(nbOfSteps>0) @@ -512,8 +498,8 @@ std::size_t MEDFileParameterMultiTS::getHeapMemorySizeWithoutChildren() const std::vector MEDFileParameterMultiTS::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _param_per_t : _param_per_ts) - ret.push_back((const MEDFileParameter1TS *)_param_per_t); + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) + ret.push_back((const MEDFileParameter1TS *)*it); return ret; } @@ -543,17 +529,17 @@ bool MEDFileParameterMultiTS::isEqual(const MEDFileParameterMultiTS *other, doub void MEDFileParameterMultiTS::write(const std::string& fileName, int mode) const { - med_access_mode const medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid const fid=MEDfileOpen(fileName.c_str(),medmod); + med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); writeAdvanced(fid,*this); } void MEDFileParameterMultiTS::writeAdvanced(med_idt fid, const MEDFileWritable& mw) const { std::set diffType; - for(const auto & _param_per_t : _param_per_ts) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { - const MEDFileParameter1TS *elt(_param_per_t); + const MEDFileParameter1TS *elt(*it); if(dynamic_cast(elt)) diffType.insert(MED_FLOAT64); } @@ -561,11 +547,11 @@ void MEDFileParameterMultiTS::writeAdvanced(med_idt fid, const MEDFileWritable& throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::writeAdvanced : impossible to mix type of data in parameters in MED file ! Only float64 or only int32 ..."); if(diffType.empty()) return; - med_parameter_type const typ(*diffType.begin()); + med_parameter_type typ(*diffType.begin()); MEDFileParameterTinyInfo::writeLLHeader(fid,typ); - for(const auto & _param_per_t : _param_per_ts) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { - const MEDFileParameter1TS *elt(_param_per_t); + const MEDFileParameter1TS *elt(*it); if(elt) elt->writeAdvanced(fid,_name,mw); } @@ -581,9 +567,9 @@ std::string MEDFileParameterMultiTS::simpleRepr() const void MEDFileParameterMultiTS::simpleRepr2(int bkOffset, std::ostream& oss) const { MEDFileParameterTinyInfo::mainRepr(bkOffset,oss); - for(const auto & _param_per_t : _param_per_ts) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { - const MEDFileParameter1TS *elt(_param_per_t); + const MEDFileParameter1TS *elt(*it); if(elt) elt->simpleRepr2(bkOffset+2,oss); } @@ -599,7 +585,7 @@ void MEDFileParameterMultiTS::appendValue(int dt, int it, double time, double va double MEDFileParameterMultiTS::getDoubleValue(int iteration, int order) const { - int const pos=getPosOfTimeStep(iteration,order); + int pos=getPosOfTimeStep(iteration,order); const MEDFileParameter1TS *elt=_param_per_ts[pos]; if(!elt) { @@ -607,7 +593,7 @@ double MEDFileParameterMultiTS::getDoubleValue(int iteration, int order) const oss << " exists but elt is empty !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const auto *eltC=dynamic_cast(elt); + const MEDFileParameterDouble1TSWTI *eltC=dynamic_cast(elt); if(!eltC) { std::ostringstream oss; oss << "MEDFileParameterMultiTS::getDoubleValue : time iteration it=" << iteration << " order=" << order; @@ -620,7 +606,7 @@ int MEDFileParameterMultiTS::getPosOfTimeStep(int iteration, int order) const { int ret=0; std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosOfTimeStep : no such iteration=" << iteration << " order=" << order << " ! Possibilities are :"; - for(auto it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++) { const MEDFileParameter1TS *elt(*it); if(elt) @@ -638,7 +624,7 @@ int MEDFileParameterMultiTS::getPosGivenTime(double time, double eps) const { int ret=0; std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosGivenTime : no such time=" << time << " ! Possibilities are :"; - for(auto it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++) { const MEDFileParameter1TS *elt(*it); if(elt) @@ -668,7 +654,7 @@ MEDFileParameter1TS *MEDFileParameterMultiTS::getTimeStepAtPos(int posId) const void MEDFileParameterMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds) { std::vector b(_param_per_ts.size(),true); - int const len=(int)_param_per_ts.size(); + int len=(int)_param_per_ts.size(); for(const int *w=startIds;w!=endIds;w++) if(*w>=0 && *w > paramPerTs(newNb); std::size_t j=0; for(std::size_t i=0;i<_param_per_ts.size();i++) @@ -693,9 +679,9 @@ int MEDFileParameterMultiTS::getNumberOfTS() const std::vector< std::pair > MEDFileParameterMultiTS::getIterations() const { std::vector< std::pair > ret; - for(const auto & _param_per_t : _param_per_ts) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { - const MEDFileParameter1TS *elt(_param_per_t); + const MEDFileParameter1TS *elt(*it); if(elt) ret.push_back(std::pair(elt->getIteration(),elt->getOrder())); } @@ -709,9 +695,9 @@ std::vector< std::pair > MEDFileParameterMultiTS::getTimeSteps(std::vec { std::vector< std::pair > ret0; ret1.clear(); - for(const auto & _param_per_t : _param_per_ts) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { - const MEDFileParameter1TS *elt(_param_per_t); + const MEDFileParameter1TS *elt(*it); if(elt) { ret0.push_back(std::pair(elt->getIteration(),elt->getOrder())); @@ -728,7 +714,7 @@ MEDFileParameters *MEDFileParameters::New() MEDFileParameters *MEDFileParameters::New(const std::string& fileName) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid); } @@ -739,7 +725,7 @@ MEDFileParameters *MEDFileParameters::New(med_idt fid) MEDFileParameters::MEDFileParameters(med_idt fid) { - med_int const nbPar=MEDnParameter(fid); + med_int nbPar=MEDnParameter(fid); _params.resize(nbPar); INTERP_KERNEL::AutoPtr pName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); @@ -749,13 +735,14 @@ MEDFileParameters::MEDFileParameters(med_idt fid) { med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps)); - std::string const paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE)); + std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE)); _params[i]=MEDFileParameterMultiTS::New(fid,paramNameCpp); } } MEDFileParameters::MEDFileParameters() -= default; +{ +} std::size_t MEDFileParameters::getHeapMemorySizeWithoutChildren() const { @@ -767,8 +754,8 @@ std::size_t MEDFileParameters::getHeapMemorySizeWithoutChildren() const std::vector MEDFileParameters::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _param : _params) - ret.push_back((const MEDFileParameterMultiTS *)_param); + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++) + ret.push_back((const MEDFileParameterMultiTS *)*it); return ret; } @@ -799,19 +786,19 @@ bool MEDFileParameters::isEqual(const MEDFileParameters *other, double eps, std: MEDFileParameters::MEDFileParameters(const MEDFileParameters& other, bool deepCopy):MEDFileWritableStandAlone(other),_params(other._params) { if(deepCopy) - for(auto & _param : _params) + for(std::size_t i=0;i<_params.size();i++) { - const MEDFileParameterMultiTS *elt=_param; + const MEDFileParameterMultiTS *elt=_params[i]; if(elt) - _param=elt->deepCopy(); + _params[i]=elt->deepCopy(); } } void MEDFileParameters::writeLL(med_idt fid) const { - for(const auto & _param : _params) + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++) { - const MEDFileParameterMultiTS *elt(_param); + const MEDFileParameterMultiTS *elt(*it); if(elt) elt->writeAdvanced(fid,*this); } @@ -821,7 +808,7 @@ std::vector MEDFileParameters::getParamsNames() const { std::vector ret(_params.size()); int i=0; - for(auto it=_params.begin();it!=_params.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++,i++) { const MEDFileParameterMultiTS *p=(*it); if(p) @@ -846,9 +833,9 @@ std::string MEDFileParameters::simpleRepr() const void MEDFileParameters::simpleReprWithoutHeader(std::ostream& oss) const { - for(const auto & _param : _params) + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++) { - const MEDFileParameterMultiTS *elt(_param); + const MEDFileParameterMultiTS *elt(*it); if(elt) elt->simpleRepr2(2,oss); } @@ -865,7 +852,7 @@ void MEDFileParameters::pushParam(MEDFileParameterMultiTS *param) { if(param) param->incrRef(); - MCAuto const elt(param); + MCAuto elt(param); _params.push_back(elt); } @@ -877,7 +864,7 @@ void MEDFileParameters::setParamAtPos(int i, MEDFileParameterMultiTS *param) _params.resize(i+1); if(param) param->incrRef(); - MCAuto const elt(param); + MCAuto elt(param); _params[i]=elt; } @@ -900,7 +887,7 @@ MEDFileParameterMultiTS *MEDFileParameters::getParamAtPos(int i) const */ MEDFileParameterMultiTS *MEDFileParameters::getParamWithName(const std::string& paramName) const { - int const pos=getPosFromParamName(paramName); + int pos=getPosFromParamName(paramName); return getParamAtPos(pos); } @@ -911,14 +898,14 @@ void MEDFileParameters::destroyParamAtPos(int i) std::ostringstream oss; oss << "MEDFileParameters::destroyParamAtPos : should be in [0," << _params.size() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - _params[i]=MCAuto(nullptr); + _params[i]=MCAuto(0); } int MEDFileParameters::getPosFromParamName(const std::string& paramName) const { std::ostringstream oss; oss << "MEDFileParameters::getPosFromParamName : no such name=" << paramName << " ! Possibilities are :"; int ret=0; - for(auto it=_params.begin();it!=_params.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++,ret++) { const MEDFileParameterMultiTS *elt(*it); if(elt) diff --git a/src/MEDLoader/MEDFileParameter.hxx b/src/MEDLoader/MEDFileParameter.hxx index ff8844fa4..42991e8dc 100644 --- a/src/MEDLoader/MEDFileParameter.hxx +++ b/src/MEDLoader/MEDFileParameter.hxx @@ -21,17 +21,10 @@ #ifndef __MEDFILEPARAMETER_HXX__ #define __MEDFILEPARAMETER_HXX__ -#include "MEDCouplingRefCountObject.hxx" -#include "MEDFileUtilities.txx" #include "MEDLoaderDefines.hxx" +#include "MEDFileUtilities.txx" #include "MEDCouplingMemArray.hxx" #include "MCAuto.hxx" -#include -#include -#include "med.h" -#include -#include -#include namespace MEDCoupling { @@ -66,21 +59,21 @@ namespace MEDCoupling public: MEDLOADER_EXPORT static MEDFileParameterDouble1TSWTI *New(int iteration, int order, double time); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileParameterDouble1TSWTI"); } - MEDLOADER_EXPORT MEDFileParameter1TS *deepCopy() const override; + MEDLOADER_EXPORT MEDFileParameter1TS *deepCopy() const; MEDLOADER_EXPORT void setValue(double val) { _arr=val; } MEDLOADER_EXPORT double getValue() const { return _arr; } - MEDLOADER_EXPORT bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const override; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; - MEDLOADER_EXPORT void readValue(med_idt fid, const std::string& name) override; + MEDLOADER_EXPORT bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; + MEDLOADER_EXPORT void readValue(med_idt fid, const std::string& name); MEDLOADER_EXPORT std::string simpleRepr() const; protected: MEDFileParameterDouble1TSWTI(); MEDFileParameterDouble1TSWTI(int iteration, int order, double time); - void simpleRepr2(int bkOffset, std::ostream& oss) const override; + void simpleRepr2(int bkOffset, std::ostream& oss) const; void finishLoading(med_idt fid, const std::string& name, int dt, int it, int nbOfSteps); void finishLoading(med_idt fid, const std::string& name, int timeStepId); - void writeAdvanced(med_idt fid, const std::string& name, const MEDFileWritable& mw) const override; + void writeAdvanced(med_idt fid, const std::string& name, const MEDFileWritable& mw) const; protected: double _arr; }; @@ -111,11 +104,11 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName); MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileParameterDouble1TS"); } - MEDLOADER_EXPORT MEDFileParameter1TS *deepCopy() const override; - MEDLOADER_EXPORT bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const override; + MEDLOADER_EXPORT virtual MEDFileParameter1TS *deepCopy() const; + MEDLOADER_EXPORT virtual bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const; MEDLOADER_EXPORT virtual std::string simpleRepr() const; - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } MEDLOADER_EXPORT std::string getName() const { return _name; } MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; @@ -137,8 +130,8 @@ namespace MEDCoupling MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileParameterMultiTS"); } MEDLOADER_EXPORT std::string getName() const { return _name; } MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileParameterMultiTS *deepCopy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileParameterMultiTS *other, double eps, std::string& what) const; MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; @@ -172,11 +165,11 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileParameters *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileParameters *New(const std::string& fileName); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileParameters"); } - MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const override; - MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const override; + MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileParameters *deepCopy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileParameters *other, double eps, std::string& what) const; - MEDLOADER_EXPORT void writeLL(med_idt fid) const override; + MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::vector getParamsNames() const; MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const; diff --git a/src/MEDLoader/MEDFileSafeCaller.txx b/src/MEDLoader/MEDFileSafeCaller.txx index 6dfd21e7e..c43ef45cf 100644 --- a/src/MEDLoader/MEDFileSafeCaller.txx +++ b/src/MEDLoader/MEDFileSafeCaller.txx @@ -21,8 +21,11 @@ #ifndef __MEDFILESAFECALLER_TXX__ #define __MEDFILESAFECALLER_TXX__ +#include "med.h" +#include "InterpKernelException.hxx" +#include // TXX extension to avoid to be installed. diff --git a/src/MEDLoader/MEDFileStructureElement.cxx b/src/MEDLoader/MEDFileStructureElement.cxx index d2d56f5ed..7c3bd5f81 100644 --- a/src/MEDLoader/MEDFileStructureElement.cxx +++ b/src/MEDLoader/MEDFileStructureElement.cxx @@ -19,26 +19,12 @@ // Author : Anthony Geay (EDF R&D) #include "MEDFileStructureElement.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCIdType.hxx" -#include "MEDFileBasis.hxx" #include "MEDFileMeshSupport.hxx" -#include "MEDFileUtilities.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileMeshLL.hxx" #include "MEDFileSafeCaller.txx" #include "InterpKernelAutoPtr.hxx" -#include -#include -#include "NormalizedGeometricTypes" -#include "med.h" -#include "medstructelement.h" -#include -#include using namespace MEDCoupling; @@ -72,14 +58,14 @@ MEDFileSEConstAtt *MEDFileSEConstAtt::New(med_idt fid, MEDFileStructureElement * MEDFileSEConstAtt::MEDFileSEConstAtt(med_idt fid, MEDFileStructureElement *father, int idCstAtt, const MEDFileUMesh *mesh):MEDFileSEHolder(father) { - std::string const modelName(getModelName()); + std::string modelName(getModelName()); INTERP_KERNEL::AutoPtr constattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_attribute_type constatttype; med_int nbCompo; med_entity_type met; med_int miPflSz; MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&miPflSz)); - std::string const name(MEDLoaderBase::buildStringFromFortran(constattname,MED_NAME_SIZE)); + std::string name(MEDLoaderBase::buildStringFromFortran(constattname,MED_NAME_SIZE)); setName(name); setProfile(MEDLoaderBase::buildStringFromFortran(profilename,MED_NAME_SIZE)); _tof=MEDFileMesh::ConvertFromMEDFileEntity(met); @@ -151,7 +137,7 @@ MEDFileSEVarAtt *MEDFileSEVarAtt::New(med_idt fid, MEDFileStructureElement *fath MEDFileSEVarAtt::MEDFileSEVarAtt(med_idt fid, MEDFileStructureElement *father, int idVarAtt):MEDFileSEHolder(father) { - std::string const modelName(getModelName()); + std::string modelName(getModelName()); INTERP_KERNEL::AutoPtr varattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_attribute_type varatttype; { @@ -215,10 +201,10 @@ MEDFileStructureElement::MEDFileStructureElement(med_idt fid, int idSE, const ME std::vector MEDFileStructureElement::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & it : _cst_att) - ret.push_back(it); - for(const auto & it : _var_att) - ret.push_back(it); + for(std::vector< MCAuto >::const_iterator it=_cst_att.begin();it!=_cst_att.end();it++) + ret.push_back(*it); + for(std::vector< MCAuto >::const_iterator it=_var_att.begin();it!=_var_att.end();it++) + ret.push_back(*it); return ret; } @@ -294,18 +280,18 @@ std::string MEDFileStructureElement::getMeshName() const std::vector MEDFileStructureElement::getVarAtts() const { std::vector ret; - for(const auto & it : _var_att) - if(it.isNotNull()) - ret.push_back(it->getName()); + for(std::vector< MCAuto >::const_iterator it=_var_att.begin();it!=_var_att.end();it++) + if((*it).isNotNull()) + ret.push_back((*it)->getName()); return ret; } const MEDFileSEVarAtt *MEDFileStructureElement::getVarAtt(const std::string& varName) const { - for(const auto & it : _var_att) - if(it.isNotNull()) - if(it->getName()==varName) - return it; + for(std::vector< MCAuto >::const_iterator it=_var_att.begin();it!=_var_att.end();it++) + if((*it).isNotNull()) + if((*it)->getName()==varName) + return *it; std::ostringstream oss; oss << "MEDFileStructureElement::getVarAtt : no var att with name \"" << varName << "\" !"; throw INTERP_KERNEL::Exception(oss.str()); } @@ -314,7 +300,7 @@ const MEDFileSEVarAtt *MEDFileStructureElement::getVarAtt(const std::string& var MEDFileStructureElements *MEDFileStructureElements::New(const std::string& fileName, const MEDFileMeshSupports *ms) { - MEDFileUtilities::AutoFid const fid(OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); return New(fid,ms); } @@ -331,8 +317,8 @@ MEDFileStructureElements *MEDFileStructureElements::New() std::vector MEDFileStructureElements::getDirectChildrenWithNull() const { std::vector ret; - for(const auto & _elem : _elems) - ret.push_back(_elem); + for(std::vector< MCAuto >::const_iterator it=_elems.begin();it!=_elems.end();it++) + ret.push_back(*it); return ret; } @@ -347,7 +333,7 @@ void MEDFileStructureElements::writeLL(med_idt fid) const MEDFileStructureElements::MEDFileStructureElements(med_idt fid, const MEDFileMeshSupports *ms) { - med_int const nbSE(MEDnStructElement(fid)); + med_int nbSE(MEDnStructElement(fid)); _elems.resize(nbSE); for(int i=0;i MEDFileStructureElements::getDynGTAvail() const { std::vector ret; - for(const auto & _elem : _elems) + for(std::vector< MCAuto >::const_iterator it=_elems.begin();it!=_elems.end();it++) { - const MEDFileStructureElement *elt(_elem); + const MEDFileStructureElement *elt(*it); if(elt) ret.push_back(elt->getDynGT()); } @@ -379,11 +367,11 @@ std::vector MEDFileStructureElements::getDynGTAvail() const const MEDFileStructureElement *MEDFileStructureElements::getWithGT(int idGT) const { - for(const auto & _elem : _elems) - if(_elem.isNotNull()) + for(std::vector< MCAuto >::const_iterator it=_elems.begin();it!=_elems.end();it++) + if((*it).isNotNull()) { - if(_elem->getDynGT()==idGT) - return _elem; + if((*it)->getDynGT()==idGT) + return *it; } std::ostringstream oss; oss << "MEDFileStructureElements::getWithGT : no such geo type " << idGT << " !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -394,17 +382,17 @@ mcIdType MEDFileStructureElements::getNumberOfNodesPerSE(const std::string& seNa if(seName=="MED_PARTICLE") return 1; const MEDFileStructureElement *se(getSEWithName(seName)); - std::string const meshName(se->getMeshName()); + std::string meshName(se->getMeshName()); return _sup->getNumberOfNodesInConnOf(se->getEntity(),se->getGeoType(),meshName); } const MEDFileStructureElement *MEDFileStructureElements::getSEWithName(const std::string& seName) const { - for(const auto & _elem : _elems) + for(std::vector< MCAuto >::const_iterator it=_elems.begin();it!=_elems.end();it++) { - if(_elem.isNotNull()) - if(_elem->getName()==seName) - return _elem; + if((*it).isNotNull()) + if((*it)->getName()==seName) + return *it; } std::ostringstream oss; oss << "MEDFileStructureElements::getSEWithName : no such structure element with name " << seName << " !"; throw INTERP_KERNEL::Exception(oss.str()); diff --git a/src/MEDLoader/MEDFileStructureElement.hxx b/src/MEDLoader/MEDFileStructureElement.hxx index 542250950..21a0dd5e1 100644 --- a/src/MEDLoader/MEDFileStructureElement.hxx +++ b/src/MEDLoader/MEDFileStructureElement.hxx @@ -21,19 +21,11 @@ #ifndef __MEDFILESTRUCTUREELEMENT_HXX__ #define __MEDFILESTRUCTUREELEMENT_HXX__ -#include "MEDFileUtilities.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCType.hxx" #include "MEDLoaderDefines.hxx" +#include "MEDFileUtilities.txx" #include "MEDFileMesh.hxx" #include "MEDCouplingRefCountObject.hxx" -#include -#include -#include -#include "med.h" -#include "NormalizedGeometricTypes" namespace MEDCoupling { @@ -61,9 +53,9 @@ class MEDFileSEConstAtt : public RefCountObject, public MEDFileWritableStandAlon static MEDFileSEConstAtt *New(med_idt fid, MEDFileStructureElement *father, int idCstAtt, const MEDFileUMesh *mesh); public: std::string getClassName() const override { return std::string("MEDFileSEConstAtt"); } - std::vector getDirectChildrenWithNull() const override; - std::size_t getHeapMemorySizeWithoutChildren() const override; - void writeLL(med_idt fid) const override; + std::vector getDirectChildrenWithNull() const; + std::size_t getHeapMemorySizeWithoutChildren() const; + void writeLL(med_idt fid) const; void setProfile(const std::string& name); std::string getProfile() const; private: @@ -80,9 +72,9 @@ class MEDFileSEConstAtt : public RefCountObject, public MEDFileWritableStandAlon static MEDFileSEVarAtt *New(med_idt fid, MEDFileStructureElement *father, int idVarAtt); public: std::string getClassName() const override { return std::string("MEDFileSEVarAtt"); } - std::vector getDirectChildrenWithNull() const override; - std::size_t getHeapMemorySizeWithoutChildren() const override; - void writeLL(med_idt fid) const override; + std::vector getDirectChildrenWithNull() const; + std::size_t getHeapMemorySizeWithoutChildren() const; + void writeLL(med_idt fid) const; int getNbOfComponents() const { return _nb_compo; } MCAuto getGenerator() const { return _gen; } private: @@ -105,9 +97,9 @@ class MEDFileSEConstAtt : public RefCountObject, public MEDFileWritableStandAlon MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileStructureElement"); } MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _geo_type; } public: - std::vector getDirectChildrenWithNull() const override; - std::size_t getHeapMemorySizeWithoutChildren() const override; - void writeLL(med_idt fid) const override; + std::vector getDirectChildrenWithNull() const; + std::size_t getHeapMemorySizeWithoutChildren() const; + void writeLL(med_idt fid) const; public: static MCAuto BuildFrom(med_attribute_type mat); static int EffectiveNbCompo(med_attribute_type mat, int nbCompo); @@ -140,13 +132,13 @@ class MEDFileSEConstAtt : public RefCountObject, public MEDFileWritableStandAlon MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAttOf(const std::string &seName, const std::string& varName) const; MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const; public: - std::vector getDirectChildrenWithNull() const override; - std::size_t getHeapMemorySizeWithoutChildren() const override; - void writeLL(med_idt fid) const override; + std::vector getDirectChildrenWithNull() const; + std::size_t getHeapMemorySizeWithoutChildren() const; + void writeLL(med_idt fid) const; private: MEDFileStructureElements(med_idt fid, const MEDFileMeshSupports *ms); MEDFileStructureElements(); - ~MEDFileStructureElements() override; + ~MEDFileStructureElements(); private: std::vector< MCAuto > _elems; MCConstAuto _sup; diff --git a/src/MEDLoader/MEDFileUtilities.cxx b/src/MEDLoader/MEDFileUtilities.cxx index dbe10697d..2f8beeeae 100644 --- a/src/MEDLoader/MEDFileUtilities.cxx +++ b/src/MEDLoader/MEDFileUtilities.cxx @@ -19,19 +19,15 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDFileUtilities.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDFileSafeCaller.txx" #include "MEDLoaderBase.hxx" #include "MEDLoader.hxx" +#include "MEDFileBasis.hxx" #include "InterpKernelAutoPtr.hxx" -#include "med.h" -#include "medfile.h" #include -#include +#include const char MEDCoupling::MEDFileWritableStandAlone::DFT_FILENAME_IN_MEM[]="DftFileNameInMemory"; @@ -71,7 +67,7 @@ const char *MEDFileUtilities::GetReadableMEDFieldType(med_field_type ft) } } -void MEDFileUtilities::CheckMEDCode(int code, med_idt /*fid*/, const std::string& msg) +void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const std::string& msg) { if(code<0) { @@ -83,7 +79,7 @@ void MEDFileUtilities::CheckMEDCode(int code, med_idt /*fid*/, const std::strin void MEDFileUtilities::CheckFileForRead(const std::string& fileName) { - int const status=MEDLoaderBase::getStatusOfFile(fileName); + int status=MEDLoaderBase::getStatusOfFile(fileName); std::ostringstream oss; oss << " File : \"" << fileName << "\""; switch(status) @@ -104,7 +100,7 @@ void MEDFileUtilities::CheckFileForRead(const std::string& fileName) throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - AutoFid const fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); + AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); if(fid<0) { oss << " has been detected as unreadable by MED file : impossible to read anything !"; @@ -163,7 +159,7 @@ void MEDCoupling::MEDFileWritable::setZipConnPolicy(int newVal) std::string MEDCoupling::MEDFileWritable::FileNameFromFID(med_idt fid) { - med_int const lgth(MEDfileName(fid,nullptr,0)); + med_int lgth(MEDfileName(fid,0,0)); if(lgth<=0) return std::string(); INTERP_KERNEL::AutoPtr tmp(new char[lgth+1]); @@ -190,8 +186,8 @@ MEDFileUtilities::AutoFid MEDCoupling::OpenMEDFileForRead(const std::string& fil */ void MEDCoupling::MEDFileWritableStandAlone::write(const std::string& fileName, int mode) const { - med_access_mode const medmod(MEDFileUtilities::TraduceWriteMode(mode)); - MEDFileUtilities::AutoFid const fid(MEDfileOpen(fileName.c_str(),medmod)); + med_access_mode medmod(MEDFileUtilities::TraduceWriteMode(mode)); + MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),medmod)); std::ostringstream oss; oss << "MEDFileWritableStandAlone : error on attempt to write in file : \"" << fileName << "\""; MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str()); writeLL(fid); @@ -215,8 +211,8 @@ void MEDCoupling::MEDFileWritableStandAlone::write40(const std::string& fileName void MEDCoupling::MEDFileWritableStandAlone::writeXX(const std::string& fileName, int mode, med_int maj, med_int min, med_int rel) const { #if ( MED_NUM_MAJEUR>4 || ( MED_NUM_MAJEUR==4 && MED_NUM_MINEUR>=1 ) ) - med_access_mode const medmod(MEDFileUtilities::TraduceWriteMode(mode)); - MEDFileUtilities::AutoFid const fid(MEDfileVersionOpen(fileName.c_str(),medmod,maj,min,rel)); + med_access_mode medmod(MEDFileUtilities::TraduceWriteMode(mode)); + MEDFileUtilities::AutoFid fid(MEDfileVersionOpen(fileName.c_str(),medmod,maj,min,rel)); writeLL(fid); #else std::ostringstream oss; oss << "MEDFileWritableStandAlone::write" << maj << min << " : the MED version used to compile medcoupling is " << MEDFileVersionStr() << " ! If you need this feature please use version >= 4.1."; @@ -227,12 +223,12 @@ void MEDCoupling::MEDFileWritableStandAlone::writeXX(const std::string& fileName MEDCoupling::MCAuto MEDCoupling::MEDFileWritableStandAlone::serialize() const { med_memfile memfile=MED_MEMFILE_INIT; - memfile.app_image_ptr=nullptr; + memfile.app_image_ptr=0; memfile.app_image_size=0; // - std::string const dftFileName(GenerateUniqueDftFileNameInMem()); + std::string dftFileName(GenerateUniqueDftFileNameInMem()); {// very important to let this braces ! The AutoFid destructor must be called, to have a "clean" memfile.app_image_ptr pointer embedded in the returned object. - MEDFileUtilities::AutoFid const fid(MEDmemFileOpen(dftFileName.c_str(),&memfile,MED_FALSE,MED_ACC_CREAT)); + MEDFileUtilities::AutoFid fid(MEDmemFileOpen(dftFileName.c_str(),&memfile,MED_FALSE,MED_ACC_CREAT)); writeLL(fid); } // diff --git a/src/MEDLoader/MEDFileUtilities.hxx b/src/MEDLoader/MEDFileUtilities.hxx index e2cdb0892..bb0568e25 100644 --- a/src/MEDLoader/MEDFileUtilities.hxx +++ b/src/MEDLoader/MEDFileUtilities.hxx @@ -21,13 +21,13 @@ #ifndef __MEDFILEUTILITIES_HXX__ #define __MEDFILEUTILITIES_HXX__ +#include "InterpKernelException.hxx" #include "MEDLoaderDefines.hxx" #include "MCAuto.hxx" #include "MEDCouplingMemArray.hxx" #include "med.h" -#include namespace MEDFileUtilities { @@ -53,7 +53,7 @@ namespace MEDCoupling { public: MEDFileWritable(); - virtual ~MEDFileWritable() = default; + virtual ~MEDFileWritable() {} void copyOptionsFrom(const MEDFileWritable& other) const; int getTooLongStrPolicy() const; void setTooLongStrPolicy(int newVal); diff --git a/src/MEDLoader/MEDFileUtilities.txx b/src/MEDLoader/MEDFileUtilities.txx index c1b7e6e5c..772b4fc44 100644 --- a/src/MEDLoader/MEDFileUtilities.txx +++ b/src/MEDLoader/MEDFileUtilities.txx @@ -21,11 +21,7 @@ #ifndef __MEDFILEUTILITIES_TXX__ #define __MEDFILEUTILITIES_TXX__ -#include "MEDCouplingMemArray.hxx" #include "MEDFileUtilities.hxx" -#include "med.h" -#include -#include "medfile.h" template T *MEDCoupling::MEDFileWritableStandAlone::BuildFromMemoryChunk(MEDCoupling::DataArrayByte *db) @@ -36,7 +32,7 @@ T *MEDCoupling::MEDFileWritableStandAlone::BuildFromMemoryChunk(MEDCoupling::Dat med_memfile memfile=MED_MEMFILE_INIT; memfile.app_image_ptr=db->getPointer(); memfile.app_image_size=db->getNbOfElems(); - std::string const dftFileName(MEDCoupling::MEDFileWritableStandAlone::GenerateUniqueDftFileNameInMem()); + std::string dftFileName(MEDCoupling::MEDFileWritableStandAlone::GenerateUniqueDftFileNameInMem()); MEDFileUtilities::AutoFid fid(MEDmemFileOpen(dftFileName.c_str(),&memfile,MED_FALSE,MED_ACC_RDWR)); return T::New(fid); } diff --git a/src/MEDLoader/MEDFilterEntity.hxx b/src/MEDLoader/MEDFilterEntity.hxx index 898b15f24..3f0d05551 100644 --- a/src/MEDLoader/MEDFilterEntity.hxx +++ b/src/MEDLoader/MEDFilterEntity.hxx @@ -21,17 +21,9 @@ #ifndef __MEDFILTERENTITY_HXX__ #define __MEDFILTERENTITY_HXX__ -#include "MCType.hxx" -#include "MCAuto.hxx" #include "MEDCouplingPartDefinition.hxx" -#include "InterpKernelException.hxx" -#include "MEDFileBasis.hxx" #include "med.h" -#include "medfilter.h" -#include -#include #include -#include namespace MEDCoupling { @@ -74,12 +66,12 @@ namespace MEDCoupling const med_int constituentSelect, const med_switch_mode switchMode, const med_storage_mode storageMode, const char * const profileName, const PartDefinition* pd) { - const auto *spd(dynamic_cast(pd)); + const SlicePartDefinition *spd(dynamic_cast(pd)); if(spd) { //Here, pd contains a slice, so it's more efficient to define a filter of block //(which will load contiguous values) - mcIdType const nbOfEltsToLoad = spd->getNumberOfElems(); + mcIdType nbOfEltsToLoad = spd->getNumberOfElems(); mcIdType strt,end,step; spd->getSlice(strt,end,step); if(strt<0) @@ -92,10 +84,10 @@ namespace MEDCoupling /*lastblocksize=useless because count=1*/0,_filter.get()); return; } - const auto *dpd(dynamic_cast(pd)); + const DataArrayPartDefinition *dpd(dynamic_cast(pd)); if(dpd) { - mcIdType const nbOfEltsToLoad = dpd->getNumberOfElems(); + mcIdType nbOfEltsToLoad = dpd->getNumberOfElems(); //convert to fortran indexing std::vector dpdPlus1; diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index 91a0de39b..214b19740 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -19,14 +19,6 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDLoader.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" -#include "MEDFileBasis.hxx" -#include "MEDFileFieldMultiTS.hxx" -#include "MEDFileField1TS.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingCMesh.hxx" -#include "MEDCouplingCurveLinearMesh.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileUtilities.hxx" #include "MEDLoaderNS.hxx" @@ -46,27 +38,17 @@ #include "InterpKernelAutoPtr.hxx" -#include "NormalizedGeometricTypes" -#include "MEDLoaderTraits.hxx" #include "med.h" -#include "medmesh.h" -#include "medlibrary.h" -#include "medfile.h" -#include "medfield.h" -#include "medfamily.h" -#include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include -#include -#include +#include extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO]; extern med_geometry_type typmainoeud[1]; @@ -193,7 +175,7 @@ INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype) int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector& possibilities) { possibilities.clear(); - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); int ret; std::set poss; char nommaa[MED_NAME_SIZE+1]; @@ -201,12 +183,12 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st med_mesh_type type_maillage; med_int Sdim,Mdim; std::string trueMeshName; - int const meshId=FromMedInt(getIdFromMeshName(fid,meshName,trueMeshName)); + int meshId=FromMedInt(getIdFromMeshName(fid,meshName,trueMeshName)); INTERP_KERNEL::AutoPtr dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); med_sorting_type sortingType; med_int nstep; med_axis_type axisType; - med_int const naxis(MEDmeshnAxis(fid,meshId)); + med_int naxis(MEDmeshnAxis(fid,meshId)); INTERP_KERNEL::AutoPtr axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit)); @@ -221,24 +203,24 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st // endlimitation for(int i=0;i0) { - INTERP_KERNEL::NormalizedCellType const type=typmai2[i]; - int const curDim=(int)INTERP_KERNEL::CellModel::GetCellModel(type).getDimension(); + INTERP_KERNEL::NormalizedCellType type=typmai2[i]; + int curDim=(int)INTERP_KERNEL::CellModel::GetCellModel(type).getDimension(); poss.insert(curDim); } } if(!poss.empty()) { ret=*poss.rbegin(); - for(auto it=poss.rbegin();it!=poss.rend();it++) + for(std::set::const_reverse_iterator it=poss.rbegin();it!=poss.rend();it++) possibilities.push_back(*it-ret); } else @@ -256,11 +238,11 @@ int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std trueMeshName=meshes[0]; return 1; } - std::string const meshNameStr(meshName); + std::string meshNameStr(meshName); std::vector meshes=getMeshNamesFid(fid); if(meshes.empty()) throw INTERP_KERNEL::Exception("No mesh in file"); - auto const iter=std::find(meshes.begin(),meshes.end(),meshNameStr); + std::vector::iterator iter=std::find(meshes.begin(),meshes.end(),meshNameStr); if(iter==meshes.end()) { std::ostringstream os2; @@ -282,16 +264,16 @@ std::vector MEDLoaderNS::getMeshNamesFid(med_idt fid) char nommaa[MED_NAME_SIZE+1]; med_axis_type axistype; med_sorting_type stype; - med_int const n=MEDnMesh(fid); + med_int n=MEDnMesh(fid); std::vector ret(n); for(int i=0;i axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); med_int nstep; MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&space_dim,&mesh_dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit)); - std::string const cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa)); + std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa)); ret[i]=cur; } return ret; @@ -336,11 +318,11 @@ std::string MEDCoupling::MEDFileVersionStr() char buf[SZ]; std::fill(buf,buf+SZ,'\0'); const char START_EXPECTED[]="MED-"; - med_err const ret(MEDlibraryStrVersion(buf)); + med_err ret(MEDlibraryStrVersion(buf)); if(ret!=0) throw INTERP_KERNEL::Exception("MEDFileVersionStr : fail to find version of MED file ! It looks very bad !"); - std::string const zeRet(buf); - std::size_t const pos(zeRet.find(START_EXPECTED,0)); + std::string zeRet(buf); + std::size_t pos(zeRet.find(START_EXPECTED,0)); if(pos!=0) { std::ostringstream oss; oss << "MEDFileVersionStr : internal error ! The MEDFile returned version (\"" << zeRet << "\") has not the right pattern !"; @@ -352,14 +334,14 @@ std::string MEDCoupling::MEDFileVersionStr() std::string MEDCoupling::MEDFileVersionOfFileStr(const std::string& fileName) { #if MED_NUM_MAJEUR>3 || ( MED_NUM_MAJEUR==3 && ( (MED_NUM_MINEUR==2 && MED_NUM_RELEASE>=1) || MED_NUM_MINEUR>=3) ) - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); const int SZ=20; const char START_EXPECTED[]="MED-"; char buf[SZ]; std::fill(buf,buf+SZ,'\0'); MEDFILESAFECALLERRD0(MEDfileStrVersionRd,(fid,buf)); - std::string const ret(buf); - std::size_t const pos(ret.find(START_EXPECTED,0)); + std::string ret(buf); + std::size_t pos(ret.find(START_EXPECTED,0)); if(pos!=0) { std::ostringstream oss; oss << "MEDFileVersionOfFileStr : internal error ! The MEDFile returned version (\"" << ret << "\") has not the right pattern !"; @@ -375,7 +357,7 @@ std::string MEDCoupling::MEDFileVersionOfFileStr(const std::string& fileName) void MEDCoupling::MEDFileVersion(int& major, int& minor, int& release) { med_int majj,minn,rell; - med_err const ret(MEDlibraryNumVersion(&majj,&minn,&rell)); + med_err ret(MEDlibraryNumVersion(&majj,&minn,&rell)); if(ret!=0) throw INTERP_KERNEL::Exception("MEDFileVersion : fail to call MEDlibraryNumVersion ! It looks very bad !"); major=FromMedInt(majj); @@ -418,18 +400,18 @@ void MEDCoupling::SetTooLongStrPolicy(int val) */ std::vector< std::vector< std::pair > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes) { - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - std::set const poss; + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + std::set poss; char nommaa[MED_NAME_SIZE+1]; char maillage_description[MED_COMMENT_SIZE+1]; med_mesh_type type_maillage; std::string trueMeshName; - int const meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName); + int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName); INTERP_KERNEL::AutoPtr dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); med_sorting_type sortingType; med_int nstep, mDim, sDim; med_axis_type axisType; - med_int const naxis(MEDmeshnAxis(fid,meshId)); + med_int naxis(MEDmeshnAxis(fid,meshId)); INTERP_KERNEL::AutoPtr axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&sDim,&mDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit)); @@ -453,19 +435,19 @@ std::vector< std::vector< std::pair > > M med_bool changement,transformation; for(int i=0;i0) { - INTERP_KERNEL::NormalizedCellType const typp=typmai2[i]; - int const mdimCell=INTERP_KERNEL::CellModel::GetCellModel(typp).getDimension(); + INTERP_KERNEL::NormalizedCellType typp=typmai2[i]; + int mdimCell=INTERP_KERNEL::CellModel::GetCellModel(typp).getDimension(); dims.push_back(mdimCell); geoTypes.push_back(std::pair(typp,curNbOfElemM)); } } - int const maxLev=*std::max_element(dims.begin(),dims.end()); - int const lowLev=*std::min_element(dims.begin(),dims.end()); - int const nbOfLevels=maxLev-lowLev+1; + int maxLev=*std::max_element(dims.begin(),dims.end()); + int lowLev=*std::min_element(dims.begin(),dims.end()); + int nbOfLevels=maxLev-lowLev+1; std::vector< std::vector< std::pair > > ret(nbOfLevels); for(std::size_t i=0;i MEDCoupling::GetMeshNames(const std::string& fileName) { - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); return MEDLoaderNS::getMeshNamesFid(fid); } std::vector< std::pair > MEDCoupling::GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName) { - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields(MEDnField(fid)); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields(MEDnField(fid)); std::vector fields(nbFields); med_field_type typcha; for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); @@ -503,8 +485,8 @@ std::vector< std::pair > MEDCoupling::GetComponentsName INTERP_KERNEL::AutoPtr maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); - std::string const meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); if(curFieldName==fieldName) { std::vector< std::pair > ret(ncomp); @@ -536,15 +518,15 @@ public: void MEDCoupling::GetFamiliesGroupsInfo(const std::string& fileName, const std::string& meshName, std::map& families, std::map>& groupsOnFam) { - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFams(MEDnFamily(fid,meshName.c_str())); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFams(MEDnFamily(fid,meshName.c_str())); char nomfam[MED_NAME_SIZE+1]; for(med_int i=0;i(i+1))),famId; - std::unique_ptr const gro{new char[MED_LNAME_SIZE*nbGrps+1]}; + std::unique_ptr gro{new char[MED_LNAME_SIZE*nbGrps+1]}; MEDFILESAFECALLERRD0(MEDfamilyInfo,(fid,meshName.c_str(),FromMedInt(i+1),nomfam,&famId,gro.get())); - std::string const fam(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE)); + std::string fam(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE)); families[fam] = FromMedInt(famId); std::vector v(nbGrps); std::copy(MEDVectorStringIterator(0,gro.get()),MEDVectorStringIterator(nbGrps,gro.get()),v.begin()); @@ -556,8 +538,8 @@ std::vector MEDCoupling::GetMeshNamesOnField(const std::string& fil { std::vector ret; // - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields=MEDnField(fid); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields=MEDnField(fid); // med_field_type typcha; INTERP_KERNEL::AutoPtr dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); @@ -566,14 +548,14 @@ std::vector MEDCoupling::GetMeshNamesOnField(const std::string& fil // for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; med_int nbPdt; INTERP_KERNEL::AutoPtr maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); - std::string const meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); if(curFieldName==fieldName) ret.push_back(meshName); } @@ -582,21 +564,21 @@ std::vector MEDCoupling::GetMeshNamesOnField(const std::string& fil std::vector MEDCoupling::GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) { - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nfam=MEDnFamily(fid,meshName.c_str()); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret(nfam); char nomfam[MED_NAME_SIZE+1]; med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); - std::string const cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); + std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); ret[i]=cur; } return ret; @@ -605,24 +587,24 @@ std::vector MEDCoupling::GetMeshFamiliesNames(const std::string& fi std::vector MEDCoupling::GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) { - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nfam=MEDnFamily(fid,meshName.c_str()); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret; char nomfam[MED_NAME_SIZE+1]; med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); - std::string const cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); + std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); for(int j=0;j MEDCoupling::GetMeshFamiliesNamesOnGroup(const std::str std::vector MEDCoupling::GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) { - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nfam(MEDnFamily(fid,meshName.c_str())); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nfam(MEDnFamily(fid,meshName.c_str())); std::vector ret; char nomfam[MED_NAME_SIZE+1]; med_int numfam; bool found=false; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); - std::string const cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); + std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam)); found=(cur==famName); if(found) for(int j=0;j MEDCoupling::GetMeshGroupsNamesOnFamily(const std::stri std::vector MEDCoupling::GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) { - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nfam=MEDnFamily(fid,meshName.c_str()); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret; char nomfam[MED_NAME_SIZE+1]; med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; @@ -684,7 +666,7 @@ std::vector MEDCoupling::GetMeshGroupsNames(const std::string& file MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); for(int j=0;j MEDCoupling::GetTypesOfField(const std::st oss << " The name of the mesh in file is \"" << fs->getMeshName() << "\"!"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int const nbTS(fs->getNumberOfTS()); + int nbTS(fs->getNumberOfTS()); if(nbTS==0) return ret; for(int i=0;i f1ts(fs->getTimeStepAtPos(i)); - std::vector const tof(f1ts->getTypesOfFieldAvailable()); - for(auto it : tof) - if(std::find(ret.begin(),ret.end(),it)==ret.end()) - ret.push_back(it); + std::vector tof(f1ts->getTypesOfFieldAvailable()); + for(std::vector::const_iterator it=tof.begin();it!=tof.end();it++) + if(std::find(ret.begin(),ret.end(),*it)==ret.end()) + ret.push_back(*it); } // sort ret to put before ON_NODES then ON_CELLS then the remaining. std::vector ret2; @@ -719,21 +701,21 @@ std::vector MEDCoupling::GetTypesOfField(const std::st ret2.push_back(ON_NODES); if(std::find(ret.begin(),ret.end(),ON_CELLS)!=ret.end()) ret2.push_back(ON_CELLS); - for(auto it : ret) - if(it!=ON_NODES && it!=ON_CELLS) - ret2.push_back(it); + for(std::vector::const_iterator it=ret.begin();it!=ret.end();it++) + if(*it!=ON_NODES && *it!=ON_CELLS) + ret2.push_back(*it); return ret2; } std::vector MEDCoupling::GetAllFieldNames(const std::string& fileName) { std::vector ret; - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields=MEDnField(fid); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields=MEDnField(fid); med_field_type typcha; for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); @@ -750,8 +732,8 @@ std::vector MEDCoupling::GetAllFieldNames(const std::string& fileNa std::vector MEDCoupling::GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) { std::vector ret; - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields=MEDnField(fid); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields=MEDnField(fid); // med_field_type typcha; char *maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); @@ -759,15 +741,15 @@ std::vector MEDCoupling::GetAllFieldNamesOnMesh(const std::string& // for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr dt_unit=new char[MED_LNAME_SIZE+1]; med_int nbPdt; med_bool localmesh; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); - std::string const curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); // if(curMeshName==meshName) ret.push_back(curFieldName); @@ -794,8 +776,8 @@ std::vector MEDCoupling::GetFieldNamesOnMesh(MEDCoupling::TypeOfFie std::vector MEDCoupling::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) { std::vector ret; - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields=MEDnField(fid); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields=MEDnField(fid); // med_field_type typcha; //med_int nbpdtnor=0,pflsize,*pflval,lnsize; @@ -811,12 +793,12 @@ std::vector MEDCoupling::GetCellFieldNamesOnMesh(const std::string& // for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); - std::string const curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); med_int profilesize,nbi; if(curMeshName==meshName) { @@ -826,7 +808,7 @@ std::vector MEDCoupling::GetCellFieldNamesOnMesh(const std::string& if(nbPdt>0) { MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt)); - med_int const nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE, + med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE, pflname,&profilesize,locname,&nbi)); if(nbOfVal>0) { @@ -843,8 +825,8 @@ std::vector MEDCoupling::GetCellFieldNamesOnMesh(const std::string& std::vector MEDCoupling::GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) { std::vector ret; - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields=MEDnField(fid); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields=MEDnField(fid); char pflname[MED_NAME_SIZE+1]=""; char locname[MED_NAME_SIZE+1]=""; // @@ -858,18 +840,18 @@ std::vector MEDCoupling::GetNodeFieldNamesOnMesh(const std::string& // for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; med_int nbPdt; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); - std::string const curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); if(nbPdt>0) { med_int profilesize,nbi; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt)); - med_int const nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE, + med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE, pflname,&profilesize,locname,&nbi)); if(curMeshName==meshName && nbOfVal>0) { @@ -883,8 +865,8 @@ std::vector MEDCoupling::GetNodeFieldNamesOnMesh(const std::string& std::vector< std::pair< std::pair, double> > MEDCoupling::GetAllFieldIterations(const std::string& fileName, const std::string& fieldName) { std::vector< std::pair< std::pair, double > > ret; - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields=MEDnField(fid); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields=MEDnField(fid); // med_field_type typcha; med_int numdt=0,numo=0; @@ -897,12 +879,12 @@ std::vector< std::pair< std::pair, double> > MEDCoupling::GetAllFieldIt std::ostringstream oss; oss << "GetAllFieldIterations : No field with name \"" << fieldName<< "\" in file \"" << fileName << "\" ! Possible fields are : "; for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; med_int nbPdt; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); if(curFieldName==fieldName) { for(int k=0;k, double> > MEDCoupling::GetAllFieldIt double MEDCoupling::GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) { - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields=MEDnField(fid); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields=MEDnField(fid); // med_field_type typcha; med_int numdt=0,numo=0; @@ -940,12 +922,12 @@ double MEDCoupling::GetTimeAttachedOnFieldIteration(const std::string& fileName, double ret=std::numeric_limits::max(); for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; med_int nbPdt; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&local,&typcha,comp,unit,dt_unit,&nbPdt)); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); if(curFieldName==fieldName) { found=true; @@ -985,10 +967,10 @@ std::vector< std::pair > MEDCoupling::GetFieldIterations(MEDCoupling::T std::vector< std::pair > MEDCoupling::GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { - std::string const meshNameCpp(meshName); + std::string meshNameCpp(meshName); std::vector< std::pair > ret; - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields=MEDnField(fid); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields=MEDnField(fid); // med_field_type typcha; med_int numdt=0,numo=0; @@ -1004,12 +986,12 @@ std::vector< std::pair > MEDCoupling::GetCellFieldIterations(const std: std::set s2; for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; med_int nbPdt; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); if(curFieldName==fieldName) { bool found=false; @@ -1019,9 +1001,9 @@ std::vector< std::pair > MEDCoupling::GetCellFieldIterations(const std: { med_int profilesize,nbi; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt)); - med_int const nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE, + med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE, pflname,&profilesize,locname,&nbi)); - std::string const maa_ass_cpp(maa_ass); + std::string maa_ass_cpp(maa_ass); if(nbOfVal>0) { if(meshNameCpp==maa_ass_cpp) @@ -1056,10 +1038,10 @@ std::vector< std::pair > MEDCoupling::GetCellFieldIterations(const std: std::vector< std::pair > MEDCoupling::GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { - std::string const meshNameCpp(meshName); + std::string meshNameCpp(meshName); std::vector< std::pair > ret; - MEDFileUtilities::AutoFid const fid(MEDCoupling::OpenMEDFileForRead(fileName)); - med_int const nbFields=MEDnField(fid); + MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); + med_int nbFields=MEDnField(fid); // med_field_type typcha; med_int numdt=0,numo=0; @@ -1075,21 +1057,21 @@ std::vector< std::pair > MEDCoupling::GetNodeFieldIterations(const std: std::set s2; for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; med_int nbPdt; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); if(curFieldName==fieldName) { for(int k=0;k0) { if(meshNameCpp==maa_ass_cpp) @@ -1123,16 +1105,16 @@ MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& f MEDCoupling::CheckFileForRead(fileName); MCAuto mm(MEDFileMesh::New(fileName,meshName)); MEDFileMesh *mmPtr(mm); - auto *mmuPtr=dynamic_cast(mmPtr); + MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(mmuPtr) return mmuPtr->getMeshAtLevel(meshDimRelToMax,true); - auto *mmcPtr=dynamic_cast(mmPtr); + MEDFileCMesh *mmcPtr=dynamic_cast(mmPtr); if(mmcPtr) { const MEDCouplingCMesh *ret(mmcPtr->getMesh()); ret->incrRef(); return const_cast(ret); } - auto *mmc2Ptr=dynamic_cast(mmPtr); + MEDFileCurveLinearMesh *mmc2Ptr=dynamic_cast(mmPtr); if(mmc2Ptr) { const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef(); @@ -1147,16 +1129,16 @@ MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& f MEDCoupling::CheckFileForRead(fileName); MCAuto mm(MEDFileMesh::New(fileName)); MEDFileMesh *mmPtr(mm); - auto *mmuPtr=dynamic_cast(mmPtr); + MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(mmuPtr) return mmuPtr->getMeshAtLevel(meshDimRelToMax,true); - auto *mmcPtr=dynamic_cast(mmPtr); + MEDFileCMesh *mmcPtr=dynamic_cast(mmPtr); if(mmcPtr) { const MEDCouplingCMesh *ret(mmcPtr->getMesh()); ret->incrRef(); return const_cast(ret); } - auto *mmc2Ptr=dynamic_cast(mmPtr); + MEDFileCurveLinearMesh *mmc2Ptr=dynamic_cast(mmPtr); if(mmc2Ptr) { const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef(); @@ -1171,7 +1153,7 @@ MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFile(const std::string& MEDCoupling::CheckFileForRead(fileName); MCAuto mm(MEDFileMesh::New(fileName,meshName)); MEDFileMesh *mmPtr(mm); - auto *mmuPtr=dynamic_cast(mmPtr); + MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) { std::ostringstream oss; oss << "ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName=\""<< meshName << "\" exists but it is not an unstructured mesh !"; @@ -1185,7 +1167,7 @@ MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFile(const std::string& MEDCoupling::CheckFileForRead(fileName); MCAuto mm(MEDFileMesh::New(fileName)); MEDFileMesh *mmPtr(mm); - auto *mmuPtr=dynamic_cast(mmPtr); + MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) { std::ostringstream oss; oss << "ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !"; @@ -1206,7 +1188,7 @@ MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFamilies(const std::str MEDCoupling::CheckFileForRead(fileName); MCAuto mm(MEDFileMesh::New(fileName,meshName)); MEDFileMesh *mmPtr(mm); - auto *mmuPtr=dynamic_cast(mmPtr); + MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) { std::ostringstream oss; oss << "ReadUMeshFromFamilies : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !"; @@ -1220,7 +1202,7 @@ MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromGroups(const std::strin MEDCoupling::CheckFileForRead(fileName); MCAuto mm=MEDFileMesh::New(fileName,meshName); MEDFileMesh *mmPtr(mm); - auto *mmuPtr=dynamic_cast(mmPtr); + MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) { std::ostringstream oss; oss << "ReadUMeshFromGroups : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !"; @@ -1232,7 +1214,7 @@ MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromGroups(const std::strin MCAuto MEDCoupling::ReadField(const std::string& fileName) { std::vector fieldNames(GetAllFieldNames(fileName)); - std::size_t const sz(fieldNames.size()); + std::size_t sz(fieldNames.size()); if(sz==0) { std::ostringstream oss; @@ -1245,8 +1227,8 @@ MCAuto MEDCoupling::ReadField(const std::string& oss << "In file \"" << fileName << "\" there are more than one field !" << std::endl; oss << "You are invited to use ReadField(fileName, fieldName) instead to avoid misleading concerning field you want to read !" << std::endl; oss << "For information, fields available are :" << std::endl; - for(const auto & fieldName : fieldNames) - oss << " - \"" << fieldName << "\"" << std::endl; + for(std::vector::const_iterator it=fieldNames.begin();it!=fieldNames.end();it++) + oss << " - \"" << *it << "\"" << std::endl; throw INTERP_KERNEL::Exception(oss.str()); } return ReadField(fileName,fieldNames[0]); @@ -1255,7 +1237,7 @@ MCAuto MEDCoupling::ReadField(const std::string& MCAuto MEDCoupling::ReadField(const std::string& fileName, const std::string& fieldName) { std::vector< std::pair< std::pair, double> > iterations(GetAllFieldIterations(fileName,fieldName)); - std::size_t const sz(iterations.size()); + std::size_t sz(iterations.size()); if(sz==0) { std::ostringstream oss; @@ -1268,8 +1250,8 @@ MCAuto MEDCoupling::ReadField(const std::string& oss << "In file \"" << fileName << "\" field \"" << fieldName << "\" exists but with more than one time steps !" << std::endl; oss << "You are invited to use ReadField(fileName, fieldName, iteration, order) instead to avoid misleading concerning time steps." << std::endl; oss << "For information, time steps available for field \"" << fieldName << "\" are :" << std::endl; - for(const auto & iteration : iterations) - oss << " - " << iteration.first.first << ", " << iteration.first.second << " (" << iteration.second << ")" << std::endl; + for(std::vector< std::pair< std::pair, double> >::const_iterator it=iterations.begin();it!=iterations.end();it++) + oss << " - " << (*it).first.first << ", " << (*it).first.second << " (" << (*it).second << ")" << std::endl; throw INTERP_KERNEL::Exception(oss.str()); } return ReadField(fileName,fieldName,iterations[0].first.first,iterations[0].first.second); @@ -1346,7 +1328,7 @@ std::vector MEDCoupling::ReadFieldsOnSame //Retrieving mesh of rank 0 and field on rank 0 too. MCAuto mm=MEDFileMesh::New(fileName,meshName); MEDFileMesh *mmPtr(mm); - auto *mmuPtr=dynamic_cast(mmPtr); + MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !"); MCAuto m=mmuPtr->getMeshAtLevel(meshDimRelToMax); @@ -1355,7 +1337,7 @@ std::vector MEDCoupling::ReadFieldsOnSame if(o2n) m2->renumberCells(o2n->begin(),true); int i=0; - for(auto it=its.begin();it!=its.end();it++,i++) + for(std::vector >::const_iterator it=its.begin();it!=its.end();it++,i++) { MCAuto ff=MEDFileField1TS::New(fileName,fieldName,(*it).first,(*it).second); MCAuto retElt=ff->getFieldOnMeshAtLevel(type,m); @@ -1365,7 +1347,7 @@ std::vector MEDCoupling::ReadFieldsOnSame retSafe[i]=retElt; } i=0; - for(auto it=its.begin();it!=its.end();it++,i++) + for(std::vector >::const_iterator it=its.begin();it!=its.end();it++,i++) ret[i]=retSafe[i].retn(); return ret; } @@ -1397,7 +1379,7 @@ std::vector MEDCoupling::ReadFieldsGaussN namespace MEDCoupling { template - MCAuto::FieldType> ReadFieldCellLikeT(typename MLFieldTraits::F1TSType *ff, MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& /*fieldName*/, int /*iteration*/, int /*order*/) + MCAuto::FieldType> ReadFieldCellLikeT(typename MLFieldTraits::F1TSType *ff, MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MCAuto mm(MEDFileMesh::New(fileName,meshName)); MCAuto muPtr(MEDCoupling::DynamicCast(mm)); @@ -1451,7 +1433,7 @@ namespace MEDCoupling } template - MCAuto::FieldType> ReadFieldNodeT(typename MLFieldTraits::F1TSType *ff, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& /*fieldName*/, int /*iteration*/, int /*order*/) + MCAuto::FieldType> ReadFieldNodeT(typename MLFieldTraits::F1TSType *ff, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MCAuto mm(MEDFileMesh::New(fileName,meshName)); MCAuto m(mm->getMeshAtLevel(meshDimRelToMax,false)); @@ -1473,7 +1455,7 @@ namespace MEDCoupling MCAuto pflSafe(pfl); MCAuto mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end())); MCAuto mzip(static_cast(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2))); - MCAuto const arr2Safe(arr2); + MCAuto arr2Safe(arr2); MCAuto arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes())); MCAuto pflSorted(pflSafe->deepCopy()); pflSorted->sort(true); if(!arr3->isEqualWithoutConsideringStr(*pflSorted)) @@ -1549,14 +1531,14 @@ void MEDCoupling::WriteMesh(const std::string& fileName, const MEDCoupling::MEDC { if(!mesh) throw INTERP_KERNEL::Exception("WriteMesh : input mesh is null !"); - const auto *um(dynamic_cast(mesh)); + const MEDCouplingUMesh *um(dynamic_cast(mesh)); if(um) { WriteUMesh(fileName,um,writeFromScratch); return ; } - int const mod=writeFromScratch?2:0; - const auto *um2(dynamic_cast(mesh)); + int mod=writeFromScratch?2:0; + const MEDCoupling1GTUMesh *um2(dynamic_cast(mesh)); if(um2) { MCAuto mmu(MEDFileUMesh::New()); @@ -1565,7 +1547,7 @@ void MEDCoupling::WriteMesh(const std::string& fileName, const MEDCoupling::MEDC mmu->write(fileName,mod); return ; } - const auto *um3(dynamic_cast(mesh)); + const MEDCouplingCMesh *um3(dynamic_cast(mesh)); if(um3) { MCAuto mmc(MEDFileCMesh::New()); @@ -1574,7 +1556,7 @@ void MEDCoupling::WriteMesh(const std::string& fileName, const MEDCoupling::MEDC mmc->write(fileName,mod); return ; } - const auto *um4(dynamic_cast(mesh)); + const MEDCouplingCurveLinearMesh *um4(dynamic_cast(mesh)); if(um4) { MCAuto mmc(MEDFileCurveLinearMesh::New()); @@ -1590,7 +1572,7 @@ void MEDCoupling::WriteUMesh(const std::string& fileName, const MEDCoupling::MED { if(!mesh) throw INTERP_KERNEL::Exception("WriteUMesh : input mesh is null !"); - int const mod=writeFromScratch?2:0; + int mod=writeFromScratch?2:0; MCAuto m(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*m); MCAuto mcpy(static_cast(mesh->deepCopy())); @@ -1605,10 +1587,10 @@ void MEDCoupling::WriteUMeshDep(const std::string& fileName, const MEDCoupling:: void MEDCoupling::WriteUMeshesPartition(const std::string& fileName, const std::string& meshNameC, const std::vector& meshes, bool writeFromScratch) { - std::string const meshName(meshNameC); + std::string meshName(meshNameC); if(meshName.empty()) throw INTERP_KERNEL::Exception("Trying to write a unstructured mesh with no name ! MED file format needs a not empty mesh name : change 2nd parameter !"); - int const status=MEDLoaderBase::getStatusOfFile(fileName); + int status=MEDLoaderBase::getStatusOfFile(fileName); if(status!=MEDLoaderBase::EXIST_RW && status!=MEDLoaderBase::NOT_EXIST) { std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions !"; @@ -1618,7 +1600,7 @@ void MEDCoupling::WriteUMeshesPartition(const std::string& fileName, const std:: AssignStaticWritePropertiesTo(*m); m->setGroupsFromScratch(0,meshes,true); m->setName(meshNameC); - int const mod=writeFromScratch?2:0; + int mod=writeFromScratch?2:0; m->write(fileName,mod); } @@ -1629,7 +1611,7 @@ void MEDCoupling::WriteUMeshesPartitionDep(const std::string& fileName, const st void MEDCoupling::WriteUMeshes(const std::string& fileName, const std::vector& meshes, bool writeFromScratch) { - int const mod(writeFromScratch?2:0); + int mod(writeFromScratch?2:0); MCAuto m(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*m); m->setMeshes(meshes,true); @@ -1643,12 +1625,12 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri AssignStaticWritePropertiesTo(*ff); MCAuto::FieldType> f2(f->deepCopy()); const MEDCouplingMesh *m(f2->getMesh()); - const auto *um(dynamic_cast(m)); - const auto *um2(dynamic_cast(m)); - const auto *um3(dynamic_cast(m)); - const auto *um4(dynamic_cast(m)); - MCAuto const mm; - int const mod(writeFromScratch?2:0); + const MEDCouplingUMesh *um(dynamic_cast(m)); + const MEDCoupling1GTUMesh *um2(dynamic_cast(m)); + const MEDCouplingCMesh *um3(dynamic_cast(m)); + const MEDCouplingCurveLinearMesh *um4(dynamic_cast(m)); + MCAuto mm; + int mod(writeFromScratch?2:0); if(um) { MCAuto mmu(MEDFileUMesh::New()); @@ -1696,7 +1678,7 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits if(!f) throw INTERP_KERNEL::Exception("WriteField : input field is NULL !"); f->checkConsistencyLight(); - int const status(MEDLoaderBase::getStatusOfFile(fileName)); + int status(MEDLoaderBase::getStatusOfFile(fileName)); if(status!=MEDLoaderBase::EXIST_RW && status!=MEDLoaderBase::NOT_EXIST) { std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions !"; @@ -1711,7 +1693,7 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits std::vector meshNames(GetMeshNames(fileName)); if(!f->getMesh()) throw INTERP_KERNEL::Exception("WriteField : trying to write a field with no mesh !"); - std::string const fileNameCpp(f->getMesh()->getName()); + std::string fileNameCpp(f->getMesh()->getName()); if(std::find(meshNames.begin(),meshNames.end(),fileNameCpp)==meshNames.end()) MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(fileName,f,false); else @@ -1719,11 +1701,11 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits MCAuto mm(MEDFileMesh::New(fileName,f->getMesh()->getName().c_str())); AssignStaticWritePropertiesTo(*mm); const MEDFileMesh *mmPtr(mm); - const auto *mmuPtr(dynamic_cast(mmPtr)); + const MEDFileUMesh *mmuPtr(dynamic_cast(mmPtr)); if(!mmuPtr) throw INTERP_KERNEL::Exception("WriteField : only umeshes are supported now !"); MCAuto< typename MEDCoupling::Traits::FieldType > f2(f->deepCopy()); - auto *m(dynamic_cast(const_cast(f2->getMesh()))); + MEDCouplingUMesh *m(dynamic_cast(const_cast(f2->getMesh()))); if(!m) throw INTERP_KERNEL::Exception("WriteField : only umesh in input field supported !"); MCAuto o2n(m->getRenumArrForMEDFileFrmt()); @@ -1736,9 +1718,9 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP); else mread->setCoords(m->getCoords()); - DataArrayIdType *part(nullptr); - bool const b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part)); - MCAuto const partSafe(part); + DataArrayIdType *part(NULL); + bool b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part)); + MCAuto partSafe(part); if(!b) { std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !"; @@ -1758,9 +1740,9 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits } else { - DataArrayIdType *part(nullptr); - bool const b(mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part)); - MCAuto const partSafe(part); + DataArrayIdType *part(NULL); + bool b(mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part)); + MCAuto partSafe(part); if(!b) { std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !"; @@ -1786,7 +1768,7 @@ void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MED if(!f) throw INTERP_KERNEL::Exception("WriteField : input field is null !"); { - const auto *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldDouble *f1(dynamic_cast(f)); if(f1) { WriteFieldT(fileName,f1,writeFromScratch); @@ -1794,7 +1776,7 @@ void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MED } } { - const auto *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast(f)); if(f1) { WriteFieldT(fileName,f1,writeFromScratch); @@ -1802,7 +1784,7 @@ void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MED } } { - const auto *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldInt64 *f1(dynamic_cast(f)); if(f1) { WriteFieldT(fileName,f1,writeFromScratch); @@ -1811,7 +1793,7 @@ void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MED } { - const auto *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldFloat *f1(dynamic_cast(f)); if(f1) { WriteFieldT(fileName,f1,writeFromScratch); @@ -1832,7 +1814,7 @@ void WriteFieldUsingAlreadyWrittenMeshT(const std::string& fileName, const typen if(!f) throw INTERP_KERNEL::Exception("WriteFieldUsingAlreadyWrittenMeshT : input field is null !"); f->checkConsistencyLight(); - int const status(MEDLoaderBase::getStatusOfFile(fileName)); + int status(MEDLoaderBase::getStatusOfFile(fileName)); if(status!=MEDLoaderBase::EXIST_RW) { std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions or not exists !"; @@ -1840,7 +1822,7 @@ void WriteFieldUsingAlreadyWrittenMeshT(const std::string& fileName, const typen } MCAuto< typename MLFieldTraits::F1TSType > f1ts(MLFieldTraits::F1TSType::New()); AssignStaticWritePropertiesTo(*f1ts); - auto *m(dynamic_cast(const_cast(f->getMesh()))); + MEDCouplingUMesh *m(dynamic_cast(const_cast(f->getMesh()))); if(m) { MCAuto o2n(m->getRenumArrForMEDFileFrmt()); @@ -1858,7 +1840,7 @@ void MEDCoupling::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, if(!f) throw INTERP_KERNEL::Exception("WriteFieldUsingAlreadyWrittenMesh : input field is null !"); { - const auto *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldDouble *f1(dynamic_cast(f)); if(f1) { WriteFieldUsingAlreadyWrittenMeshT(fileName,f1); @@ -1866,7 +1848,7 @@ void MEDCoupling::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, } } { - const auto *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast(f)); if(f1) { WriteFieldUsingAlreadyWrittenMeshT(fileName,f1); @@ -1874,7 +1856,7 @@ void MEDCoupling::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, } } { - const auto *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldInt64 *f1(dynamic_cast(f)); if(f1) { WriteFieldUsingAlreadyWrittenMeshT(fileName,f1); @@ -1882,7 +1864,7 @@ void MEDCoupling::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, } } { - const auto *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldFloat *f1(dynamic_cast(f)); if(f1) { WriteFieldUsingAlreadyWrittenMeshT(fileName,f1); diff --git a/src/MEDLoader/MEDLoader.hxx b/src/MEDLoader/MEDLoader.hxx index 6e37282e9..a740f6ff3 100644 --- a/src/MEDLoader/MEDLoader.hxx +++ b/src/MEDLoader/MEDLoader.hxx @@ -21,14 +21,13 @@ #pragma once #include "MEDLoaderDefines.hxx" +#include "InterpKernelException.hxx" #include "MEDCouplingRefCountObject.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "MCAuto.hxx" #include "MCIdType.hxx" -#include "NormalizedGeometricTypes" -#include -#include -#include +#include #include namespace MEDCoupling diff --git a/src/MEDLoader/MEDLoaderBase.cxx b/src/MEDLoader/MEDLoaderBase.cxx index 37d50a057..97a68347f 100644 --- a/src/MEDLoader/MEDLoaderBase.cxx +++ b/src/MEDLoader/MEDLoaderBase.cxx @@ -21,12 +21,10 @@ #include "MEDLoaderBase.hxx" #include "InterpKernelException.hxx" -#include #include #include #include #include -#include const char MEDLoaderBase::WHITE_SPACES[]=" \n"; @@ -39,7 +37,7 @@ int MEDLoaderBase::getStatusOfFile(const std::string& fileName) ifs.close(); return NOT_EXIST; } - std::ofstream const ofs(fileName.c_str(),std::ios_base::app); + std::ofstream ofs(fileName.c_str(),std::ios_base::app); if((ofs.rdstate() & std::ofstream::failbit)!=0) { return EXIST_RDONLY; @@ -57,7 +55,7 @@ char *MEDLoaderBase::buildEmptyString(std::size_t lgth) void MEDLoaderBase::getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName) { - std::size_t const pos=fullName.find_last_of(getPathSep()); + std::size_t pos=fullName.find_last_of(getPathSep()); if(pos!=std::string::npos) { dirName=fullName.substr(0,pos); @@ -101,8 +99,8 @@ std::string MEDLoaderBase::buildUnionUnit(const char *name, int nameLgth, const void MEDLoaderBase::splitIntoNameAndUnit(const std::string& s, std::string& name, std::string& unit) { - std::string::size_type const f1=s.find_first_of('['); - std::string::size_type const f2=s.find_last_of(']'); + std::string::size_type f1=s.find_first_of('['); + std::string::size_type f2=s.find_last_of(']'); if(f1!=std::string::npos && f2!=std::string::npos) { if(f1 " << maxLgth << ") : "; std::cerr << "zipping to : " << s << "\n"; strcpy(dest,s.c_str()); @@ -172,25 +170,25 @@ void MEDLoaderBase::safeStrCpy2(const char *src, int maxLgth, char *dest, int be } else if(behaviour==1) { - std::string const s=zipString(src,maxLgth); + std::string s=zipString(src,maxLgth); std::cerr << "A string : \"" << src << "\" has been detected to be too long for MED File ( > " << maxLgth << ") : "; std::cerr << "zipping to : " << s << "\n"; strcpy(dest,s.c_str()); return ; } } - std::size_t const n(strlen(src)); + std::size_t n(strlen(src)); std::fill(dest,dest+maxLgth,' '); strncpy(dest,src,n); } std::string MEDLoaderBase::buildStringFromFortran(const char *expr, int lgth) { - std::string const ret(expr,lgth); - std::string const whiteSpaces(WHITE_SPACES); - std::size_t const lgthReal=strlen(ret.c_str()); + std::string ret(expr,lgth); + std::string whiteSpaces(WHITE_SPACES); + std::size_t lgthReal=strlen(ret.c_str()); std::string ret2=ret.substr(0,lgthReal); - std::size_t const found=ret2.find_last_not_of(whiteSpaces); + std::size_t found=ret2.find_last_not_of(whiteSpaces); if (found!=std::string::npos) ret2.erase(found+1); else @@ -229,7 +227,7 @@ void MEDLoaderBase::zipEqualConsChar(std::string& s, int minConsSmChar) { for(std::string::iterator it=s.begin();it!=s.end();it++) { - char const tmp=*it; + char tmp=*it; int sz=1; for(std::string::iterator it2=it+1;it2!=s.end() && *it2==tmp;it2++) sz++; diff --git a/src/MEDLoader/MEDLoaderBase.hxx b/src/MEDLoader/MEDLoaderBase.hxx index 28c846af6..aaa20a453 100644 --- a/src/MEDLoader/MEDLoaderBase.hxx +++ b/src/MEDLoader/MEDLoaderBase.hxx @@ -22,8 +22,8 @@ #define __MEDLOADERBASE_HXX__ #include "MEDLoaderDefines.hxx" +#include "InterpKernelException.hxx" -#include #include class MEDLOADER_EXPORT MEDLoaderBase diff --git a/src/MEDLoader/MEDLoaderNS.hxx b/src/MEDLoader/MEDLoaderNS.hxx index e4919db0a..0194c2fa2 100644 --- a/src/MEDLoader/MEDLoaderNS.hxx +++ b/src/MEDLoader/MEDLoaderNS.hxx @@ -21,7 +21,6 @@ #ifndef __MEDLOADERNS_HXX__ #define __MEDLOADERNS_HXX__ -#include "MEDCouplingTraits.hxx" #include #include diff --git a/src/MEDLoader/MEDLoaderTraits.hxx b/src/MEDLoader/MEDLoaderTraits.hxx index 1269d6a6f..43c8f649f 100644 --- a/src/MEDLoader/MEDLoaderTraits.hxx +++ b/src/MEDLoader/MEDLoaderTraits.hxx @@ -28,7 +28,7 @@ namespace MEDCoupling template struct MEDLOADER_EXPORT MLFieldTraits { - using EltType = T; + typedef T EltType; }; class MEDFileFieldMultiTS; @@ -51,37 +51,37 @@ namespace MEDCoupling template<> struct MEDLOADER_EXPORT MLFieldTraits { - using FMTSWSDAType = MEDFileFieldMultiTSWithoutSDA; - using FMTSType = MEDFileFieldMultiTS; - using F1TSType = MEDFileField1TS; - using F1TSWSDAType = MEDFileField1TSWithoutSDA; + typedef MEDFileFieldMultiTSWithoutSDA FMTSWSDAType; + typedef MEDFileFieldMultiTS FMTSType; + typedef MEDFileField1TS F1TSType; + typedef MEDFileField1TSWithoutSDA F1TSWSDAType; }; template<> struct MEDLOADER_EXPORT MLFieldTraits { - using FMTSWSDAType = MEDFileFloatFieldMultiTSWithoutSDA; - using FMTSType = MEDFileFloatFieldMultiTS; - using F1TSType = MEDFileFloatField1TS; - using F1TSWSDAType = MEDFileFloatField1TSWithoutSDA; + typedef MEDFileFloatFieldMultiTSWithoutSDA FMTSWSDAType; + typedef MEDFileFloatFieldMultiTS FMTSType; + typedef MEDFileFloatField1TS F1TSType; + typedef MEDFileFloatField1TSWithoutSDA F1TSWSDAType; }; template<> struct MEDLOADER_EXPORT MLFieldTraits { - using FMTSWSDAType = MEDFileInt32FieldMultiTSWithoutSDA; - using FMTSType = MEDFileInt32FieldMultiTS; - using F1TSType = MEDFileInt32Field1TS; - using F1TSWSDAType = MEDFileInt32Field1TSWithoutSDA; + typedef MEDFileInt32FieldMultiTSWithoutSDA FMTSWSDAType; + typedef MEDFileInt32FieldMultiTS FMTSType; + typedef MEDFileInt32Field1TS F1TSType; + typedef MEDFileInt32Field1TSWithoutSDA F1TSWSDAType; }; template<> struct MEDLOADER_EXPORT MLFieldTraits { - using FMTSWSDAType = MEDFileInt64FieldMultiTSWithoutSDA; - using FMTSType = MEDFileInt64FieldMultiTS; - using F1TSType = MEDFileInt64Field1TS; - using F1TSWSDAType = MEDFileInt64Field1TSWithoutSDA; + typedef MEDFileInt64FieldMultiTSWithoutSDA FMTSWSDAType; + typedef MEDFileInt64FieldMultiTS FMTSType; + typedef MEDFileInt64Field1TS F1TSType; + typedef MEDFileInt64Field1TSWithoutSDA F1TSWSDAType; }; template diff --git a/src/MEDLoader/MEDMESHConverterUtilities.cxx b/src/MEDLoader/MEDMESHConverterUtilities.cxx index 407e4ce34..d8e8c4e5e 100644 --- a/src/MEDLoader/MEDMESHConverterUtilities.cxx +++ b/src/MEDLoader/MEDMESHConverterUtilities.cxx @@ -19,8 +19,7 @@ #include "MEDMESHConverterUtilities.hxx" -#include -#include +#include "libmesh5.hxx" namespace MeshFormat { @@ -46,7 +45,7 @@ namespace MeshFormat Localizer::Localizer() { - _locale = setlocale(LC_NUMERIC, nullptr); + _locale = setlocale(LC_NUMERIC, NULL); setlocale(LC_NUMERIC, "C"); } diff --git a/src/MEDLoader/MEDMESHConverterUtilities.hxx b/src/MEDLoader/MEDMESHConverterUtilities.hxx index d7e9c18f1..b0667d5e4 100644 --- a/src/MEDLoader/MEDMESHConverterUtilities.hxx +++ b/src/MEDLoader/MEDMESHConverterUtilities.hxx @@ -25,6 +25,7 @@ # include # include #include +# include #include namespace MeshFormat diff --git a/src/MEDLoader/MeshFormatReader.cxx b/src/MEDLoader/MeshFormatReader.cxx index 34f884904..83eb4232e 100644 --- a/src/MEDLoader/MeshFormatReader.cxx +++ b/src/MEDLoader/MeshFormatReader.cxx @@ -19,22 +19,14 @@ #include "MeshFormatReader.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCType.hxx" #include "MEDFileMesh.hxx" #include "MEDFileField.hxx" #include "MEDFileData.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "NormalizedGeometricTypes" #include "libmesh5.hxx" #include "MEDMESHConverterUtilities.hxx" -#include #include -#include -#include -#include -#include +#include namespace MEDCoupling { MeshFormatReader::MeshFormatReader():_myMeshName("MESH") @@ -47,12 +39,12 @@ MeshFormatReader::MeshFormatReader(const std::string& meshFileName, {} MeshFormatReader::~MeshFormatReader() -= default; +{} MEDCoupling::MCAuto MeshFormatReader::loadInMedFileDS() { _myStatus = perform(); - if(_myStatus != MeshFormat::DRS_OK) return nullptr; + if(_myStatus != MeshFormat::DRS_OK) return 0; if ( !_uMesh->getName().c_str() || strlen( _uMesh->getName().c_str() ) == 0 ) _uMesh->setName( _myMeshName ); @@ -77,9 +69,9 @@ MEDCoupling::MCAuto MeshFormatReader::loadInMedFileDS( MeshFormat::Status MeshFormatReader::perform() { - MeshFormat::Localizer const loc; + MeshFormat::Localizer loc; - MeshFormat::Status const status = MeshFormat::DRS_OK; + MeshFormat::Status status = MeshFormat::DRS_OK; // open the file @@ -107,13 +99,13 @@ MeshFormat::Status MeshFormatReader::perform() setNodes(coordArray); - int const nbEdges = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfEdges); - int const nbTria = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfTriangles); - int const nbQuad = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals); - int const nbTet = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfTetrahedra ); - int const nbPyr = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfPyramids); - int const nbHex = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfHexahedra); - int const nbPrism = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfPrisms); + int nbEdges = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfEdges); + int nbTria = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfTriangles); + int nbQuad = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals); + int nbTet = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfTetrahedra ); + int nbPyr = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfPyramids); + int nbHex = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfHexahedra); + int nbPrism = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfPrisms); _dim1NbEl = nbEdges; _dim2NbEl = nbTria + nbQuad; @@ -218,7 +210,7 @@ MeshFormat::Status MeshFormatReader::perform() MeshFormat::Status MeshFormatReader::performFields() { - MeshFormat::Status const status = MeshFormat::DRS_OK; + MeshFormat::Status status = MeshFormat::DRS_OK; _fields = MEDCoupling::MEDFileFields::New(); @@ -258,7 +250,7 @@ MeshFormat::Status MeshFormatReader::performFields() } - MeshFormat::GmfKwdCod const kwd = meshFormatSol[0]; + MeshFormat::GmfKwdCod kwd = meshFormatSol[0]; int NmbSol, NmbTypes, NmbReals, TypesTab[ GmfMaxTyp ]; NmbSol = _reader.GmfStatKwd( _myCurrentFileId, kwd, &NmbTypes, &NmbReals, TypesTab ); if(NmbSol) @@ -318,9 +310,9 @@ void MeshFormatReader::setFields( MeshFormat::GmfKwdCod kwd, int nmbSol, int nbC double* values = fieldValues->getPointer(); int ref; - auto *val = new double[nbComp]; + double *val = new double[nbComp]; - bool const isOnAll = (_uMesh->getNumberOfNodes()== nmbSol); + bool isOnAll = (_uMesh->getNumberOfNodes()== nmbSol); for(int i = 1; i<= nmbSol; i++) @@ -347,7 +339,7 @@ void MeshFormatReader::setFields( MeshFormat::GmfKwdCod kwd, int nmbSol, int nbC timeStamp->setMesh( dimMesh ); - std::string const name = "Field_on_Vertex"; + std::string name = "Field_on_Vertex"; timeStamp->setName(name); timeStamp->setArray(fieldValues); // set an order @@ -417,8 +409,8 @@ void MeshFormatReader::backward_shift(mcIdType* tab, int size) MeshFormat::Status MeshFormatReader::setNodes( MEDCoupling::DataArrayDouble* coordArray) { - MeshFormat::Status const status = MeshFormat::DRS_OK; - int const nbNodes = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfVertices); + MeshFormat::Status status = MeshFormat::DRS_OK; + int nbNodes = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfVertices); if ( nbNodes < 1 ) return addMessage( "No nodes in the mesh", /*fatal=*/true ); @@ -444,7 +436,7 @@ MeshFormat::Status MeshFormatReader::setNodes( MEDCoupling::DataArrayDouble* coo nCoords[1] = y; nCoords[2] = z; std::copy(coordPointer, coordPointer+_dim, coordPrt); - MeshFormatElement const e(MeshFormat::GmfVertices, i-1); + MeshFormatElement e(MeshFormat::GmfVertices, i-1); _fams.insert(std::pair (ref, e), 1); coordPrt += _dim; @@ -463,7 +455,7 @@ MeshFormat::Status MeshFormatReader::setNodes( MEDCoupling::DataArrayDouble* coo nCoords[1] = y; nCoords[2] = z; std::copy(coordPointer, coordPointer+_dim, coordPrt); - MeshFormatElement const e(MeshFormat::GmfVertices, i-1); + MeshFormatElement e(MeshFormat::GmfVertices, i-1); _fams.insert(std::pair (ref, e), 1); coordPrt += _dim; } @@ -482,7 +474,7 @@ void MeshFormatReader::setEdges( MEDCoupling::MEDCouplingUMesh* dimMesh1, int nb int ref; // read extra vertices for quadratic edges std::vector quadNodesAtEdges( nbEdges + 1, -1 ); - if ( int const nbQuadEdges = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges)) + if ( int nbQuadEdges = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges)) { _reader.GmfGotoKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges); for ( int i = 1; i <= nbQuadEdges; ++i ) @@ -504,7 +496,7 @@ void MeshFormatReader::setEdges( MEDCoupling::MEDCouplingUMesh* dimMesh1, int nb mcIdType nodalConnPerCell[3] = {iN[0], iN[1], midN}; backward_shift(nodalConnPerCell, 3); dimMesh1->insertNextCell(INTERP_KERNEL::NORM_SEG3, 3,nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfEdges, i-1); + MeshFormatElement e(MeshFormat::GmfEdges, i-1); _fams.insert(std::pair (ref, e), 1 -_dim); } else @@ -513,7 +505,7 @@ void MeshFormatReader::setEdges( MEDCoupling::MEDCouplingUMesh* dimMesh1, int nb mcIdType nodalConnPerCell[2] = {iN[0], iN[1]}; backward_shift(nodalConnPerCell, 2); dimMesh1->insertNextCell(INTERP_KERNEL::NORM_SEG2, 2,nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfEdges, i-1); + MeshFormatElement e(MeshFormat::GmfEdges, i-1); _fams.insert(std::pair (ref, e), 1 -_dim); } } @@ -529,7 +521,7 @@ void MeshFormatReader::setTriangles(MEDCoupling::MEDCouplingUMesh* dimMesh2, int int ref; // read extra vertices for quadratic triangles std::vector< std::vector > quadNodesAtTriangles( nbTria + 1 ); - if ( int const nbQuadTria = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles )) + if ( int nbQuadTria = _reader.GmfStatKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles )) { _reader.GmfGotoKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles ); for ( int i = 1; i <= nbQuadTria; ++i ) @@ -560,7 +552,7 @@ void MeshFormatReader::setTriangles(MEDCoupling::MEDCouplingUMesh* dimMesh2, int mcIdType nodalConnPerCell[6] = {iN[0], iN[1], iN[2], midN[0], midN[1], midN[2]}; backward_shift(nodalConnPerCell, 6); dimMesh2->insertNextCell(INTERP_KERNEL::NORM_TRI6, 6, nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfTriangles, i-1); + MeshFormatElement e(MeshFormat::GmfTriangles, i-1); _fams.insert(std::pair (ref, e), 2 -_dim); } else @@ -568,7 +560,7 @@ void MeshFormatReader::setTriangles(MEDCoupling::MEDCouplingUMesh* dimMesh2, int mcIdType nodalConnPerCell[3] = {iN[0], iN[1], iN[2]}; backward_shift(nodalConnPerCell, 3); dimMesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfTriangles, i-1); + MeshFormatElement e(MeshFormat::GmfTriangles, i-1); _fams.insert(std::pair (ref, e), 2 -_dim); } if ( !midN.empty() ) MeshFormat::FreeVector( midN ); @@ -583,7 +575,7 @@ void MeshFormatReader::setQuadrangles( MEDCoupling::MEDCouplingUMesh* dimMesh2, int ref; // read extra vertices for quadratic quadrangles std::vector< std::vector > quadNodesAtQuadrilaterals( nbQuad + 1 ); - if ( int const nbQuadQuad = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals )) + if ( int nbQuadQuad = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals )) { _reader.GmfGotoKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals); for ( int i = 1; i <= nbQuadQuad; ++i ) @@ -611,7 +603,7 @@ void MeshFormatReader::setQuadrangles( MEDCoupling::MEDCouplingUMesh* dimMesh2, }; backward_shift(nodalConnPerCell, 8); dimMesh2->insertNextCell(INTERP_KERNEL::NORM_QUAD8,8, nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfQuadrilaterals, i-1); + MeshFormatElement e(MeshFormat::GmfQuadrilaterals, i-1); _fams.insert(std::pair (ref, e), 2 -_dim); } else if ( midN.size() > 8-4 ) // QUAD9 @@ -621,7 +613,7 @@ void MeshFormatReader::setQuadrangles( MEDCoupling::MEDCouplingUMesh* dimMesh2, }; backward_shift(nodalConnPerCell, 9); dimMesh2->insertNextCell(INTERP_KERNEL::NORM_QUAD9,9, nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfQuadrilaterals, i-1); + MeshFormatElement e(MeshFormat::GmfQuadrilaterals, i-1); _fams.insert(std::pair (ref, e), 2 -_dim); } else // QUAD4 @@ -629,7 +621,7 @@ void MeshFormatReader::setQuadrangles( MEDCoupling::MEDCouplingUMesh* dimMesh2, mcIdType nodalConnPerCell[4] = {iN[0], iN[1], iN[2], iN[3]}; backward_shift(nodalConnPerCell, 4); dimMesh2->insertNextCell(INTERP_KERNEL::NORM_QUAD4, 4, nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfQuadrilaterals, i-1); + MeshFormatElement e(MeshFormat::GmfQuadrilaterals, i-1); _fams.insert(std::pair (ref, e), 2 -_dim); } if ( !midN.empty() ) MeshFormat::FreeVector( midN ); @@ -643,7 +635,7 @@ void MeshFormatReader::setTetrahedras( MEDCoupling::MEDCouplingUMesh* dimMesh3, int ref; // read extra vertices for quadratic tetrahedra std::vector< std::vector > quadNodesAtTetrahedra( nbTet + 1 ); - if ( int const nbQuadTetra = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra )) + if ( int nbQuadTetra = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra )) { _reader.GmfGotoKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra); for ( int i = 1; i <= nbQuadTetra; ++i ) @@ -671,7 +663,7 @@ void MeshFormatReader::setTetrahedras( MEDCoupling::MEDCouplingUMesh* dimMesh3, }; backward_shift(nodalConnPerCell, 10); dimMesh3->insertNextCell(INTERP_KERNEL::NORM_TETRA10, 10,nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfTetrahedra, i-1); + MeshFormatElement e(MeshFormat::GmfTetrahedra, i-1); _fams.insert(std::pair (ref, e), 3 -_dim); } else // TETRA4 @@ -679,7 +671,7 @@ void MeshFormatReader::setTetrahedras( MEDCoupling::MEDCouplingUMesh* dimMesh3, mcIdType nodalConnPerCell[4] = {iN[0], iN[2], iN[1], iN[3]}; backward_shift(nodalConnPerCell, 4); dimMesh3->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4, nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfTetrahedra, i-1); + MeshFormatElement e(MeshFormat::GmfTetrahedra, i-1); _fams.insert(std::pair (ref, e), 3 -_dim); } if ( !midN.empty() ) MeshFormat::FreeVector( midN ); @@ -699,7 +691,7 @@ void MeshFormatReader::setPyramids( MEDCoupling::MEDCouplingUMesh* dimMesh3, int mcIdType nodalConnPerCell[5] = {iN[3], iN[2], iN[1], iN[0], iN[4]}; backward_shift(nodalConnPerCell, 5); dimMesh3->insertNextCell(INTERP_KERNEL::NORM_PYRA5, 5,nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfPyramids, i-1); + MeshFormatElement e(MeshFormat::GmfPyramids, i-1); _fams.insert(std::pair (ref, e), 3 -_dim); } @@ -712,7 +704,7 @@ void MeshFormatReader::setHexahedras( MEDCoupling::MEDCouplingUMesh* dimMesh3, i int ref; // read extra vertices for quadratic hexahedra std::vector< std::vector > quadNodesAtHexahedra( nbHex + 1 ); - if ( int const nbQuadHexa = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra )) + if ( int nbQuadHexa = _reader.GmfStatKwd( _myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra )) { _reader.GmfGotoKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra); for ( int i = 1; i <= nbQuadHexa; ++i ) @@ -752,7 +744,7 @@ void MeshFormatReader::setHexahedras( MEDCoupling::MEDCouplingUMesh* dimMesh3, i }; backward_shift(nodalConnPerCell, 20); dimMesh3->insertNextCell(INTERP_KERNEL::NORM_HEXA20,20, nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfHexahedra, i-1); + MeshFormatElement e(MeshFormat::GmfHexahedra, i-1); _fams.insert(std::pair (ref, e), 3 -_dim); @@ -771,7 +763,7 @@ void MeshFormatReader::setHexahedras( MEDCoupling::MEDCouplingUMesh* dimMesh3, i }; backward_shift(nodalConnPerCell, 27); dimMesh3->insertNextCell(INTERP_KERNEL::NORM_HEXA27,27, nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfHexahedra, i-1); + MeshFormatElement e(MeshFormat::GmfHexahedra, i-1); _fams.insert(std::pair (ref, e), 3 -_dim); } @@ -782,7 +774,7 @@ void MeshFormatReader::setHexahedras( MEDCoupling::MEDCouplingUMesh* dimMesh3, i }; backward_shift(nodalConnPerCell, 8); dimMesh3->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8, nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfHexahedra, i-1); + MeshFormatElement e(MeshFormat::GmfHexahedra, i-1); _fams.insert(std::pair (ref, e), 3 -_dim); } @@ -805,7 +797,7 @@ void MeshFormatReader::setPrisms(MEDCoupling::MEDCouplingUMesh* dimMesh3, int nb mcIdType nodalConnPerCell[8] = {iN[0], iN[2], iN[1], iN[3], iN[5], iN[4]}; backward_shift(nodalConnPerCell, 8); dimMesh3->insertNextCell(INTERP_KERNEL::NORM_PENTA6, 6,nodalConnPerCell); - MeshFormatElement const e(MeshFormat::GmfPrisms, i-1); + MeshFormatElement e(MeshFormat::GmfPrisms, i-1); _fams.insert(std::pair (ref, e), 3 -_dim); } @@ -885,7 +877,7 @@ void MeshFormatReader::setTypeOfFieldAndDimRel(MeshFormat::GmfKwdCod kwd, MEDCou } -INTERP_KERNEL::NormalizedCellType MeshFormatReader::toMedType(MeshFormat::GmfKwdCod /*kwd*/) +INTERP_KERNEL::NormalizedCellType MeshFormatReader::toMedType(MeshFormat::GmfKwdCod kwd) { INTERP_KERNEL::NormalizedCellType type; //~switch (kwd) @@ -927,12 +919,13 @@ void MeshFormatReader::buildFamilies() void MeshFormatReader::buildCellsFamilies() { - std::vector const levs = _uMesh->getNonEmptyLevels(); - for (int const dimRelMax : levs) + std::vector levs = _uMesh->getNonEmptyLevels(); + for (size_t iDim = 0; iDim* > famDim = _fams.getMapAtLevel(dimRelMax); std::map * >::const_iterator _meshFormatFamsIt = famDim.begin(); - std::vector< const MEDCoupling::DataArrayIdType* > const fams; + std::vector< const MEDCoupling::DataArrayIdType* > fams; MEDCoupling::DataArrayIdType* cellIds = MEDCoupling::DataArrayIdType::New(); cellIds->alloc(_uMesh->getSizeAtLevel(dimRelMax), 1); cellIds->fillWithZero(); @@ -940,10 +933,10 @@ void MeshFormatReader::buildCellsFamilies() for(; _meshFormatFamsIt!= famDim.end(); ++_meshFormatFamsIt) { const int famId = _meshFormatFamsIt->first; - std::string const famName ="FromMeshGemsFormatAttributFamily_"+std::to_string(famId); + std::string famName ="FromMeshGemsFormatAttributFamily_"+std::to_string(famId); std::vector * cellsInFam = _meshFormatFamsIt->second; if (!famId) continue; - auto cellsInFamIt = cellsInFam->begin(); + std::vector ::iterator cellsInFamIt = cellsInFam->begin(); _uMesh->addFamily(famName, famId); for ( ; cellsInFamIt !=cellsInFam->end(); ++cellsInFamIt) @@ -961,11 +954,11 @@ void MeshFormatReader::buildCellsFamilies() void MeshFormatReader::buildNodesFamilies() { - std::vector const levs = _uMesh->getNonEmptyLevels(); - int const dimRelMax = 1; + std::vector levs = _uMesh->getNonEmptyLevels(); + int dimRelMax = 1; std::map * > famDim = _fams.getMapAtLevel(dimRelMax); std::map * >::const_iterator _meshFormatFamsIt = famDim.begin(); - std::vector< const MEDCoupling::DataArrayIdType* > const fams; + std::vector< const MEDCoupling::DataArrayIdType* > fams; MEDCoupling::DataArrayIdType* cellIds = MEDCoupling::DataArrayIdType::New(); cellIds->alloc(_uMesh->getSizeAtLevel(dimRelMax), 1); cellIds->fillWithZero(); @@ -976,10 +969,11 @@ void MeshFormatReader::buildNodesFamilies() if (!famId) continue; bool thisIsACellFamily = false; - for (int const dimMesh : levs) + for (size_t iDim = 0; iDim* > famDimAtLevel = _fams.getMapAtLevel(dimMesh); - auto const famDimAtLevelId = famDimAtLevel.find(famId); + std::map * >::iterator famDimAtLevelId = famDimAtLevel.find(famId); if (famDimAtLevelId != famDimAtLevel.end()) { thisIsACellFamily = true; @@ -989,9 +983,9 @@ void MeshFormatReader::buildNodesFamilies() } if (thisIsACellFamily) continue; - std::string const famName ="FromMeshGemsFormatAttributFamily_"+std::to_string(famId); + std::string famName ="FromMeshGemsFormatAttributFamily_"+std::to_string(famId); std::vector * cellsInFam = _meshFormatFamsIt->second; - auto cellsInFamIt = cellsInFam->begin(); + std::vector ::iterator cellsInFamIt = cellsInFam->begin(); _uMesh->addFamily(famName, famId); for ( ; cellsInFamIt !=cellsInFam->end(); ++cellsInFamIt) diff --git a/src/MEDLoader/MeshFormatReader.hxx b/src/MEDLoader/MeshFormatReader.hxx index 7e6863987..d87929d6b 100644 --- a/src/MEDLoader/MeshFormatReader.hxx +++ b/src/MEDLoader/MeshFormatReader.hxx @@ -25,17 +25,18 @@ #include #include #include +#include #include "MCAuto.hxx" #include "InterpKernelException.hxx" -#include "MEDLoaderDefines.hxx" -#include "MEDCouplingRefCountObject.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "MCType.hxx" #include "MEDMESHConverterUtilities.hxx" #include "libmesh5.hxx" -#include "NormalizedGeometricTypes" +#include #if !defined(WIN32) && !defined(__APPLE__) +#include #endif namespace MEDCoupling @@ -79,14 +80,14 @@ namespace MEDCoupling private: void insertPairInMap(std::map *> &aMap, std::pair addToFamily) { - auto const it = aMap.find(addToFamily.first); + std::map *>::iterator it = aMap.find(addToFamily.first); if (it != aMap.end()) { aMap[addToFamily.first]->push_back(addToFamily.second); } else { - auto *tmpVec = new std::vector; + std::vector *tmpVec = new std::vector; tmpVec->push_back(addToFamily.second); aMap.insert(std::pair *>(addToFamily.first, tmpVec)); } @@ -105,7 +106,7 @@ namespace MEDCoupling if (!aMap.size()) return; - auto const itTmp = aMap.find(removeFromFamily.first); + std::map *>::iterator itTmp = aMap.find(removeFromFamily.first); if (itTmp == aMap.end()) return; else @@ -160,7 +161,7 @@ namespace MEDCoupling private: void freeMap(std::map *> &aMap) { - auto it = aMap.begin(); + std::map *>::iterator it = aMap.begin(); for (; it != aMap.end(); ++it) delete it->second; } diff --git a/src/MEDLoader/MeshFormatWriter.cxx b/src/MEDLoader/MeshFormatWriter.cxx index 8cccf678b..d86046d4b 100644 --- a/src/MEDLoader/MeshFormatWriter.cxx +++ b/src/MEDLoader/MeshFormatWriter.cxx @@ -18,37 +18,29 @@ // #include "MeshFormatWriter.hxx" -#include "MEDFileFieldMultiTS.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MCType.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDFileMesh.hxx" #include "MEDFileField.hxx" #include "MEDFileData.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "NormalizedGeometricTypes" #include "libmesh5.hxx" #include "MEDMESHConverterUtilities.hxx" #include #include -#include #include -#include -#include -#include +#include +#include namespace MEDCoupling { MeshFormatWriter::MeshFormatWriter() -= default; +{} MeshFormatWriter::MeshFormatWriter(const std::string& meshFileName, const std::vector& fieldFileNames):_meshFileName(meshFileName), _fieldFileNames(fieldFileNames) {} MeshFormatWriter::~MeshFormatWriter() -= default; +{} void MeshFormatWriter::setMeshFileName(const std::string& meshFileName) { _meshFileName = meshFileName; @@ -98,7 +90,7 @@ void MeshFormatWriter::setMEDFileDS(MEDCoupling::MEDFileData* mfd) void MeshFormatWriter::write() { - MeshFormat::Localizer const loc; + MeshFormat::Localizer loc; MEDCoupling::MCAuto mesh = _mesh->getMeshAtLevel( 1 ); MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh = mesh->buildUnstructured(); @@ -153,15 +145,15 @@ MeshFormat::Status MeshFormatWriter::perform() MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3; std::vector dims = _mesh->getNonEmptyLevelsExt(); - int const dim = _mesh->getMeshDimension(); + int dim = _mesh->getMeshDimension(); bool threeDElements = false; bool twoDElements = false; bool OneDElements = false; if (dims.size() != 0) { - bool const maxLevelDimElments = ( std::find(dims.begin(), dims.end(), 0) != dims.end() ); - bool const nextToMaxLevelDimElments = ( std::find(dims.begin(), dims.end(), -1) != dims.end() ); - bool const nextToNextToMaxLevelDimElments = (std::find(dims.begin(), dims.end(), -2) != dims.end() ); + bool maxLevelDimElments = ( std::find(dims.begin(), dims.end(), 0) != dims.end() ); + bool nextToMaxLevelDimElments = ( std::find(dims.begin(), dims.end(), -1) != dims.end() ); + bool nextToNextToMaxLevelDimElments = (std::find(dims.begin(), dims.end(), -2) != dims.end() ); threeDElements = (dim == 3) ? maxLevelDimElments : false ; twoDElements = (dim == 3) ? nextToMaxLevelDimElments : maxLevelDimElments ; OneDElements = (dim == 3) ? nextToNextToMaxLevelDimElments : nextToMaxLevelDimElments; @@ -230,7 +222,7 @@ MeshFormat::Status MeshFormatWriter::perform() MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh0 = _mesh->getMeshAtLevel(1); - MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > const umesh0 = mesh0->buildUnstructured(); + MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0 = mesh0->buildUnstructured(); // nodes getNodes(umesh0); @@ -338,10 +330,10 @@ MeshFormat::Status MeshFormatWriter::performFields() } - int const dim = _mesh->getMeshDimension(); // dim mesh field lying to + int dim = _mesh->getMeshDimension(); // dim mesh field lying to std::vector::const_iterator fieldFileIt = _fieldFileNames.begin(); int iField = 0; - std::vector const levs {0} ; + std::vector levs {0} ; for (; fieldFileIt !=_fieldFileNames.end(); ++fieldFileIt) { // Open files @@ -357,7 +349,7 @@ MeshFormat::Status MeshFormatWriter::performFields() std::vector< std::vector > fTypes = f->getTypesOfFieldAvailable(); std::vector< std::pair > iters = f->getIterations(); const std::vector& compInfo = f->getInfo(); - std::pair const it = iters[0]; + std::pair it = iters[0]; //~// Open File for writing _myCurrentFileId = _writer.GmfOpenMesh( fieldFileIt->c_str(), GmfWrite, _version, _dim ); @@ -396,7 +388,7 @@ MeshFormat::Status MeshFormatWriter::setFieldOnNodes(MEDCoupling::MEDFileFieldMu const MEDCoupling::DataArrayDouble* valsArray = f->getUndergroundDataArray(iteration, order); int typTab[] = { getGmfSolKwd((int)compSize, _dim) }; _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfSolAtVertices, (int)valsVec[0][0].second, 1, typTab); - auto* valTab0 = new double[compSize]; + double* valTab0 = new double[compSize]; double* valTab; for ( size_t i = valsVec[0][0].first; i < (std::size_t)valsVec[0][0].second; ++i ) { @@ -423,11 +415,11 @@ MeshFormat::Status MeshFormatWriter::setFieldOnNodes(MEDCoupling::MEDFileFieldMu MeshFormat::Status MeshFormatWriter::setFieldOnCells(MEDCoupling::MEDFileFieldMultiTS * f, int iteration, int order, std::vector levs ) { - int const dim = _mesh->getMeshDimension(); // dim mesh field lying to - int const absDim = f->getNonEmptyLevels(iteration, order, f->getMeshName(), levs); + int dim = _mesh->getMeshDimension(); // dim mesh field lying to + int absDim = f->getNonEmptyLevels(iteration, order, f->getMeshName(), levs); - auto** cellToNodeFldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ; - auto** fldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ; + MEDCoupling::MEDCouplingFieldDouble** cellToNodeFldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ; + MEDCoupling::MEDCouplingFieldDouble** fldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ; for (size_t k = 0; kfield( iteration, order,_mesh ); @@ -443,7 +435,7 @@ MeshFormat::Status MeshFormatWriter::setFieldOnCells(MEDCoupling::MEDFileFieldMu MEDCoupling::DataArrayDouble* timeStamp = cellToNodeFldb[j]->getArray(); double* values = timeStamp->getPointer(); - int const typ = getGmfSolKwd((int)nbComp, _dim) ; + int typ = getGmfSolKwd((int)nbComp, _dim) ; if(typ == -1) { addMessage( MeshFormat::Comment(" error with Number of Component ") << nbComp, /*fatal=*/true ); @@ -505,7 +497,7 @@ void MeshFormatWriter::extractSymetricTensor(double fullTensor[], double*& symTe for (int ii =0; ii<_dim; ii++) for (int jj =ii; jj<_dim; jj++) { - int const kk = _dim*(_dim-1)/2- (_dim-ii)*(_dim-ii-1)/2+jj; + int kk = _dim*(_dim-1)/2- (_dim-ii)*(_dim-ii-1)/2+jj; symTensor[kk] = fullTensor[ii+jj*_dim]; } } @@ -519,12 +511,12 @@ int MeshFormatWriter::getGmfSolKwd(const int nbComp, const int dim) } bool MeshFormatWriter::checkFileName() { - bool const ret = true; + bool ret = true; return ret; } bool MeshFormatWriter::checkFieldFileName() { - bool const ret = true; + bool ret = true; return ret; } @@ -558,7 +550,7 @@ MeshFormat::Status MeshFormatWriter::addMessage(const std::string& msg, void MeshFormatWriter::forward_shift(std::vector &conn) { - auto it = conn.begin(); + std::vector::iterator it = conn.begin(); for (; it != conn.end(); ++it) *it = *it+1; } @@ -583,7 +575,7 @@ void MeshFormatWriter::getNodes(MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMe std::copy(coordPrt, coordPrt+_dim, xyz); - MeshFormatNode const e(xyz[0], xyz[1], xyz[2], idNode); + MeshFormatNode e(xyz[0], xyz[1], xyz[2], idNode); _idNodeToNode.insert(std::pair (idNode, e)); coordPrt+= _dim; @@ -591,7 +583,7 @@ void MeshFormatWriter::getNodes(MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMe idNode++; } linkFamilyToNodes(); - auto itNode = _idNodeToNode.begin(); + std::map ::iterator itNode = _idNodeToNode.begin(); for (; itNode!= _idNodeToNode.end(); ++itNode) _dim == 3? _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfVertices, itNode->second.xyz[0], itNode->second.xyz[1], itNode->second.xyz[2], std::abs(itNode->second._famId) ) : @@ -600,247 +592,247 @@ void MeshFormatWriter::getNodes(MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMe } -void MeshFormatWriter::getNSEG2(MEDCoupling::mcIdType /*nbEdgesNSEG2*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1) +void MeshFormatWriter::getNSEG2(MEDCoupling::mcIdType nbEdgesNSEG2, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1) { MEDCoupling::MCAuto elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG2); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh1->getNodeIdsOfCell(it, conn) ; + umesh1->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_SEG2, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_SEG2, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_SEG2, idCellToCell) ); } -void MeshFormatWriter::getNSEG3( MEDCoupling::mcIdType /*nbEdgesNSEG3*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1) +void MeshFormatWriter::getNSEG3( MEDCoupling::mcIdType nbEdgesNSEG3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1) { MEDCoupling::MCAuto elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG3); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh1->getNodeIdsOfCell(it, conn) ; + umesh1->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_SEG3, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_SEG3, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_SEG3, idCellToCell) ); } -void MeshFormatWriter::getTRI3( MEDCoupling::mcIdType /*nbTRI3*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) +void MeshFormatWriter::getTRI3( MEDCoupling::mcIdType nbTRI3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) { MEDCoupling::MCAuto elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI3); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh2->getNodeIdsOfCell(it, conn) ; + umesh2->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_TRI3, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_TRI3, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_TRI3, idCellToCell) ); } -void MeshFormatWriter::getTRI6( MEDCoupling::mcIdType /*nbTRI6*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) +void MeshFormatWriter::getTRI6( MEDCoupling::mcIdType nbTRI6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) { MEDCoupling::MCAuto elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI6); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh2->getNodeIdsOfCell(it, conn) ; + umesh2->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_TRI6, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_TRI6, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_TRI6, idCellToCell) ); } -void MeshFormatWriter::getQUAD4( MEDCoupling::mcIdType /*nbQUAD4*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) +void MeshFormatWriter::getQUAD4( MEDCoupling::mcIdType nbQUAD4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) { MEDCoupling::MCAuto elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD4); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh2->getNodeIdsOfCell(it, conn) ; + umesh2->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_QUAD4, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_QUAD4, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_QUAD4, idCellToCell) ); } -void MeshFormatWriter::getQUAD8(MEDCoupling::mcIdType /*nbQUAD8*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) +void MeshFormatWriter::getQUAD8(MEDCoupling::mcIdType nbQUAD8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) { MEDCoupling::MCAuto elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD8); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh2->getNodeIdsOfCell(it, conn) ; + umesh2->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_QUAD8, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_QUAD8, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_QUAD8, idCellToCell) ); } -void MeshFormatWriter::getQUAD9(MEDCoupling::mcIdType /*nbQUAD9*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) +void MeshFormatWriter::getQUAD9(MEDCoupling::mcIdType nbQUAD9, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2) { MEDCoupling::MCAuto elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD9); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh2->getNodeIdsOfCell(it, conn) ; + umesh2->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_QUAD9, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_QUAD9, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_QUAD9, idCellToCell) ); } -void MeshFormatWriter::getTETRA4(MEDCoupling::mcIdType /*nbTETRA4*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) +void MeshFormatWriter::getTETRA4(MEDCoupling::mcIdType nbTETRA4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) { MEDCoupling::MCAuto elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA4); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh3->getNodeIdsOfCell(it, conn) ; + umesh3->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_TETRA4, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_TETRA4, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_TETRA4, idCellToCell) ); } -void MeshFormatWriter::getTETRA10(MEDCoupling::mcIdType /*nbTETRA10*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) +void MeshFormatWriter::getTETRA10(MEDCoupling::mcIdType nbTETRA10, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) { MEDCoupling::MCAuto elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA10); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh3->getNodeIdsOfCell(it, conn) ; + umesh3->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_TETRA10, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_TETRA10, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_TETRA10, idCellToCell) ); } -void MeshFormatWriter::getPYRA5(MEDCoupling::mcIdType /*nbPYRA5*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) +void MeshFormatWriter::getPYRA5(MEDCoupling::mcIdType nbPYRA5, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) { MEDCoupling::MCAuto elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PYRA5); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh3->getNodeIdsOfCell(it, conn) ; + umesh3->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_PYRA5, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_PYRA5, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_PYRA5, idCellToCell) ); } -void MeshFormatWriter::getHEXA8(MEDCoupling::mcIdType /*nbHEXA8*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) +void MeshFormatWriter::getHEXA8(MEDCoupling::mcIdType nbHEXA8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) { MEDCoupling::MCAuto elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA8); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh3->getNodeIdsOfCell(it, conn) ; + umesh3->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_HEXA8, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_HEXA8, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_HEXA8, idCellToCell) ); } -void MeshFormatWriter::getHEXA20(MEDCoupling::mcIdType /*nbHEXA20*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) +void MeshFormatWriter::getHEXA20(MEDCoupling::mcIdType nbHEXA20, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) { MEDCoupling::MCAuto elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA20); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh3->getNodeIdsOfCell(it, conn) ; + umesh3->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_HEXA20, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_HEXA20, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_HEXA20, idCellToCell) ); } -void MeshFormatWriter::getHEXA27(MEDCoupling::mcIdType /*nbHEXA27*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) +void MeshFormatWriter::getHEXA27(MEDCoupling::mcIdType nbHEXA27, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) { MEDCoupling::MCAuto elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA27); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh3->getNodeIdsOfCell(it, conn) ; + umesh3->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_HEXA27, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_HEXA27, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_HEXA27, idCellToCell) ); } -void MeshFormatWriter::getPENTA6(MEDCoupling::mcIdType /*nbPENTA6*/, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) +void MeshFormatWriter::getPENTA6(MEDCoupling::mcIdType nbPENTA6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3) { MEDCoupling::MCAuto elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PENTA6); std::map idCellToCell; - for (long const it : *elementId) + for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ ) { std::vector conn; - umesh3->getNodeIdsOfCell(it, conn) ; + umesh3->getNodeIdsOfCell(*it, conn) ; forward_shift(conn); - MeshFormatCell e(INTERP_KERNEL::NORM_PENTA6, (int)it); + MeshFormatCell e(INTERP_KERNEL::NORM_PENTA6, (int)*it); e.setConn(conn); - idCellToCell.insert(std::pair (it, e)); + idCellToCell.insert(std::pair (*it, e)); } _typeToIdCellToCell.insert(std::pair >(INTERP_KERNEL::NORM_PENTA6, idCellToCell) ); } @@ -858,7 +850,7 @@ void MeshFormatWriter::linkFamilyToNodes() const MEDCoupling::mcIdType * nodeIdsIt = nodeIds->begin(), * famIDEnd = nodeIds->end(); for(; nodeIdsIt< famIDEnd; ++nodeIdsIt) { - auto const itNode = _idNodeToNode.find((int)*nodeIdsIt); + std::map ::iterator itNode = _idNodeToNode.find((int)*nodeIdsIt); if (itNode == _idNodeToNode.end()) continue; else itNode->second._famId =(int) famIt->second; @@ -872,9 +864,10 @@ void MeshFormatWriter::linkFamilyToNodes() void MeshFormatWriter::linkFamilyToCells() { - std::vector const levs = _mesh->getNonEmptyLevels(); - for (int const meshDimRelToMax : levs) + std::vector levs = _mesh->getNonEmptyLevels(); + for (size_t iDim = 0; iDim < levs.size(); iDim++ ) { + int meshDimRelToMax = levs[iDim]; MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh = _mesh->getMeshAtLevel( meshDimRelToMax); MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0 = mesh->buildUnstructured(); const MEDCoupling::DataArrayIdType * famIdsField = _mesh->getFamilyFieldAtLevel(meshDimRelToMax); @@ -883,17 +876,17 @@ void MeshFormatWriter::linkFamilyToCells() for (; famID < famIDEnd; ++famID) { if (!(*famID)) continue; // "FAMILLE_ZERO" - std::string const famName = _mesh->getFamilyNameGivenId(*famID); + std::string famName = _mesh->getFamilyNameGivenId(*famID); MEDCoupling::MCAuto cellIds = _mesh->getFamilyArr( meshDimRelToMax, famName); const MEDCoupling::mcIdType * cellIdsIt = cellIds->begin(), *cellIDEnd = cellIds->end(); for(; cellIdsIt< cellIDEnd; ++cellIdsIt) { - INTERP_KERNEL::NormalizedCellType const type = umesh0->getTypeOfCell(*cellIdsIt); //TODO - auto const itCellMap = _typeToIdCellToCell.find(type); + INTERP_KERNEL::NormalizedCellType type = umesh0->getTypeOfCell(*cellIdsIt); //TODO + std::map >::iterator itCellMap = _typeToIdCellToCell.find(type); if (itCellMap == _typeToIdCellToCell.end()) continue; else { - auto const itCell = itCellMap->second.find((int)*cellIdsIt); + std::map ::iterator itCell = itCellMap->second.find((int)*cellIdsIt); if (itCell == itCellMap->second.end()) continue; else itCell->second._famId = (int)*famID; } @@ -908,10 +901,10 @@ void MeshFormatWriter::linkFamilyToCells() void MeshFormatWriter::writeCells() { - auto typeCellMapIt = _typeToIdCellToCell.begin(); + std::map < INTERP_KERNEL::NormalizedCellType, std::map >::iterator typeCellMapIt = _typeToIdCellToCell.begin(); for (; typeCellMapIt!= _typeToIdCellToCell.end(); ++typeCellMapIt) { - auto cellMapIt = typeCellMapIt->second.begin(); + std::map::iterator cellMapIt = typeCellMapIt->second.begin(); switch (typeCellMapIt->first) { case INTERP_KERNEL::NORM_SEG2 : diff --git a/src/MEDLoader/MeshFormatWriter.hxx b/src/MEDLoader/MeshFormatWriter.hxx index 04d3539e6..ceb05982f 100644 --- a/src/MEDLoader/MeshFormatWriter.hxx +++ b/src/MEDLoader/MeshFormatWriter.hxx @@ -20,22 +20,18 @@ #ifndef MESHFORMATWRITER_HXX #define MESHFORMATWRITER_HXX -#include -#include -#include -#include +#include #include #include -#include #include "MCAuto.hxx" -#include "NormalizedGeometricTypes" -#include "MEDLoaderDefines.hxx" -#include "MEDCouplingUMesh.hxx" +#include "InterpKernelException.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "MCType.hxx" #include "MEDMESHConverterUtilities.hxx" #include "libmesh5.hxx" #include "MEDFileMesh.hxx" +#include namespace MEDCoupling { diff --git a/src/MEDLoader/SauvMedConvertor.cxx b/src/MEDLoader/SauvMedConvertor.cxx index 1af316a62..f999f60d7 100644 --- a/src/MEDLoader/SauvMedConvertor.cxx +++ b/src/MEDLoader/SauvMedConvertor.cxx @@ -24,36 +24,20 @@ #include "SauvMedConvertor.hxx" #include "CellModel.hxx" -#include "InterpKernelException.hxx" -#include "MCIdType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MCType.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDFileMesh.hxx" #include "MEDFileField.hxx" #include "MEDFileData.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "NormalizedGeometricTypes" -#include "SauvUtilities.hxx" -#include -#include #include #include #include -#include -#include #include #include #include #include #include -#include -#include -#include -#include #ifdef WIN32 #include @@ -62,6 +46,7 @@ #endif #ifdef HAS_XDR +#include #include #endif @@ -211,9 +196,9 @@ namespace inline void reverse(const Cell & aCell, const std::vector > & swapVec ) { Cell* ma = const_cast(&aCell); - for (const auto & i : swapVec) - std::swap( ma->_nodes[ i.first ], - ma->_nodes[ i.second ]); + for ( unsigned i = 0; i < swapVec.size(); ++i ) + std::swap( ma->_nodes[ swapVec[i].first ], + ma->_nodes[ swapVec[i].second ]); if ( swapVec.empty() ) ma->_reverse = true; else @@ -230,7 +215,7 @@ namespace return i1->_number < i2->_number; } }; - using TCellToOrderMap = std::map; + typedef std::map< const Cell*, unsigned, TCellByIDCompare > TCellToOrderMap; //================================================================================ /*! @@ -245,7 +230,7 @@ namespace // check if relocation table is necessary bool isRelocated = false; unsigned newOrder = 0; - auto c2oIt = cell2order.begin(), c2oEnd = cell2order.end(); + TCellToOrderMap::iterator c2oIt = cell2order.begin(), c2oEnd = cell2order.end(); for ( ; !isRelocated && c2oIt != c2oEnd; ++c2oIt, ++newOrder ) isRelocated = ( c2oIt->second != newOrder ); @@ -260,9 +245,9 @@ namespace namespace // define default GAUSS points { - using TDoubleVector = std::vector; - using TCoordSlice = double *; - using TInt = int; + typedef std::vector TDoubleVector; + typedef double* TCoordSlice; + typedef int TInt; //--------------------------------------------------------------- //! Shape function definitions //--------------------------------------------------------------- @@ -430,7 +415,7 @@ namespace // define default GAUSS points //--------------------------------------------------------------- TSeg2a::TSeg2a():TShapeFun(1,2) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -442,7 +427,7 @@ namespace // define default GAUSS points //--------------------------------------------------------------- TSeg3a::TSeg3a():TShapeFun(1,3) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -456,7 +441,7 @@ namespace // define default GAUSS points TTria3a::TTria3a(): TShapeFun(2,3) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -469,7 +454,7 @@ namespace // define default GAUSS points //--------------------------------------------------------------- TTria6a::TTria6a():TShapeFun(2,6) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -487,7 +472,7 @@ namespace // define default GAUSS points TTria3b::TTria3b(): TShapeFun(2,3) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -501,7 +486,7 @@ namespace // define default GAUSS points TTria6b::TTria6b(): TShapeFun(2,6) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -519,7 +504,7 @@ namespace // define default GAUSS points TQuad4a::TQuad4a(): TShapeFun(2,4) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -534,7 +519,7 @@ namespace // define default GAUSS points TQuad8a::TQuad8a(): TShapeFun(2,8) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -554,7 +539,7 @@ namespace // define default GAUSS points TQuad4b::TQuad4b(): TShapeFun(2,4) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -569,7 +554,7 @@ namespace // define default GAUSS points TQuad8b::TQuad8b(): TShapeFun(2,8) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -589,7 +574,7 @@ namespace // define default GAUSS points TTetra4a::TTetra4a(): TShapeFun(3,4) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -604,7 +589,7 @@ namespace // define default GAUSS points TTetra10a::TTetra10a(): TShapeFun(3,10) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -627,7 +612,7 @@ namespace // define default GAUSS points TTetra4b::TTetra4b(): TShapeFun(3,4) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -642,7 +627,7 @@ namespace // define default GAUSS points TTetra10b::TTetra10b(): TShapeFun(3,10) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -665,7 +650,7 @@ namespace // define default GAUSS points THexa8a::THexa8a(): TShapeFun(3,8) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -684,7 +669,7 @@ namespace // define default GAUSS points THexa20a::THexa20a(TInt theDim, TInt theNbRef): TShapeFun(theDim,theNbRef) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -716,7 +701,7 @@ namespace // define default GAUSS points THexa27a::THexa27a(): THexa20a(3,27) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -734,7 +719,7 @@ namespace // define default GAUSS points THexa8b::THexa8b(): TShapeFun(3,8) { - TInt const aNbRef = GetNbRef(); + TInt aNbRef = GetNbRef(); for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -753,7 +738,7 @@ namespace // define default GAUSS points THexa20b::THexa20b(TInt theDim, TInt theNbRef): TShapeFun(theDim,theNbRef) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -785,7 +770,7 @@ namespace // define default GAUSS points TPenta6a::TPenta6a(): TShapeFun(3,6) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -802,7 +787,7 @@ namespace // define default GAUSS points TPenta6b::TPenta6b(): TShapeFun(3,6) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -819,7 +804,7 @@ namespace // define default GAUSS points TPenta15a::TPenta15a(): TShapeFun(3,15) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -846,7 +831,7 @@ namespace // define default GAUSS points TPenta15b::TPenta15b(): TShapeFun(3,15) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -873,7 +858,7 @@ namespace // define default GAUSS points TPyra5a::TPyra5a(): TShapeFun(3,5) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -889,7 +874,7 @@ namespace // define default GAUSS points TPyra5b::TPyra5b(): TShapeFun(3,5) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -905,7 +890,7 @@ namespace // define default GAUSS points TPyra13a::TPyra13a(): TShapeFun(3,13) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -930,7 +915,7 @@ namespace // define default GAUSS points TPyra13b::TPyra13b(): TShapeFun(3,13) { - std::size_t const aNbRef = myRefCoord.size(); + std::size_t aNbRef = myRefCoord.size(); for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ @@ -1489,7 +1474,7 @@ const int * SauvUtilities::getGibi2MedQuadraticInterlace( INTERP_KERNEL::Normali static const int seg3 [] = {0,2,1}; if ( conn.empty() ) { - conn.resize( MaxMedCellType + 1, nullptr ); + conn.resize( MaxMedCellType + 1, 0 ); conn[ NORM_HEXA20 ] = hexa20; conn[ NORM_PENTA15] = penta15; conn[ NORM_PYRA13 ] = pyra13; @@ -1508,7 +1493,7 @@ const int * SauvUtilities::getGibi2MedQuadraticInterlace( INTERP_KERNEL::Normali //================================================================================ Cell::Cell(const Cell& ma) - : _nodes(ma._nodes), _reverse(ma._reverse), _number(ma._number) + : _nodes(ma._nodes), _reverse(ma._reverse), _sortedNodeIDs(0), _number(ma._number) { if ( ma._sortedNodeIDs ) { @@ -1525,7 +1510,7 @@ Cell::Cell(const Cell& ma) SauvUtilities::Link Cell::link(int i) const { - std::size_t const i2 = ( i + 1 ) % _nodes.size(); + std::size_t i2 = ( i + 1 ) % _nodes.size(); if ( _reverse ) return std::make_pair( _nodes[i2]->_number, _nodes[i]->_number ); else @@ -1542,7 +1527,7 @@ const TID* Cell::getSortedNodes() const { if ( !_sortedNodeIDs ) { - size_t const l=_nodes.size(); + size_t l=_nodes.size(); _sortedNodeIDs = new TID[ l ]; for (size_t i=0; i!=l; ++i) @@ -1613,8 +1598,8 @@ mcIdType Group::size() const else if ( !_cells.empty() ) sizze = _cells.size(); else - for (auto _group : _groups) - sizze += _group->size(); + for ( size_t i = 0; i < _groups.size(); ++i ) + sizze += _groups[i]->size(); return ToIdType( sizze ); } @@ -1719,11 +1704,11 @@ ASCIIReader::~ASCIIReader() if (_file >= 0) { ::close (_file); - if (_start != nullptr) + if (_start != 0L) { delete [] _start; //delete [] _tmpBuf; - _start = nullptr; + _start = 0; } _file = -1; } @@ -1832,7 +1817,7 @@ void ASCIIReader::init( int nbToRead, int nbPosInLine, int width, int shift /*= } else { - _curPos = nullptr; + _curPos = 0; } } @@ -1912,7 +1897,7 @@ void ASCIIReader::next() } else { - _curPos = nullptr; + _curPos = 0; } } @@ -1931,9 +1916,9 @@ int ASCIIReader::getInt() const // 53619906 | SCALAIRE // 53619907 | -63312600499 1 0 0 0 -2 0 2 // where -63312600499 is actually -633 and 12600499 - char const hold=_curPos[_width]; + char hold=_curPos[_width]; _curPos[_width] = '\0'; - int const result = atoi( _curPos ); + int result = atoi( _curPos ); _curPos[_width] = hold; return result; //return atoi(str()); @@ -2007,7 +1992,7 @@ std::string ASCIIReader::getName() const */ //================================================================================ -XDRReader::XDRReader(const char* fileName) :FileReader(fileName), _xdrs_file(nullptr) +XDRReader::XDRReader(const char* fileName) :FileReader(fileName), _xdrs_file(NULL) { } @@ -2025,7 +2010,7 @@ XDRReader::~XDRReader() xdr_destroy((XDR*)_xdrs); free((XDR*)_xdrs); ::fclose(_xdrs_file); - _xdrs_file = nullptr; + _xdrs_file = NULL; } #endif } @@ -2073,7 +2058,7 @@ bool XDRReader::open() xdr_destroy((XDR*)_xdrs); free((XDR*)_xdrs); fclose(_xdrs_file); - _xdrs_file = nullptr; + _xdrs_file = NULL; } } #endif @@ -2124,7 +2109,7 @@ void XDRReader::initNameReading(int nbValues, int width) _xdr_kind = _xdr_kind_char; if(nbValues*width) { - unsigned int const nels = nbValues*width; + unsigned int nels = nbValues*width; _xdr_cvals = (char*)malloc((nels+1)*sizeof(char)); #ifdef HAS_XDR xdr_string((XDR*)_xdrs, &_xdr_cvals, nels); @@ -2146,7 +2131,7 @@ void XDRReader::initIntReading(int nbValues) if(nbValues) { #ifdef HAS_XDR - unsigned int const nels = nbValues; + unsigned int nels = nbValues; unsigned int actual_nels; _xdr_ivals = (int*)malloc(nels*sizeof(int)); xdr_array((XDR*)_xdrs, (char **)&_xdr_ivals, &actual_nels, nels, sizeof(int), (xdrproc_t)xdr_int); @@ -2167,7 +2152,7 @@ void XDRReader::initDoubleReading(int nbValues) if(nbValues) { #ifdef HAS_XDR - unsigned int const nels = nbValues; + unsigned int nels = nbValues; unsigned int actual_nels; _xdr_dvals = (double*)malloc(nels*sizeof(double)); xdr_array((XDR*)_xdrs, (char **)&_xdr_dvals, &actual_nels, nels, sizeof(double), (xdrproc_t)xdr_double); @@ -2332,37 +2317,37 @@ Group* IntermediateMED::addNewGroup(std::vector* groupsTo // correct pointers to sub-groups for ( size_t j = 0; j < _groups[i]._groups.size(); ++j ) { - std::size_t const iG = _groups[i]._groups[j] - &_groups[0]; + std::size_t iG = _groups[i]._groups[j] - &_groups[0]; newGroups[i]._groups[j] = & newGroups[ iG ]; } } // fix given groups if ( groupsToFix ) - for (auto & i : *groupsToFix) - if ( i ) + for ( size_t i = 0; i < groupsToFix->size(); ++i ) + if ( (*groupsToFix)[i] ) { - std::size_t const iG = i - &_groups[0]; - i = & newGroups[ iG ]; + std::size_t iG = (*groupsToFix)[i] - &_groups[0]; + (*groupsToFix)[i] = & newGroups[ iG ]; } // fix field supports for ( int isNode = 0; isNode < 2; ++isNode ) { - std::vector const& fields = isNode ? _nodeFields : _cellFields; - for (auto & field : fields) + std::vector& fields = isNode ? _nodeFields : _cellFields; + for ( size_t i = 0; i < fields.size(); ++i ) { - if ( !field ) continue; - for (auto & j : field->_sub) - if ( j._support ) + if ( !fields[i] ) continue; + for ( size_t j = 0; j < fields[i]->_sub.size(); ++j ) + if ( fields[i]->_sub[j]._support ) { - std::size_t const iG = j._support - &_groups[0]; - j._support = & newGroups[ iG ]; + std::size_t iG = fields[i]->_sub[j]._support - &_groups[0]; + fields[i]->_sub[j]._support = & newGroups[ iG ]; } - if ( field->_group ) + if ( fields[i]->_group ) { - std::size_t const iG = field->_group - &_groups[0]; - field->_group = & newGroups[ iG ]; + std::size_t iG = fields[i]->_group - &_groups[0]; + fields[i]->_group = & newGroups[ iG ]; } } } @@ -2455,9 +2440,9 @@ void IntermediateMED::setGroupLongNames() // IMP 0023285: only keep the meshes named in the table MED_MAIL // clear all group names - for (auto & _group : _groups) - if ( !_group._isProfile ) - _group._name.clear(); + for ( size_t i = 0; i < _groups.size(); ++i ) + if ( !_groups[i]._isProfile ) + _groups[i]._name.clear(); // IMP 0020434: mapping GIBI names to MED names @@ -2465,7 +2450,7 @@ void IntermediateMED::setGroupLongNames() std::set treatedGroups; - auto itGIBItoMED = _listGIBItoMED_mail.begin(); + std::list::iterator itGIBItoMED = _listGIBItoMED_mail.begin(); for (; itGIBItoMED != _listGIBItoMED_mail.end(); itGIBItoMED++) { if ( (int)_groups.size() < itGIBItoMED->gibi_id ) continue; @@ -2481,9 +2466,9 @@ void IntermediateMED::setGroupLongNames() } else if ( !grp._refNames.empty() && grp._refNames.back().empty() ) { - for (auto & _refName : grp._refNames) - if ( _refName.empty() ) - _refName = _mapStrings[ (*itGIBItoMED).med_id ]; + for ( unsigned i = 0; i < grp._refNames.size(); ++i ) + if ( grp._refNames[i].empty() ) + grp._refNames[i] = _mapStrings[ (*itGIBItoMED).med_id ]; } else { @@ -2495,16 +2480,17 @@ void IntermediateMED::setGroupLongNames() // remove all cells belonging to non-named groups only // use Cell::_reverse to mark cells to keep - for (auto & grp : _groups) + for ( size_t i = 0; i < _groups.size(); ++i ) { + SauvUtilities::Group & grp = _groups[i]; if ( grp._isProfile || !grp._name.empty() ) { - for (auto & _cell : grp._cells) - _cell->_reverse = true; + for ( size_t iC = 0; iC < grp._cells.size(); ++iC ) + grp._cells[iC]->_reverse = true; - for (auto & _group : grp._groups) - for (auto & _cell : _group->_cells) - _cell->_reverse = true; + for (size_t j = 0; j < grp._groups.size(); ++j ) + for ( size_t iC = 0; iC < grp._groups[j]->_cells.size(); ++iC ) + grp._groups[j]->_cells[iC]->_reverse = true; } } // remove non-marked cells (with _reverse == false) @@ -2512,7 +2498,7 @@ void IntermediateMED::setGroupLongNames() while ( cellsIt.nextType() ) { std::set & cells = _cellsByType[ cellsIt.type() ]; - auto cIt = cells.begin(); + std::set::iterator cIt = cells.begin(); while ( cIt != cells.end() ) if ( cIt->_reverse ) { @@ -2534,7 +2520,7 @@ void IntermediateMED::setGroupLongNames() void IntermediateMED::setFieldLongNames(std::set< std::string >& usedNames) { - auto itGIBItoMED = _listGIBItoMED_cham.begin(); + std::list::iterator itGIBItoMED = _listGIBItoMED_cham.begin(); for (; itGIBItoMED != _listGIBItoMED_cham.end(); itGIBItoMED++) { if (itGIBItoMED->gibi_pile == PILE_FIELD) @@ -2549,10 +2535,10 @@ void IntermediateMED::setFieldLongNames(std::set< std::string >& usedNames) for (itGIBItoMED =_listGIBItoMED_comp.begin(); itGIBItoMED != _listGIBItoMED_comp.end(); itGIBItoMED++) { - std::string const medName = _mapStrings[itGIBItoMED->med_id]; - std::string const gibiName = _mapStrings[itGIBItoMED->gibi_id]; + std::string medName = _mapStrings[itGIBItoMED->med_id]; + std::string gibiName = _mapStrings[itGIBItoMED->gibi_id]; - bool const name_found = false; + bool name_found = false; for ( int isNodal = 0; isNodal < 2 && !name_found; ++isNodal ) { std::vector & fields = isNodal ? _nodeFields : _cellFields; @@ -2561,13 +2547,13 @@ void IntermediateMED::setFieldLongNames(std::set< std::string >& usedNames) if (medName.find( fields[ifi]->_name + "." ) == 0 ) { std::vector& aSubDs = fields[ifi]->_sub; - std::size_t const nbSub = aSubDs.size(); + std::size_t nbSub = aSubDs.size(); for (std::size_t isu = 0; isu < nbSub; isu++) for (int ico = 0; ico < aSubDs[isu].nbComponents(); ico++) { if (aSubDs[isu].compName(ico) == gibiName) { - std::string const medNameCompo = medName.substr( fields[ifi]->_name.size() + 1 ); + std::string medNameCompo = medName.substr( fields[ifi]->_name.size() + 1 ); fields[ifi]->_sub[isu].compName(ico) = medNameCompo; } } @@ -2576,10 +2562,10 @@ void IntermediateMED::setFieldLongNames(std::set< std::string >& usedNames) } } // iterate on _listGIBItoMED_comp - for (auto & _nodeField : _nodeFields) - usedNames.insert( _nodeField->_name ); - for (auto & _cellField : _cellFields) - usedNames.insert( _cellField->_name ); + for ( size_t i = 0; i < _nodeFields.size() ; i++) + usedNames.insert( _nodeFields[i]->_name ); + for ( size_t i = 0; i < _cellFields.size() ; i++) + usedNames.insert( _cellFields[i]->_name ); } //================================================================================ @@ -2590,8 +2576,9 @@ void IntermediateMED::setFieldLongNames(std::set< std::string >& usedNames) void IntermediateMED::decreaseHierarchicalDepthOfSubgroups() { - for (auto & grp : _groups) + for (size_t i=0; i!=_groups.size(); ++i) { + Group& grp = _groups[i]; for (size_t j = 0; j < grp._groups.size(); ++j ) { Group & sub_grp = *grp._groups[j]; @@ -2606,9 +2593,9 @@ void IntermediateMED::decreaseHierarchicalDepthOfSubgroups() // remove empty sub-_groups std::vector< Group* > newSubGroups; newSubGroups.reserve( grp._groups.size() ); - for (auto & _group : grp._groups) - if ( !_group->empty() ) - newSubGroups.push_back( _group ); + for (size_t j = 0; j < grp._groups.size(); ++j ) + if ( !grp._groups[j]->empty() ) + newSubGroups.push_back( grp._groups[j] ); if ( newSubGroups.size() < grp._groups.size() ) grp._groups.swap( newSubGroups ); } @@ -2632,15 +2619,17 @@ void IntermediateMED::eraseUselessGroups() // } std::set groups2convert; // keep not named sub-groups of field supports - for (auto & grp : _groups) + for (size_t i=0; i!=_groups.size(); ++i) { + Group& grp = _groups[i]; if ( grp._isProfile && !grp._groups.empty() ) groups2convert.insert( grp._groups.begin(), grp._groups.end() ); } // keep named groups and their subgroups - for (auto & grp : _groups) + for (size_t i=0; i!=_groups.size(); ++i) { + Group& grp = _groups[i]; if ( !grp._name.empty() && !grp.empty() ) { groups2convert.insert( &grp ); @@ -2648,9 +2637,9 @@ void IntermediateMED::eraseUselessGroups() } } // erase groups that are not in groups2convert and not _isProfile - for (auto & _group : _groups) + for (size_t i=0; i!=_groups.size(); ++i) { - Group* grp = &_group; + Group* grp = &_groups[i]; if ( !grp->_isProfile && !groups2convert.count( grp ) ) { grp->_cells.clear(); @@ -2668,16 +2657,17 @@ void IntermediateMED::eraseUselessGroups() void IntermediateMED::detectMixDimGroups() { //hasMixedCells = false; - for (auto & grp : _groups) + for ( size_t i=0; i < _groups.size(); ++i ) { + Group& grp = _groups[i]; if ( grp._groups.size() < 2 ) continue; // check if sub-groups have different dimension - unsigned const dim1 = getDim( &grp ); + unsigned dim1 = getDim( &grp ); for ( size_t j = 1; j < grp._groups.size(); ++j ) { - unsigned const dim2 = getDim( grp._groups[j] ); + unsigned dim2 = getDim( grp._groups[j] ); if ( dim1 != dim2 ) { grp._cells.clear(); @@ -2704,7 +2694,7 @@ void IntermediateMED::orientElements2D() // ------------------------------------ // fix connectivity of quadratic edges // ------------------------------------ - std::set const& quadEdges = _cellsByType[ INTERP_KERNEL::NORM_SEG3 ]; + std::set& quadEdges = _cellsByType[ INTERP_KERNEL::NORM_SEG3 ]; if ( !quadEdges.empty() ) { elemIt = quadEdges.begin(), elemEnd = quadEdges.end(); @@ -2830,8 +2820,9 @@ void IntermediateMED::orientFaces3D() std::map > linkFacesMap; std::map >::iterator lfIt, lfIt2; - for (auto & grp : _groups) + for (size_t i=0; i!=_groups.size(); ++i) { + Group& grp = _groups[i]; if ( !grp._cells.empty() && getDimension( grp._cellType ) == 2 ) for ( size_t j = 0; j < grp._cells.size(); ++j ) if ( faces.insert( grp._cells[j] ).second ) @@ -2870,7 +2861,7 @@ void IntermediateMED::orientFaces3D() // loop on links of for ( int i = 0; i < (int)face->_nodes.size(); ++i ) { - Link const link = face->link( i ); + Link link = face->link( i ); // find the neighbor faces lfIt = linkFacesMap.find( link ); int nbFaceByLink = 0; @@ -2878,7 +2869,7 @@ void IntermediateMED::orientFaces3D() if ( lfIt != linkFacesMap.end() ) { std::list & fList = lfIt->second; - auto fIt = fList.begin(); + std::list::iterator fIt = fList.begin(); assert( fIt != fList.end() ); for ( ; fIt != fList.end(); fIt++, nbFaceByLink++ ) { @@ -2889,13 +2880,13 @@ void IntermediateMED::orientFaces3D() // reverse and remove badFace from linkFacesMap for ( int j = 0; j < (int)badFace->_nodes.size(); ++j ) { - Link const badlink = badFace->link( j ); + Link badlink = badFace->link( j ); if ( badlink == link ) continue; lfIt2 = linkFacesMap.find( badlink ); if ( lfIt2 != linkFacesMap.end() ) { std::list & ff = lfIt2->second; - auto const lfIt3 = find( ff.begin(), ff.end(), badFace ); + std::list::iterator lfIt3 = find( ff.begin(), ff.end(), badFace ); // check if badFace has been found, // else we can't erase it // case of degenerated face in edge @@ -2915,12 +2906,12 @@ void IntermediateMED::orientFaces3D() linkFacesMap.erase( lfIt ); } // add good neighbors to the queue - Link const revLink( link.second, link.first ); + Link revLink( link.second, link.first ); lfIt = linkFacesMap.find( revLink ); if ( lfIt != linkFacesMap.end() ) { std::list & fList = lfIt->second; - auto fIt = fList.begin(); + std::list::iterator fIt = fList.begin(); for ( ; fIt != fList.end(); fIt++, nbFaceByLink++ ) { ml.push_back( *fIt ); @@ -2933,7 +2924,7 @@ void IntermediateMED::orientFaces3D() { if ( manifold ) { - auto ii = ml.begin(); + std::list::iterator ii = ml.begin(); std::cout << nbFaceByLink << " faces by 1 link:" << std::endl; for( ; ii!= ml.end(); ii++ ) std::cout << "in sub-mesh <" << fgm[ *ii ]->_name << "> " << **ii << std::endl; @@ -3022,7 +3013,7 @@ void IntermediateMED::orientVolumes() vec[0] = normal[1] * vec01[2] - normal[2] * vec01[1]; vec[1] = normal[2] * vec01[0] - normal[0] * vec01[2]; vec[2] = normal[0] * vec01[1] - normal[1] * vec01[0]; - double const dot2 = vec[0]*vec03[0] + vec[1]*vec03[1] + vec[2]*vec03[2]; // vec*vec03 + double dot2 = vec[0]*vec03[0] + vec[1]*vec03[1] + vec[2]*vec03[2]; // vec*vec03 if ( dot2 < 0 ) // concave -> reverse normal { normal[0] *= -1; @@ -3038,7 +3029,7 @@ void IntermediateMED::orientVolumes() tbDir[2] = n[0][2] - n[3][2]; // compare 2 directions: normal and top-bottom - double const dot = normal[0]*tbDir[0] + normal[1]*tbDir[1] + normal[2]*tbDir[2]; + double dot = normal[0]*tbDir[0] + normal[1]*tbDir[1] + normal[2]*tbDir[2]; if ( dot < 0. ) // need reverse reverse( *elemIt, swapVec ); @@ -3056,10 +3047,10 @@ void IntermediateMED::orientVolumes() int NodeContainer::numberNodes() { int id = 1; - for (auto & _node : _nodes) - for (auto & j : _node) - if ( j.isUsed() ) - j._number = id++; + for ( size_t i = 0; i < _nodes.size(); ++i ) + for ( size_t j = 0; j < _nodes[i].size(); ++j ) + if ( _nodes[i][j].isUsed() ) + _nodes[i][j]._number = id++; return id-1; } @@ -3097,7 +3088,7 @@ void IntermediateMED::numberElements() if ( elemIt->_number < minNumber ) minNumber = elemIt->_number; if ( elemIt->_number > maxNumber ) maxNumber = elemIt->_number; } - mcIdType const typeSize = ToIdType( typeCells->size() ); + mcIdType typeSize = ToIdType( typeCells->size() ); if ( typeSize != maxNumber - minNumber + 1 ) ok = false; if ( prevNbElems+1 != (int)minNumber ) @@ -3210,7 +3201,7 @@ void IntermediateMED::setConnectivity( MEDCoupling::MEDFileUMesh* mesh, prevNbCells += ToIdType( cells->size() ); // fill dimMesh - TCellType const cellType = dimCells.type(); + TCellType cellType = dimCells.type(); nodalConnOfCell = &connectivity[0]; for ( size_t i = 0; i < cells->size(); ++i, nodalConnOfCell += nbCellNodes ) dimMesh->insertNextCell( cellType, nbCellNodes, nodalConnOfCell ); @@ -3255,16 +3246,17 @@ void IntermediateMED::setGroups( MEDCoupling::MEDFileUMesh* mesh ) std::vector< Group* > groupVec; if ( grp._groups.empty() ) groupVec.push_back( & grp ); else groupVec = grp._groups; - for (auto aG : groupVec) + for ( size_t iG = 0; iG < groupVec.size(); ++iG ) { + Group* aG = groupVec[ iG ]; if ( (int)getDim( aG ) != dim ) continue; - for (auto & _cell : aG->_cells) - cell2order.insert( cell2order.end(), std::make_pair( _cell, orderInGroup++ )); + for ( size_t iC = 0; iC < aG->_cells.size(); ++iC ) + cell2order.insert( cell2order.end(), std::make_pair( aG->_cells[iC], orderInGroup++ )); } if ( cell2order.empty() ) continue; - bool const isSelfIntersect = ( orderInGroup != cell2order.size() ); + bool isSelfIntersect = ( orderInGroup != cell2order.size() ); if ( isSelfIntersect ) // self intersecting group { std::ostringstream msg; @@ -3332,7 +3324,7 @@ void IntermediateMED::setGroups( MEDCoupling::MEDFileUMesh* mesh ) bool IntermediateMED::isOnAll( const Group* grp, int & dimRel ) const { - int const dim = getDim( grp ); + int dim = getDim( grp ); mcIdType nbElems = 0; if ( dim == 0 ) @@ -3356,7 +3348,7 @@ bool IntermediateMED::isOnAll( const Group* grp, int & dimRel ) const dimRel = dim - meshDim; } - bool const onAll = ( nbElems == grp->size() ); + bool onAll = ( nbElems == grp->size() ); return onAll; } @@ -3368,7 +3360,7 @@ bool IntermediateMED::isOnAll( const Group* grp, int & dimRel ) const MEDCoupling::MEDFileFields * IntermediateMED::makeMEDFileFields(MEDCoupling::MEDFileUMesh* mesh) { - if ( _nodeFields.empty() && _cellFields.empty() ) return nullptr; + if ( _nodeFields.empty() && _cellFields.empty() ) return 0; // set long names std::set< std::string > usedFieldNames; @@ -3427,7 +3419,7 @@ void IntermediateMED::setFields( SauvUtilities::DoubleField* fld, double * valPtr = values->getPointer(); if ( uniteSubs ) { - mcIdType const nbElems = fld->_group->size(); + mcIdType nbElems = fld->_group->size(); for ( mcIdType elemShift = 0; elemShift < nbElems && iSub < fld->_sub.size(); ) elemShift += fld->setValues( valPtr, iSub++, elemShift ); setTS( fld, values, medFields, mesh ); @@ -3507,7 +3499,7 @@ void IntermediateMED::setTS( SauvUtilities::DoubleField* fld, // set gauss points if ( timeStamp->getTypeOfField() == MEDCoupling::ON_GAUSS_PT ) { - TGaussDef const gaussDef( fld->_sub[iSub]._support->_cellType, + TGaussDef gaussDef( fld->_sub[iSub]._support->_cellType, fld->_sub[iSub].nbGauss() ); timeStamp->setGaussLocalizationOnType( fld->_sub[iSub]._support->_cellType, gaussDef.myRefCoords, @@ -3557,7 +3549,7 @@ void IntermediateMED::makeFieldNewName(std::set< std::string >& usedNames, } else { - std::string::size_type const pos = base.rfind('_'); + std::string::size_type pos = base.rfind('_'); if ( pos != std::string::npos ) base = base.substr( 0, pos+1 ); else @@ -3681,7 +3673,7 @@ bool DoubleField::isMedCompatible(bool& sameNbGauss) const bool DoubleField::hasSameComponentsBySupport() const { - auto sub_data = _sub.begin(); + std::vector< _Sub_data >::const_iterator sub_data = _sub.begin(); const _Sub_data& first_sub_data = *sub_data; for ( ++sub_data ; sub_data != _sub.end(); ++sub_data ) { @@ -3784,7 +3776,7 @@ mcIdType DoubleField::setValues( double * valPtr, const int iSub, const mcIdType mcIdType valsShift = 0; for ( mcIdType iS = iSub-1, shift = elemShift; shift > 0; --iS) { - mcIdType const nbE = _sub[iS]._support->size(); + mcIdType nbE = _sub[iS]._support->size(); shift -= nbE; valsShift += nbE * _sub[iS].nbComponents() * _sub[iS].nbGauss(); } @@ -3792,14 +3784,14 @@ mcIdType DoubleField::setValues( double * valPtr, const int iSub, const mcIdType if ( isConstField ) for ( mcIdType iE = 0; iE < nbElems; ++iE ) { - mcIdType const iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift ); + mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift ); for ( iComp = 0; iComp < nbComponents; ++iComp ) valPtr[ iMed + iComp ] = compValues[iComp][ 0 ]; } else for ( mcIdType iE = 0; iE < nbElems; ++iE ) { - mcIdType const iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift ); + mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift ); for ( iComp = 0; iComp < nbComponents; ++iComp ) for ( int iG = 0; iG < nbGauss; ++iG ) valPtr[ iMed + iG * nbComponents + iComp ] = compValues[iComp][ iE * nbGauss + iG ]; @@ -3815,19 +3807,19 @@ mcIdType DoubleField::setValues( double * valPtr, const int iSub, const mcIdType IntermediateMED::~IntermediateMED() { - for (auto & _nodeField : _nodeFields) - if ( _nodeField ) - delete _nodeField; + for ( size_t i = 0; i < _nodeFields.size(); ++i ) + if ( _nodeFields[i] ) + delete _nodeFields[i]; _nodeFields.clear(); - for (auto & _cellField : _cellFields) - if ( _cellField ) - delete _cellField; + for ( size_t i = 0; i < _cellFields.size(); ++i ) + if ( _cellFields[i] ) + delete _cellFields[i]; _cellFields.clear(); - for (auto & _group : _groups) - if ( _group._medGroup ) - _group._medGroup->decrRef(); + for ( size_t i = 0; i < _groups.size(); ++i ) + if ( _groups[i]._medGroup ) + _groups[i]._medGroup->decrRef(); } //================================================================================ @@ -3856,7 +3848,7 @@ const std::set< Cell > * CellsByDimIterator::nextType() while ( ++myCurType < myTypeEnd ) if ( !myImed->_cellsByType[myCurType].empty() && ( myDim < 0 || dim(false) == myDim )) return & myImed->_cellsByType[myCurType]; - return nullptr; + return 0; } /*! * \brief return dimension of cells returned by the last or further next() diff --git a/src/MEDLoader/SauvMedConvertor.hxx b/src/MEDLoader/SauvMedConvertor.hxx index 73c8d3d3a..580ef1187 100644 --- a/src/MEDLoader/SauvMedConvertor.hxx +++ b/src/MEDLoader/SauvMedConvertor.hxx @@ -24,17 +24,12 @@ #ifndef __SauvMedConvertor_HXX__ #define __SauvMedConvertor_HXX__ -#include "MCIdType.hxx" +#include "InterpKernelException.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "MEDCouplingRefCountObject.hxx" #include "SauvUtilities.hxx" #include "MCType.hxx" -#include "NormalizedGeometricTypes" -#include -#include -#include -#include -#include #include #include #include @@ -56,18 +51,18 @@ namespace SauvUtilities struct IntermediateMED; // ============================================================================== - using TID = mcIdType; // an ID countered from 1 - using Link = std::pair; // a pair of node numbers + typedef mcIdType TID; // an ID countered from 1 + typedef std::pair Link; // a pair of node numbers typedef INTERP_KERNEL::NormalizedCellType TCellType; // ============================================================================== struct Node { - TID _number{0}; + TID _number; size_t _coordID; - Node()= default; + Node():_number(0){} bool isUsed() const { return _number != 0; } }; @@ -75,13 +70,13 @@ namespace SauvUtilities struct Cell { std::vector< Node* > _nodes; - mutable bool _reverse{false}; // to reverse orientation of a face only - mutable TID* _sortedNodeIDs{nullptr}; // for comparison - mutable TID _number{0}; + mutable bool _reverse; // to reverse orientation of a face only + mutable TID* _sortedNodeIDs; // for comparison + mutable TID _number; - Cell(size_t nnNodes=0) : _nodes(nnNodes) {} + Cell(size_t nnNodes=0) : _nodes(nnNodes),_reverse(false),_sortedNodeIDs(0),_number(0) {} Cell(const Cell& ma); - void init() const { if ( _sortedNodeIDs ) delete [] _sortedNodeIDs; _sortedNodeIDs = nullptr; } + void init() const { if ( _sortedNodeIDs ) delete [] _sortedNodeIDs; _sortedNodeIDs = 0; } ~Cell() { init(); } const TID* getSortedNodes() const; // creates if needed and return _sortedNodeIDs @@ -96,11 +91,11 @@ namespace SauvUtilities // ============================================================================== struct Group { - TCellType _cellType{INTERP_KERNEL::NORM_ERROR}; + TCellType _cellType; std::string _name; std::vector _cells; std::vector< Group* > _groups; // des sous-groupes composant le Group - bool _isProfile{false}; // is a field support or not + bool _isProfile; // is a field support or not std::vector _refNames; /* names of groups referring this one; _refNames is resized according to nb of references while reading a group (pile 1) and it is filled with @@ -108,12 +103,12 @@ namespace SauvUtilities reference is converted into a copy of the medGroup (issue 0021311) */ - MEDCoupling::DataArrayIdType* _medGroup{nullptr}; // result of conversion + MEDCoupling::DataArrayIdType* _medGroup; // result of conversion std::vector< mcIdType > _relocTable; // for _cells[i] gives its index in _medGroup bool empty() const { return _cells.empty() && _groups.empty(); } mcIdType size() const; - Group() {} + Group():_cellType(INTERP_KERNEL::NORM_ERROR), _isProfile(false), _medGroup(NULL) {} }; // ============================================================================== @@ -143,17 +138,17 @@ namespace SauvUtilities std::string _name; std::string _description; // field description std::vector< _Sub_data > _sub; - Group* _group{nullptr}; /* if _group == NULL then each subcomponent makes a + Group* _group; /* if _group == NULL then each subcomponent makes a separate med field, else all subcomponents are converted into timestamps of one med field. The latter is possible only if nb of components in all subs is the same and supports of subcomponents do not overlap */ std::vector< std::vector< double > > _comp_values; - MEDCoupling::MEDFileFieldMultiTS* _curMedField{nullptr}; + MEDCoupling::MEDFileFieldMultiTS* _curMedField; DoubleField( int nb_sub, int total_nb_comp ) - : _sub(nb_sub) { _comp_values.reserve( total_nb_comp ); } + : _sub(nb_sub), _group(NULL), _curMedField(NULL) { _comp_values.reserve( total_nb_comp ); } ~DoubleField(); std::vector< double >& addComponent( int nb_values ); // return a vector ready to fill in bool hasCommonSupport() const { return _group; } // true if there is one support for all subs @@ -240,8 +235,8 @@ namespace SauvUtilities */ struct IntermediateMED { - unsigned _spaceDim{0}; - unsigned _nbNodes{0}; + unsigned _spaceDim; + unsigned _nbNodes; NodeContainer _points; std::vector _coords; std::vector _groups; @@ -254,13 +249,13 @@ namespace SauvUtilities std::list _listGIBItoMED_comp; // to read from table "MED_COMP" of PILE_TABLES std::map _mapStrings; // to read from PILE_STRINGS - IntermediateMED() = default; + IntermediateMED(): _spaceDim(0), _nbNodes(0) {} ~IntermediateMED(); Node* getNode( TID nID ) { return _points.getNode( nID ); } mcIdType getNbCellsOfType( TCellType type ) const { return ToIdType(_cellsByType[type].size()); } const Cell* insert(TCellType type, const Cell& ma) { return &( *_cellsByType[type].insert( ma ).first ); } - Group* addNewGroup(std::vector* groupsToFix=nullptr); + Group* addNewGroup(std::vector* groupsToFix=0); MEDCoupling::MEDFileData* convertInMEDFileDS(); private: @@ -317,19 +312,19 @@ namespace SauvUtilities { public: ASCIIReader(const char* fileName); - ~ASCIIReader() override; - bool isASCII() const override; - bool open() override; - bool getNextLine (char* & line, bool raiseOEF = true ) override; - void initNameReading(int nbValues, int width = 8) override; - void initIntReading(int nbValues) override; - void initDoubleReading(int nbValues) override; - bool more() const override; - void next() override; - int getInt() const override; - float getFloat() const override; - double getDouble() const override; - std::string getName() const override; + virtual ~ASCIIReader(); + virtual bool isASCII() const; + virtual bool open(); + virtual bool getNextLine (char* & line, bool raiseOEF = true ); + virtual void initNameReading(int nbValues, int width = 8); + virtual void initIntReading(int nbValues); + virtual void initDoubleReading(int nbValues); + virtual bool more() const; + virtual void next(); + virtual int getInt() const; + virtual float getFloat() const; + virtual double getDouble() const; + virtual std::string getName() const; int lineNb() const { return _lineNb; } std::string getClassName() const override { return std::string("ASCIIReader"); } private: @@ -356,19 +351,19 @@ namespace SauvUtilities { public: XDRReader(const char* fileName); - ~XDRReader() override; - bool isASCII() const override; - bool open() override; - bool getNextLine (char* & line, bool raiseOEF = true ) override; - void initNameReading(int nbValues, int width = 8) override; - void initIntReading(int nbValues) override; - void initDoubleReading(int nbValues) override; - bool more() const override; - void next() override; - int getInt() const override; - float getFloat() const override; - double getDouble() const override; - std::string getName() const override; + virtual ~XDRReader(); + virtual bool isASCII() const; + virtual bool open(); + virtual bool getNextLine (char* & line, bool raiseOEF = true ); + virtual void initNameReading(int nbValues, int width = 8); + virtual void initIntReading(int nbValues); + virtual void initDoubleReading(int nbValues); + virtual bool more() const; + virtual void next(); + virtual int getInt() const; + virtual float getFloat() const; + virtual double getDouble() const; + virtual std::string getName() const; std::string getClassName() const override { return std::string("XDRReader"); } private: diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index e6ad167f9..f2a64ffff 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -23,22 +23,14 @@ #include "SauvReader.hxx" -#include "InterpKernelException.hxx" #include "SauvMedConvertor.hxx" #include "MCAuto.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "MEDCouplingRefCountObject.hxx" -#include "SauvUtilities.hxx" -#include "NormalizedGeometricTypes" -#include -#include #include -#include -#include +#include #include -#include -#include -#include using namespace MEDCoupling; using namespace SauvUtilities; @@ -54,7 +46,7 @@ namespace public: Localizer() { - _locale = setlocale(LC_NUMERIC, nullptr); + _locale = setlocale(LC_NUMERIC, NULL); setlocale(LC_NUMERIC, "C"); } ~Localizer() @@ -80,7 +72,7 @@ SauvReader* SauvReader::New(const std::string& fileName) parser = new XDRReader( fileName.c_str() ); if ( parser->open() ) { - auto* reader = new SauvReader; + SauvReader* reader = new SauvReader; reader->_fileReader = parser.retn(); return reader; } @@ -89,7 +81,7 @@ SauvReader* SauvReader::New(const std::string& fileName) parser = new ASCIIReader( fileName.c_str() ); if ( parser->open() ) { - auto* reader = new SauvReader; + SauvReader* reader = new SauvReader; reader->_fileReader = parser.retn(); return reader; } @@ -140,7 +132,7 @@ std::string SauvReader::lineNb() const MEDCoupling::MEDFileData * SauvReader::loadInMEDFileDS() { - Localizer const loc; // localization, to read numbers in "C" locale + Localizer loc; // localization, to read numbers in "C" locale SauvUtilities::IntermediateMED iMed; // intermadiate DS _iMed = &iMed; @@ -410,11 +402,11 @@ void SauvReader::read_PILE_SOUS_MAILLAGE(const int nbObjects, for (int object=0; object!=nbObjects; ++object) // loop on sub-groups { initIntReading( 5 ); - int const castemCellType = getIntNext(); - int const nbSubGroups = getIntNext(); - int const nbReferences = getIntNext(); - int const nbNodesPerElem = getIntNext(); - int const nbElements = getIntNext(); + int castemCellType = getIntNext(); + int nbSubGroups = getIntNext(); + int nbReferences = getIntNext(); + int nbNodesPerElem = getIntNext(); + int nbElements = getIntNext(); _iMed->_groups.push_back(Group()); SauvUtilities::Group & group = _iMed->_groups.back(); @@ -470,7 +462,7 @@ void SauvReader::read_PILE_SOUS_MAILLAGE(const int nbObjects, ma.init(); for ( int n = 0; n < nbNodesPerElem; ++n ) { - int const nodeID = getIntNext(); + int nodeID = getIntNext(); pNode = _iMed->getNode( nodeID ); ma._nodes[n] = pNode; _iMed->_nbNodes += ( !pNode->isUsed() ); @@ -486,7 +478,7 @@ void SauvReader::read_PILE_SOUS_MAILLAGE(const int nbObjects, // set group names for (i=0; i!=(int)objectNames.size(); ++i) { - int const grpID = nameIndices[i]; + int grpID = nameIndices[i]; SauvUtilities::Group & grp = _iMed->_groups[ grpID-1 ]; if ( !grp._name.empty() ) // a group has several names { // create a group with subgroup grp and named grp.name @@ -516,7 +508,7 @@ void SauvReader::read_PILE_LREEL (const int nbObjects, std::vector& for (int object=0; object!=nbObjects; ++object) // pour chaque Group { initIntReading(1); - int const nb_vals = getIntNext(); + int nb_vals = getIntNext(); initDoubleReading(nb_vals); for(int i=0; i&, std:: if ( isXRD() ) { initIntReading(1); - int const nb_vals = getIntNext(); + int nb_vals = getIntNext(); initIntReading(nb_vals); for(int i=0; i&, std::ve if ( isXRD() ) { initIntReading(1); - int const nb_vals = getIntNext(); + int nb_vals = getIntNext(); initDoubleReading(nb_vals); for(int i=0; i&, std:: if ( isXRD() ) { initIntReading(1); - int const nb_vals = getIntNext(); + int nb_vals = getIntNext(); initIntReading(nb_vals); for(int i=0; i& for (int object=0; object!=nbObjects; ++object) // pour chaque Group { initIntReading(2); - int const len = getIntNext(); - int const nb_vals = getIntNext(); - int const nb_char = len*nb_vals; + int len = getIntNext(); + int nb_vals = getIntNext(); + int nb_char = len*nb_vals; int nb_char_tmp = 0; - int const fixed_length = 71; + int fixed_length = 71; while (nb_char_tmp < nb_char) { - int const remain_len = nb_char - nb_char_tmp; + int remain_len = nb_char - nb_char_tmp; int width; if ( remain_len > fixed_length ) { @@ -626,18 +618,18 @@ void SauvReader::read_PILE_MODL (const int nbObjects, std::vector&, { // see wrmodl.eso initIntReading(10); - int const n1 = getIntNext(); - int const nm2 = getIntNext(); - int const nm3 = getIntNext(); - int const nm4 = getIntNext(); - int const nm5 = getIntNext(); - int const n45 = getIntNext(); + int n1 = getIntNext(); + int nm2 = getIntNext(); + int nm3 = getIntNext(); + int nm4 = getIntNext(); + int nm5 = getIntNext(); + int n45 = getIntNext(); /*int nm6 =*/ getIntNext(); /*int nm7 =*/ getIntNext(); next(); next(); - int const nm1 = n1 * n45; - int const nm9 = n1 * 16; + int nm1 = n1 * n45; + int nm9 = n1 * 16; for (initIntReading(nm1); more(); next()); for (initIntReading(nm9); more(); next()); for (initNameReading(nm5, 8); more(); next()); @@ -657,14 +649,14 @@ void SauvReader::read_PILE_MODL (const int nbObjects, std::vector&, void SauvReader::read_PILE_NOEUDS (const int nbObjects, std::vector&, std::vector&) { initIntReading(1); - int const nb_indices = getIntNext(); + int nb_indices = getIntNext(); if (nb_indices != nbObjects) THROW_IK_EXCEPTION("Error of reading PILE NUMERO " << PILE_NOEUDS << lineNb() ); for ( initIntReading( nbObjects ); more(); next() ) { - int const coordID = getInt(); + int coordID = getInt(); _iMed->getNode( index()+1 )->_coordID = coordID; } } @@ -675,10 +667,10 @@ void SauvReader::read_PILE_NOEUDS (const int nbObjects, std::vector */ //================================================================================ -void SauvReader::read_PILE_COORDONNEES (const int /*nbObjects*/, std::vector&, std::vector&) +void SauvReader::read_PILE_COORDONNEES (const int nbObjects, std::vector&, std::vector&) { initIntReading(1); - int const nbReals = getIntNext(); + int nbReals = getIntNext(); if ( nbReals < (int)(_iMed->_nbNodes*(_iMed->_spaceDim+1)) ) THROW_IK_EXCEPTION("Error of reading PILE NUMERO " << PILE_COORDONNEES << lineNb() ); @@ -707,8 +699,8 @@ void SauvReader::read_PILE_COORDONNEES (const int /*nbObjects*/, std::vector& supports, SauvUtilities::DoubleField* field) { - SauvUtilities::Group* group = nullptr; - set const sup_set( supports.begin(), supports.end() ); + SauvUtilities::Group* group = NULL; + set sup_set( supports.begin(), supports.end() ); if ( sup_set.size() == 1 ) // one or equal supports { group = supports[0]; @@ -719,13 +711,13 @@ void SauvReader::setFieldSupport(const vector& supports, map nbGaussByCellType; for ( size_t i = 0; i < supports.size(); ++i ) { - auto const ct2ng = nbGaussByCellType.find( supports[i]->_cellType ); + map::iterator ct2ng = nbGaussByCellType.find( supports[i]->_cellType ); if ( ct2ng == nbGaussByCellType.end() ) nbGaussByCellType[ supports[i]->_cellType ] = field->_sub[i].nbGauss(); else if ( ct2ng->second != field->_sub[i].nbGauss() ) return; } - bool const isSameCellType = ( nbGaussByCellType.size() == 1 ); + bool isSameCellType = ( nbGaussByCellType.size() == 1 ); // try to find an existing composite group with the same sub-groups if ( isSameCellType ) for ( size_t i = 0; i < _iMed->_groups.size() && !group; ++i ) @@ -765,8 +757,8 @@ void SauvReader::setFieldSupport(const vector& supports, isSwapped = false; for ( std::size_t i = 1; i < groups.size(); ++i ) { - std::size_t const nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size(); - std::size_t const nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size(); + std::size_t nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size(); + std::size_t nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size(); if ( nbN1 > nbN2 ) { isSwapped = isModified = true; @@ -782,12 +774,12 @@ void SauvReader::setFieldSupport(const vector& supports, size_t iFromSub = 0, iNewSub = 0, iNewComp = 0; for ( ; iFromSub < field->_sub.size(); iFromSub += groups.size() ) { - size_t const iFromComp = iNewComp; - for (auto & group : groups) + size_t iFromComp = iNewComp; + for ( size_t iG = 0; iG < groups.size(); ++iG ) { size_t iComp = iFromComp; for ( size_t iSub = iFromSub; iSub < field->_sub.size(); ++iSub ) - if ( field->_sub[ iSub ]._support == group ) + if ( field->_sub[ iSub ]._support == groups[ iG ] ) { newSub[ iNewSub++ ] = field->_sub[ iSub ]; int iC = 0, nbC = field->_sub[ iSub ].nbComponents(); @@ -825,7 +817,7 @@ void SauvReader::setFieldNames(const vector& field unsigned i; for ( i = 0; i < indices_objets_nommes.size(); ++i ) { - int const fieldIndex = indices_objets_nommes[ i ]; + int fieldIndex = indices_objets_nommes[ i ]; if ( fields[ fieldIndex - 1 ] ) fields[ fieldIndex - 1 ]->_name = objets_nommes[ i ]; } @@ -841,7 +833,7 @@ void SauvReader::read_PILE_NODES_FIELD (const int nbObjects, std::vector& objectNames, std::vector& nameIndices) { - _iMed->_nodeFields.resize( nbObjects, (SauvUtilities::DoubleField*) nullptr ); + _iMed->_nodeFields.resize( nbObjects, (SauvUtilities::DoubleField*) 0 ); for (int object=0; object!=nbObjects; ++object) // loop on fields { // EXAMPLE ( with no values ) @@ -875,7 +867,7 @@ void SauvReader::read_PILE_NODES_FIELD (const int nbObjects, initIntReading( nb_sub * 3 ); for ( i_sub = 0; i_sub < nb_sub; ++i_sub ) { - int const supId = -getIntNext(); // (a) reference to support + int supId = -getIntNext(); // (a) reference to support if ( supId < 1 || supId > (int)_iMed->_groups.size() ) THROW_IK_EXCEPTION("Wrong mesh reference: "<< supId << lineNb() ); supports[ i_sub ] = &_iMed->_groups[ supId-1 ]; // (a) reference to support @@ -888,7 +880,7 @@ void SauvReader::read_PILE_NODES_FIELD (const int nbObjects, } // create a field if there are values - SauvUtilities::DoubleField* fdouble = nullptr; + SauvUtilities::DoubleField* fdouble = 0; if ( total_nb_values > 0 ) fdouble = new DoubleField( nb_sub, total_nb_comp ); _iMed->_nodeFields[ object ] = fdouble; @@ -903,7 +895,7 @@ void SauvReader::read_PILE_NODES_FIELD (const int nbObjects, for ( i_comp = 0; i_comp < nb_comps[ i_sub ]; ++i_comp, next() ) { // store component name - string const compName = getName(); + string compName = getName(); if ( fdouble ) fdouble->_sub[ i_sub ].compName( i_comp ) = compName; } @@ -982,14 +974,14 @@ void SauvReader::read_PILE_FIELD (const int nbObjects, // (17) 1.00000000000000E+02 1.00000000000000E+02 1.00000000000000E+02 // (18) ... - _iMed->_cellFields.resize( nbObjects, (SauvUtilities::DoubleField*) nullptr ); + _iMed->_cellFields.resize( nbObjects, (SauvUtilities::DoubleField*) 0 ); for (int object=0; object!=nbObjects; ++object) // pour chaque field { initIntReading( 4 ); int i_sub, nb_sub = getIntNext(); // (1) 2 6 next(); // skip "2" next(); // skip "6" - int const title_length = getIntNext(); // <title length> + int title_length = getIntNext(); // <title length> if ( nb_sub < 1 ) THROW_IK_EXCEPTION("Error of field reading: wrong nb of subcomponents " << nb_sub << lineNb() ); @@ -1026,7 +1018,7 @@ void SauvReader::read_PILE_FIELD (const int nbObjects, vector<int> nb_comp( nb_sub ); for ( i_sub = 0; i_sub < nb_sub; ++i_sub ) { // (3) - int const supportId = -getIntNext(); // <reference to support> + int supportId = -getIntNext(); // <reference to support> next(); // ignore <address> nb_comp [ i_sub ] = getIntNext(); // <nb of components in the sub> for ( int i = 0; i < 6; ++i ) next(); // ignore 6 ints, in example "0 0 0 -2 0 3" @@ -1047,7 +1039,7 @@ void SauvReader::read_PILE_FIELD (const int nbObjects, // loop on subcomponents of a field, each of which refers to // a certain support and has its own number of components; // read component values - SauvUtilities::DoubleField* fdouble = nullptr; + SauvUtilities::DoubleField* fdouble = 0; for ( i_sub = 0; i_sub < nb_sub; ++ i_sub ) { vector<string> comp_names( nb_comp[ i_sub ]), comp_type( nb_comp[ i_sub ]); @@ -1067,7 +1059,7 @@ void SauvReader::read_PILE_FIELD (const int nbObjects, << ">" << lineNb() ); } // now type is known, create a field, one for all subs - bool const isReal = (nb_comp[i_sub] > 0) ? (comp_type[0] == "REAL*8") : true; + bool isReal = (nb_comp[i_sub] > 0) ? (comp_type[0] == "REAL*8") : true; if ( !fdouble && total_nb_comp ) { if ( !isReal ) @@ -1083,7 +1075,7 @@ void SauvReader::read_PILE_FIELD (const int nbObjects, { // (9) nb of values initIntReading( 4 ); - int const nb_val_by_elem = getIntNext(); + int nb_val_by_elem = getIntNext(); int nb_values = getIntNext(); next(); next(); @@ -1133,9 +1125,9 @@ void SauvReader::read_PILE_TABLES (const int nbObjects, { // IMP 0020434: mapping GIBI names to MED names - string const table_med_mail = "MED_MAIL"; - string const table_med_cham = "MED_CHAM"; - string const table_med_comp = "MED_COMP"; + string table_med_mail = "MED_MAIL"; + string table_med_cham = "MED_CHAM"; + string table_med_comp = "MED_COMP"; int table_med_mail_id = -1; int table_med_cham_id = -1; int table_med_comp_id = -1; @@ -1153,7 +1145,7 @@ void SauvReader::read_PILE_TABLES (const int nbObjects, // read tables "MED_MAIL", "MED_CHAM" and "MED_COMP", that keeps correspondence // between GIBI names (8 symbols if any) and MED names (possibly longer) initIntReading(1); - int const nb_table_vals = getIntNext(); + int nb_table_vals = getIntNext(); if (nb_table_vals < 0) THROW_IK_EXCEPTION("Error of reading PILE NUMERO 10" << lineNb() ); @@ -1216,13 +1208,13 @@ void SauvReader::read_PILE_TABLES (const int nbObjects, //================================================================================ void SauvReader::read_PILE_STRINGS (const int nbObjects, - std::vector<std::string>& /*objectNames*/, - std::vector<int>& /*nameIndices*/) + std::vector<std::string>& objectNames, + std::vector<int>& nameIndices) { // IMP 0020434: mapping GIBI names to MED names initIntReading(2); - int const stringLen = getIntNext(); - int const nbSubStrings = getIntNext(); + int stringLen = getIntNext(); + int nbSubStrings = getIntNext(); if (nbSubStrings != nbObjects) THROW_IK_EXCEPTION("Error of reading PILE NUMERO 27" << lineNb() ); @@ -1232,7 +1224,7 @@ void SauvReader::read_PILE_STRINGS (const int nbObjects, const int fixedLength = 71; while ((int)aWholeString.length() < stringLen) { - int const remainLen = (int)(stringLen - aWholeString.length()); + int remainLen = (int)(stringLen - aWholeString.length()); int len; if ( remainLen > fixedLength ) { @@ -1254,7 +1246,7 @@ void SauvReader::read_PILE_STRINGS (const int nbObjects, while ((int)aWholeString.length() < stringLen) { getNextLine( line ); - int const remainLen = (int)(stringLen - aWholeString.length()); + int remainLen = (int)(stringLen - aWholeString.length()); if ( remainLen > fixedLength ) { aWholeString += line + 1; diff --git a/src/MEDLoader/SauvReader.hxx b/src/MEDLoader/SauvReader.hxx index d03bfab36..789973176 100644 --- a/src/MEDLoader/SauvReader.hxx +++ b/src/MEDLoader/SauvReader.hxx @@ -24,10 +24,10 @@ #define __SAUVREADER_HXX__ #include "MEDLoaderDefines.hxx" +#include "InterpKernelException.hxx" #include "SauvUtilities.hxx" #include "MEDCouplingRefCountObject.hxx" -#include <cstddef> #include <vector> #include <string> #include <set> @@ -48,12 +48,12 @@ class SauvReader : public MEDCoupling::RefCountObject public: MEDLOADER_EXPORT static SauvReader* New(const std::string& fileName); MEDLOADER_EXPORT MEDCoupling::MEDFileData * loadInMEDFileDS(); - MEDLOADER_EXPORT ~SauvReader() override; + MEDLOADER_EXPORT ~SauvReader(); MEDLOADER_EXPORT std::string getClassName() const override { return std::string("SauvReader"); } private: - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const; void readRecord2(); void readRecord4(); void readRecord7(); @@ -90,7 +90,7 @@ class SauvReader : public MEDCoupling::RefCountObject void next() { _fileReader->next(); } int index() const { return _fileReader->index(); } int getInt() const { return _fileReader->getInt(); } - int getIntNext() { int const i = getInt(); next(); return i; } + int getIntNext() { int i = getInt(); next(); return i; } float getFloat() const { return _fileReader->getFloat(); } double getDouble() const { return _fileReader->getDouble(); } std::string getName() const { return _fileReader->getName(); } diff --git a/src/MEDLoader/SauvUtilities.hxx b/src/MEDLoader/SauvUtilities.hxx index c92e15c7a..9945aaf7d 100644 --- a/src/MEDLoader/SauvUtilities.hxx +++ b/src/MEDLoader/SauvUtilities.hxx @@ -25,12 +25,10 @@ #include "MEDLoaderDefines.hxx" #include "MEDCouplingRefCountObject.hxx" -#include "NormalizedGeometricTypes" +#include "NormalizedUnstructuredMesh.hxx" -#include <cstddef> #include <string> #include <sstream> -#include <vector> namespace SauvUtilities { @@ -90,7 +88,7 @@ namespace SauvUtilities { public: FileReader(const char* fileName); - ~FileReader() override = default; + virtual ~FileReader() {} virtual bool isASCII() const = 0; virtual bool open() = 0; @@ -106,8 +104,8 @@ namespace SauvUtilities virtual double getDouble() const = 0; virtual std::string getName() const = 0; protected: - std::size_t getHeapMemorySizeWithoutChildren() const override { return 0; } - std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override { return std::vector<const BigMemoryObject *>(); } + std::size_t getHeapMemorySizeWithoutChildren() const { return 0; } + std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const { return std::vector<const BigMemoryObject *>(); } protected: std::string _fileName; int _iRead, _nbToRead; diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 77980d814..800cf9cff 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -23,30 +23,16 @@ #include "SauvWriter.hxx" #include "InterpKernelException.hxx" -#include "MCIdType.hxx" -#include "MEDFileFieldMultiTS.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCType.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDFileMesh.hxx" #include "MEDFileField.hxx" #include "MEDFileData.hxx" #include "CellModel.hxx" -#include "NormalizedGeometricTypes" -#include "SauvUtilities.hxx" -#include <cctype> #include <fstream> +#include <sstream> #include <iostream> #include <cstdlib> #include <iomanip> -#include <map> -#include <set> -#include <string> -#include <utility> -#include <vector> using namespace MEDCoupling; using namespace SauvUtilities; @@ -101,7 +87,7 @@ namespace if ( !name.empty() ) { // cut off leading white spaces - string::size_type const firstChar = name.find_first_not_of(" \t"); + string::size_type firstChar = name.find_first_not_of(" \t"); if (firstChar < name.length()) { name = name.substr(firstChar); @@ -111,7 +97,7 @@ namespace name = ""; // only whitespaces there - remove them } // cut off trailing white spaces - string::size_type const lastChar = name.find_last_not_of(" \t"); + string::size_type lastChar = name.find_last_not_of(" \t"); if (lastChar < name.length()) name = name.substr(0, lastChar + 1); } @@ -144,7 +130,7 @@ namespace if (!healedName.empty()) { string name = healedName; - std::size_t const len = name.length(); + std::size_t len = name.length(); for (std::size_t i = 0; i < len; ++i) name[i] = (char)toupper(name[i]); @@ -155,13 +141,13 @@ namespace { INFOS_MED("Save <" << theName << "> as <" << name << ">"); - auto const it = nameMap.find(name); + map<string,int>::iterator it = nameMap.find(name); if (it != nameMap.end()) { // There is already such name in the map. // a. Replace in the map the old pair by the current one - int const old_ind = nameMap[name]; + int old_ind = nameMap[name]; nameMap[name] = ind; // b. Rebuild the old pair (which was in the map, // it seems to be built automatically by step II) @@ -182,10 +168,10 @@ namespace if (new_loc_index > 0) { // prefix - string const str = name.substr(0,5); + string str = name.substr(0,5); if (namePrefixesMap.find(str) != namePrefixesMap.end()) { - int const old_loc_index = namePrefixesMap[str]; + int old_loc_index = namePrefixesMap[str]; if (new_loc_index < old_loc_index) new_loc_index = old_loc_index; } namePrefixesMap[str] = new_loc_index; @@ -201,7 +187,7 @@ namespace if (len > 5) name = name.substr(0,5); // numeric suffix - auto const name2ind = namePrefixesMap.insert( make_pair( name, 0 )).first; + map<string,int>::iterator name2ind = namePrefixesMap.insert( make_pair( name, 0 )).first; string numSuffix = SauvUtilities::toString( ++(name2ind->second) ); if ( numSuffix.size() + name.size() > 8 ) @@ -277,7 +263,7 @@ void SauvWriter::setMEDFileDS(const MEDFileData* medData, for ( int i = 0; i < fields->getNumberOfFields(); ++i ) { MEDFileAnyTypeFieldMultiTS * fB = fields->getFieldAtPos(i); - auto * f = dynamic_cast<MEDFileFieldMultiTS *>(fB); + MEDFileFieldMultiTS * f = dynamic_cast<MEDFileFieldMultiTS *>(fB); if(!f) continue;// fields on int32 not managed if ( f->getMeshName() == _fileMesh->getName() ) @@ -344,8 +330,10 @@ void SauvWriter::fillSubMeshes( int& nbSauvObjects, map<string,int>& nameNbMap ) // fill names of SubMesh'es and count nb of sauv sub-meshes they will be stored into nbSauvObjects = 0; map<string,int> namePrefixMap; - for (auto & sm : _subs) + for ( size_t i = 0; i < _subs.size(); ++i ) { + SubMesh& sm = _subs[i]; + sm._nbSauvObjects = 0; if ( sm._subs.empty() ) { @@ -381,10 +369,11 @@ void SauvWriter::fillSubMeshes( int& nbSauvObjects, map<string,int>& nameNbMap ) void SauvWriter::fillFamilySubMeshes() { - auto* nilSm = (SubMesh*) nullptr; - std::vector<int> const dims = _fileMesh->getNonEmptyLevelsExt(); - for (int const dimRelExt : dims) + SubMesh* nilSm = (SubMesh*) 0; + std::vector<int> dims = _fileMesh->getNonEmptyLevelsExt(); + for ( size_t iDim = 0; iDim < dims.size(); ++iDim ) { + int dimRelExt = dims[ iDim ]; MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(dimRelExt); const DataArrayIdType * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt); if ( !famIds ) continue; @@ -400,12 +389,12 @@ void SauvWriter::fillFamilySubMeshes() if ( *famID != curFamID ) { curFamID = *famID; - auto const f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first; + map< mcIdType, SubMesh* >::iterator f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first; if ( !f2s->second ) f2s->second = addSubMesh( "", dimRelExt ); // no names for families curSubMesh = f2s->second; } - INTERP_KERNEL::NormalizedCellType const cellType = + INTERP_KERNEL::NormalizedCellType cellType = dimRelExt == 1 ? INTERP_KERNEL::NORM_POINT1 : mesh->getTypeOfCell( cellID ); curSubMesh->_cellIDsByType[ cellType ].push_back( cellID ); } @@ -443,7 +432,7 @@ void SauvWriter::fillFamilySubMeshes() void SauvWriter::fillGroupSubMeshes() { const map<string, vector<string> >& grpFams = _fileMesh->getGroupInfo(); - auto g2ff = grpFams.begin(); + map<string, vector<string> >::const_iterator g2ff = grpFams.begin(); for ( ; g2ff != grpFams.end(); ++g2ff ) { const string& groupName = g2ff->first; @@ -451,10 +440,10 @@ void SauvWriter::fillGroupSubMeshes() if ( famNames.empty() ) continue; std::vector<SubMesh*> famSubMeshes( famNames.size() ); std::size_t k = 0; - for (const auto & famName : famNames) + for ( size_t i = 0; i < famNames.size(); ++i ) { - mcIdType const famID = _fileMesh->getFamilyId( famName.c_str() ); - auto const i2f = _famIDs2Sub.find( famID ); + mcIdType famID = _fileMesh->getFamilyId( famNames[i].c_str() ); + map< mcIdType, SubMesh* >::iterator i2f = _famIDs2Sub.find( famID ); if ( i2f != _famIDs2Sub.end() ) { famSubMeshes[ k ] = i2f->second; @@ -500,19 +489,19 @@ void SauvWriter::fillGroupSubMeshes() void SauvWriter::fillProfileSubMeshes() { _profile2Sub.clear(); - auto* nilSm = (SubMesh*) nullptr; + SubMesh* nilSm = (SubMesh*) 0; for ( int isOnNodes = 0; isOnNodes < 2; ++isOnNodes ) { vector< MCAuto< MEDFileFieldMultiTS > > fields = isOnNodes ? _nodeFields : _cellFields; - for (auto & field : fields) + for ( size_t i = 0; i < fields.size(); ++i ) { - vector< pair<int,int> > iters = field->getIterations(); + vector< pair<int,int> > iters = fields[i]->getIterations(); vector<INTERP_KERNEL::NormalizedCellType> types; vector< vector<TypeOfField> > typesF; vector< vector<string> > pfls, locs; - field->getFieldSplitedByType( iters[0].first, iters[0].second, + fields[i]->getFieldSplitedByType( iters[0].first, iters[0].second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); int dimRelExt; for ( size_t iType = 0; iType < types.size(); ++iType ) @@ -523,14 +512,14 @@ void SauvWriter::fillProfileSubMeshes() dimRelExt = getDimension( types[iType] ) - _fileMesh->getMeshDimension(); for ( size_t iPfl = 0; iPfl < pfls[iType].size(); ++iPfl ) { - bool const isOnAll = pfls[iType][iPfl].empty(); + bool isOnAll = pfls[iType][iPfl].empty(); if ( isOnAll ) pfls[iType][iPfl] = noProfileName( types[iType] ); - auto const pfl2sm = + map< string, SubMesh* >::iterator pfl2sm = _profile2Sub.insert( make_pair( pfls[iType][iPfl], nilSm )).first; if ( !pfl2sm->second ) { SubMesh* sm = pfl2sm->second = addSubMesh( "", dimRelExt ); // no names for profiles - const DataArrayIdType * pfl = isOnAll ? nullptr : field->getProfile( pfls[iType][iPfl].c_str() ); + const DataArrayIdType * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() ); makeProfileIDs( sm, types[iType], pfl ); } } @@ -548,19 +537,19 @@ void SauvWriter::fillProfileSubMeshes() int SauvWriter::evaluateNbProfileSubMeshes() const { std::size_t nb = 0; - for (const auto & _nodeField : _nodeFields) - nb += 1 + _nodeField->getPflsReallyUsed().size(); + for ( std::size_t i = 0; i < _nodeFields.size(); ++i ) + nb += 1 + _nodeFields[i]->getPflsReallyUsed().size(); - for (const auto & _cellField : _cellFields) + for ( std::size_t i = 0; i < _cellFields.size(); ++i ) { - nb += _cellField->getPflsReallyUsed().size(); + nb += _cellFields[i]->getPflsReallyUsed().size(); - vector< pair<int,int> > iters = _cellField->getIterations(); + vector< pair<int,int> > iters = _cellFields[i]->getIterations(); vector<INTERP_KERNEL::NormalizedCellType> types; vector< vector<TypeOfField> > typesF; vector< vector<string> > pfls, locs; - _cellField->getFieldSplitedByType( iters[0].first, iters[0].second, + _cellFields[i]->getFieldSplitedByType( iters[0].first, iters[0].second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); nb += 2 * types.size(); // x 2 - a type can be on nodes and on cells at the same time } @@ -580,7 +569,7 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, { MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(sm->_dimRelExt); - const auto* uMesh = dynamic_cast< const MEDCouplingUMesh* > ((const MEDCouplingMesh*) mesh ); + const MEDCouplingUMesh* uMesh = dynamic_cast< const MEDCouplingUMesh* > ((const MEDCouplingMesh*) mesh ); if ( sm->_dimRelExt == 1 ) type = INTERP_KERNEL::NORM_POINT1; vector< mcIdType >& ids = sm->_cellIDsByType[ type ]; @@ -614,7 +603,7 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, code[1] = mesh->getNumberOfCellsWithType( type ); code[2] = -1; } - vector<const DataArrayIdType *> const idsPerType( 1, profile ); + vector<const DataArrayIdType *> idsPerType( 1, profile ); MCAuto<DataArrayIdType> resIDs = uMesh->checkTypeConsistencyAndContig( code, idsPerType ); if (( const DataArrayIdType *) resIDs ) @@ -702,7 +691,7 @@ void SauvWriter::writeNames( const map<string,int>& nameNbMap ) // * 8001 FORMAT(8(1X,A8)) TFieldCounter fcount( *_sauvFile, 8 ); *_sauvFile << left; - auto nameNbIt = nameNbMap.begin(); + map<string,int>::const_iterator nameNbIt = nameNbMap.begin(); for ( ; nameNbIt != nameNbMap.end(); nameNbIt++, fcount++ ) *_sauvFile << " " << setw(8) << nameNbIt->first; fcount.stop(); @@ -740,7 +729,7 @@ void SauvWriter::writeSubMeshes() for ( unsigned int iSub = 0; iSub < _subs.size(); ++iSub ) { - SubMesh const& sm = _subs[iSub]; + SubMesh& sm = _subs[iSub]; if ( sm._nbSauvObjects < 1 ) continue; // The first record of each sub-mesh writes @@ -767,13 +756,13 @@ void SauvWriter::writeSubMeshes() const vector<mcIdType>& cellIDs = sm._cellIDsByType[iType]; if ( cellIDs.empty() ) continue; - auto + INTERP_KERNEL::NormalizedCellType cellType = INTERP_KERNEL::NormalizedCellType( iType ); const INTERP_KERNEL::CellModel & cell = INTERP_KERNEL::CellModel::GetCellModel( cellType ); - int const castemType = SauvUtilities::med2gibiGeom( cellType ); - unsigned const nbElemNodes = cell.getNumberOfNodes(); - std::size_t const nbElems = cellIDs.size(); + int castemType = SauvUtilities::med2gibiGeom( cellType ); + unsigned nbElemNodes = cell.getNumberOfNodes(); + std::size_t nbElems = cellIDs.size(); *_sauvFile << setw(8) << castemType << zeroI8 @@ -829,13 +818,13 @@ void SauvWriter::writeSubMeshes() void SauvWriter::writeCompoundSubMesh(int iSub) { - SubMesh const& sm = _subs[iSub]; + SubMesh& sm = _subs[iSub]; if ( sm._nbSauvObjects < 1 || sm._subs.empty()) return; vector< int > subIDs; - for (auto & _sub : sm._subs) // loop on sub-meshes of families - for ( int j = 0; j < _sub->_nbSauvObjects; ++j ) - subIDs.push_back( _sub->_id + j ); + for ( size_t i = 0; i < sm._subs.size(); ++i ) // loop on sub-meshes of families + for ( int j = 0; j < sm._subs[i]->_nbSauvObjects; ++j ) + subIDs.push_back( sm._subs[i]->_id + j ); *_sauvFile << zeroI8 << setw(8) << subIDs.size() @@ -892,8 +881,8 @@ void SauvWriter::writeNodes() { for ( int j = 0; j < dim; ++j, fcount++ ) { - double const coo = coordArray->getIJ( i, j ); - bool const zero = ( -precision < coo && coo < precision ); + double coo = coordArray->getIJ( i, j ); + bool zero = ( -precision < coo && coo < precision ); *_sauvFile << setw(22) << ( zero ? 0.0 : coo ); } *_sauvFile << density; @@ -913,7 +902,7 @@ void SauvWriter::writeNodes() void SauvWriter::writeLongNames() { - int const nbTables = + int nbTables = 3 - _longNames[ LN_MAIL ].empty() - _longNames[ LN_CHAM ].empty() - _longNames[ LN_COMP ].empty(); if (nbTables == 0) return; @@ -949,7 +938,7 @@ void SauvWriter::writeLongNames() *_sauvFile << setw(8) << longNames.size()*4 << endl; // Nb of table values - auto itGIBItoMED = longNames.begin(); + vector<nameGIBItoMED>::iterator itGIBItoMED = longNames.begin(); for (; itGIBItoMED != longNames.end(); itGIBItoMED++, iStr++) { // PILE of i-th key (med name) @@ -1017,7 +1006,7 @@ void SauvWriter::writeFieldNames( const bool isNodal, for ( unsigned int iF = 0; iF < flds.size(); ++iF ) { - string const name = addName( nameNbMap, fldNamePrefixMap, flds[iF]->getName(), iF+1 ); + string name = addName( nameNbMap, fldNamePrefixMap, flds[iF]->getName(), iF+1 ); nameGIBItoMED aMEDName; aMEDName.gibi_pile = isNodal ? PILE_NODES_FIELD : PILE_FIELD; aMEDName.gibi_id = iF+1; @@ -1044,11 +1033,11 @@ void SauvWriter::makeCompNames(const string& fieldName, const vector<string>& compInfo, map<string, string>& mapMedToGibi) { - for (const auto & i : compInfo) - mapMedToGibi[i] = cleanName( i ); + for ( size_t i = 0; i < compInfo.size(); ++i ) + mapMedToGibi[compInfo[i]] = cleanName( compInfo[i] ); int compIndex = 1; - auto namesIt = mapMedToGibi.begin(); + map<string, string>::iterator namesIt = mapMedToGibi.begin(); for (; namesIt != mapMedToGibi.end(); namesIt++) { string & compGibiName = (*namesIt).second; @@ -1064,7 +1053,7 @@ void SauvWriter::makeCompNames(const string& fieldName, while (mapMedToGibi.count(compGibiName) > 0); // real component name could be CXXX } - string const compMedName = fieldName + "." + namesIt->first; + string compMedName = fieldName + "." + namesIt->first; nameGIBItoMED aMEDName; aMEDName.med_name = compMedName; aMEDName.gibi_pile = PILE_STRINGS; @@ -1095,11 +1084,11 @@ void SauvWriter::writeNodalFields(map<string,int>& fldNamePrefixMap) // (5) cree par muc pri // (6) // (7) 2 - for (auto & _nodeField : _nodeFields) + for ( size_t iF = 0; iF < _nodeFields.size(); ++iF ) { // (1) write nb subcomponents, nb components(total) - vector< pair<int,int> > const iters = _nodeField->getIterations(); - const vector<string>& compInfo = _nodeField->getInfo(); + vector< pair<int,int> > iters = _nodeFields[iF]->getIterations(); + const vector<string>& compInfo = _nodeFields[iF]->getInfo(); const std::size_t nbSub = iters.size(); const std::size_t nbComp = compInfo.size(); const std::size_t totalNbComp = nbSub * nbComp; @@ -1112,18 +1101,20 @@ void SauvWriter::writeNodalFields(map<string,int>& fldNamePrefixMap) // write support, number of values and number of components fcount.init(10); vector< mcIdType > vals(3); - for (auto it : iters) + for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { + pair<int,int> it = iters[iIt]; + vector<INTERP_KERNEL::NormalizedCellType> types; vector< vector<TypeOfField> > typesF; vector< vector<string> > pfls, locs; vector< vector< std::pair<mcIdType,mcIdType> > > valsVec; - valsVec=_nodeField->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), + valsVec=_nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); // believe that there can be only one type in a nodal field, // so do not use a loop on types if ( pfls[0][0].empty() ) pfls[0][0] = noProfileName( types[0] ); - auto const pfl2Sub = _profile2Sub.find( pfls[0][0] ); + map< string, SubMesh* >::iterator pfl2Sub = _profile2Sub.find( pfls[0][0] ); if ( pfl2Sub == _profile2Sub.end() ) THROW_IK_EXCEPTION( "SauvWriter::writeNodalFields(): no sub-mesh for profile |" << pfls[0][0] << "|"); @@ -1137,7 +1128,7 @@ void SauvWriter::writeNodalFields(map<string,int>& fldNamePrefixMap) // (3) Write names of components map<string, string> mapMedToGibi; - makeCompNames( _nodeField->getName(), compInfo, mapMedToGibi ); + makeCompNames( _nodeFields[iF]->getName(), compInfo, mapMedToGibi ); fcount.init(8); *_sauvFile << left; for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) @@ -1152,24 +1143,26 @@ void SauvWriter::writeNodalFields(map<string,int>& fldNamePrefixMap) *_sauvFile << " " << setw(8) << 0; fcount.stop(); - string const description = _nodeField->getName(); + string description = _nodeFields[iF]->getName(); *_sauvFile << endl; // (5) TYPE *_sauvFile << setw(72) << description.substr(0,71) << endl; // (6) TITRE //*_sauvFile << endl; // (7) 0 attributes // write values of each component fcount.init( 3 ); // 3 values per a line - for (auto it : iters) + for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { + pair<int,int> it = iters[iIt]; + vector<INTERP_KERNEL::NormalizedCellType> types; vector< vector<TypeOfField> > typesF; vector< vector<string> > pfls, locs; vector< vector< std::pair<mcIdType,mcIdType> > > valsVec; - valsVec = _nodeField->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), + valsVec = _nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); // believe that there can be only one type in a nodal field, // so do not perform a loop on types - const DataArrayDouble* valsArray = _nodeField->getUndergroundDataArray(it.first, it.second); + const DataArrayDouble* valsArray = _nodeFields[iF]->getUndergroundDataArray(it.first, it.second); for ( size_t j = 0; j < compInfo.size(); ++j ) { for ( size_t i = valsVec[0][0].first; i < (std::size_t)valsVec[0][0].second; ++i, fcount++ ) @@ -1217,17 +1210,19 @@ void SauvWriter::writeElemFields(map<string,int>& fldNamePrefixMap) { // count nb of sub-components std::size_t iSub, nbSub = 0; - vector< pair<int,int> > const iters = _cellFields[iF]->getIterations(); - for (auto it : iters) + vector< pair<int,int> > iters = _cellFields[iF]->getIterations(); + for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { + pair<int,int> it = iters[iIt]; + vector<INTERP_KERNEL::NormalizedCellType> types; vector< vector<TypeOfField> > typesF; vector< vector<string> > pfls, locs; vector< vector< std::pair<mcIdType,mcIdType> > > valsVec; valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); - for (const auto & i : valsVec) - nbSub += i.size(); + for ( size_t i = 0; i < valsVec.size(); ++i ) + nbSub += valsVec[i].size(); } // (1) write nb sub-components, title length *_sauvFile << setw(8) << nbSub @@ -1235,7 +1230,7 @@ void SauvWriter::writeElemFields(map<string,int>& fldNamePrefixMap) << setw(8) << 6 // whatever << setw(8) << 72 << endl; // title length // (2) title - string const title = _cellFields[iF]->getName(); + string title = _cellFields[iF]->getName(); *_sauvFile << setw(72) << title.substr(0,71) << endl; *_sauvFile << setw(72) << " " << endl; @@ -1244,8 +1239,10 @@ void SauvWriter::writeElemFields(map<string,int>& fldNamePrefixMap) const vector<string>& compInfo = _cellFields[iF]->getInfo(); vals[2] = ToIdType( compInfo.size() ); fcount.init(10); - for (auto it : iters) + for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { + pair<int,int> it = iters[iIt]; + vector<INTERP_KERNEL::NormalizedCellType> types; vector< vector<TypeOfField> > typesF; vector< vector<string> > pfls, locs; @@ -1255,7 +1252,7 @@ void SauvWriter::writeElemFields(map<string,int>& fldNamePrefixMap) for ( size_t iP = 0; iP < pfls[iType].size(); ++iP ) { if ( pfls[iType][iP].empty() ) pfls[iType][iP] = noProfileName( types[iType] ); - auto const pfl2Sub = _profile2Sub.find( pfls[iType][iP] ); + map< string, SubMesh* >::iterator pfl2Sub = _profile2Sub.find( pfls[iType][iP] ); if ( pfl2Sub == _profile2Sub.end() ) THROW_IK_EXCEPTION( "SauvWriter::writeElemFields(): no sub-mesh for profile |" << pfls[iType][iP] << "|"); @@ -1280,8 +1277,9 @@ void SauvWriter::writeElemFields(map<string,int>& fldNamePrefixMap) // loop on sub-components of a field, each of which refers to // a certain support and has its own number of components - for (auto it : iters) + for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { + pair<int,int> it = iters[iIt]; writeElemTimeStamp( iF, it.first, it.second ); } } // loop on cell fields @@ -1293,7 +1291,7 @@ void SauvWriter::writeElemFields(map<string,int>& fldNamePrefixMap) */ //================================================================================ -void SauvWriter::writeElemTimeStamp(int iF, int iter, int order) +void SauvWriter::writeElemTimeStamp(int iF, int iter, int order) { // (6) 317767 317761 317755 317815 // (7) YOUN NU H SIGY @@ -1345,7 +1343,7 @@ void SauvWriter::writeElemTimeStamp(int iF, int iter, int order) int nbPntPerCell = 1; if ( !locs[iType][iP].empty() ) { - int const locID = _cellFields[iF]->getLocalizationId( locs[iType][iP].c_str() ); + int locID = _cellFields[iF]->getLocalizationId( locs[iType][iP].c_str() ); nbPntPerCell = _cellFields[iF]->getNbOfGaussPtPerCell( locID ); } else if ( typesF[iType][iP] == ON_GAUSS_NE ) diff --git a/src/MEDLoader/SauvWriter.hxx b/src/MEDLoader/SauvWriter.hxx index 015722064..6b36b97f5 100644 --- a/src/MEDLoader/SauvWriter.hxx +++ b/src/MEDLoader/SauvWriter.hxx @@ -25,13 +25,11 @@ #include "MEDLoaderDefines.hxx" #include "MEDCouplingRefCountObject.hxx" -#include "NormalizedGeometricTypes" +#include "NormalizedUnstructuredMesh.hxx" #include "SauvUtilities.hxx" #include "MCAuto.hxx" #include "MCType.hxx" -#include <cstddef> -#include <fstream> #include <vector> #include <string> #include <map> @@ -57,8 +55,8 @@ namespace MEDCoupling MEDLOADER_EXPORT std::string getClassName() const override { return std::string("SauvWriter"); } private: SauvWriter(); - std::size_t getHeapMemorySizeWithoutChildren() const override; - std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const override; + std::size_t getHeapMemorySizeWithoutChildren() const; + std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const; /*! * \brief Class representing a GIBI sub-mesh (described in the pile 1 of the SAUVE file). * It stands for a named med sub-mesh (family, etc) and contains either cell IDs or other sub-meshes. diff --git a/src/MEDLoader/Test/MEDLoaderTest.cxx b/src/MEDLoader/Test/MEDLoaderTest.cxx index 2c805e490..5d1c77ddb 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.cxx +++ b/src/MEDLoader/Test/MEDLoaderTest.cxx @@ -19,12 +19,7 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDLoaderTest.hxx" -#include "InterpKernelException.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingFieldInt.hxx" -#include "MCType.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCAuto.hxx" +#include "MEDCouplingCMesh.hxx" #include "MEDLoader.hxx" #include "MEDLoaderBase.hxx" #include "MEDCouplingUMesh.hxx" @@ -32,20 +27,11 @@ #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingMemArray.hxx" -#include "NormalizedGeometricTypes" #include "TestInterpKernelUtils.hxx" // getResourceFile() #include "MEDFileMesh.hxx" #include <algorithm> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <functional> -#include <math.h> -#include <cstdint> #include <numeric> -#include <vector> -#include <utility> -#include <set> using namespace MEDCoupling; @@ -111,7 +97,7 @@ void MEDLoaderTest::testFieldRW1() { MEDCouplingFieldDouble *f1=buildVecFieldOnCells_1(); WriteField("file6.med",f1,true); - auto *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell("file6.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1)); + MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell("file6.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1)); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f1->decrRef(); f2->decrRef(); @@ -155,7 +141,7 @@ void MEDLoaderTest::testFieldRW2() WriteFieldUsingAlreadyWrittenMesh(fileName,f1_int64); WriteFieldUsingAlreadyWrittenMesh(fileName,f1_fl); //retrieving time steps... - auto *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),8,9)); + MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),8,9)); f1->setTime(10.,8,9); tmp[0]=VAL1; CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); @@ -178,11 +164,11 @@ void MEDLoaderTest::testFieldRW2() CPPUNIT_ASSERT(f1_int->isEqual(f2_int,1e-12,0)); // exact equality for int values f2_int->decrRef(); f1_int->decrRef(); - auto *f2_int64=dynamic_cast<MEDCouplingFieldInt64 *>(ReadFieldCell(fileName,f1_int64->getMesh()->getName().c_str(),0,f1_int64->getName().c_str(),8,9)); + MEDCouplingFieldInt64 *f2_int64=dynamic_cast<MEDCouplingFieldInt64 *>(ReadFieldCell(fileName,f1_int64->getMesh()->getName().c_str(),0,f1_int64->getName().c_str(),8,9)); CPPUNIT_ASSERT(f1_int64->isEqual(f2_int64,1e-12,0)); // exact equality for int values f2_int64->decrRef(); f1_int64->decrRef(); - auto *f2_fl=dynamic_cast<MEDCouplingFieldFloat *>(ReadFieldCell(fileName,f1_fl->getMesh()->getName().c_str(),0,f1_fl->getName().c_str(),8,9)); + MEDCouplingFieldFloat *f2_fl=dynamic_cast<MEDCouplingFieldFloat *>(ReadFieldCell(fileName,f1_fl->getMesh()->getName().c_str(),0,f1_fl->getName().c_str(),8,9)); CPPUNIT_ASSERT(f1_fl->isEqual(f2_fl,1e-12,1e-07f)); // float comparison f2_fl->decrRef(); f1_fl->decrRef(); @@ -306,10 +292,10 @@ void MEDLoaderTest::testMultiMeshRW1() const char fileName[]="file10.med"; MEDCouplingUMesh *mesh1=build3DMesh_1(); const mcIdType part1[5]={1,2,4,13,15}; - auto *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); + MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); mesh2->setName("mesh2"); const mcIdType part2[4]={3,4,13,14}; - auto *mesh3=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part2,part2+4,true); + MEDCouplingUMesh *mesh3=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part2,part2+4,true); mesh3->setName("mesh3"); MEDCouplingUMesh *mesh4=MEDCouplingUMesh::New(); mesh4->setName("mesh4"); @@ -330,7 +316,7 @@ void MEDLoaderTest::testMultiMeshRW1() MEDCouplingUMesh *mesh5=ReadUMeshFromFile(fileName,mnane); mesh1->setName(mnane); const mcIdType part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}; - auto *mesh6=(MEDCouplingUMesh *)mesh5->buildPartOfMySelf(part3,part3+18,true); + MEDCouplingUMesh *mesh6=(MEDCouplingUMesh *)mesh5->buildPartOfMySelf(part3,part3+18,true); mesh6->setName(mnane); mesh5->decrRef(); CPPUNIT_ASSERT(mesh6->isEqual(mesh1,1e-12)); @@ -368,7 +354,7 @@ void MEDLoaderTest::testMultiMeshRW1() mesh2_2->decrRef(); // std::vector<std::string> ret(GetMeshFamiliesNamesOnGroup(fileName,"3DToto","3DMesh_1")); - std::set<std::string> const s(ret.begin(),ret.end()); + std::set<std::string> s(ret.begin(),ret.end()); std::set<std::string> ref_s; ref_s.insert("Family_-2"); ref_s.insert("Family_-3"); @@ -398,10 +384,10 @@ void MEDLoaderTest::testFieldProfilRW1() da->decrRef(); WriteUMesh(fileName,mesh1,true); const mcIdType part1[5]={1,2,4,13,15}; - auto *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); + MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); mesh2->setName(mesh1->getName().c_str());// <- important for the test // - mcIdType const nbOfCells=mesh2->getNumberOfCells(); + mcIdType nbOfCells=mesh2->getNumberOfCells(); CPPUNIT_ASSERT_EQUAL(ToIdType(5),nbOfCells); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); @@ -418,7 +404,7 @@ void MEDLoaderTest::testFieldProfilRW1() // WriteField(fileName,f1,false);// <- false important for the test // - auto *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7)); + MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7)); std::vector<MEDCoupling::TypeOfField> types=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)types.size()); CPPUNIT_ASSERT(types[0]==ON_CELLS); @@ -439,7 +425,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() const char fileName[]="file19.med"; const char fileName2[]="file20.med"; MEDCouplingUMesh *m=build2DMesh_1(); - mcIdType const nbOfNodes=m->getNumberOfNodes(); + mcIdType nbOfNodes=m->getNumberOfNodes(); WriteUMesh(fileName,m,true); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VFieldOnNodes"); @@ -459,7 +445,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() (const_cast<MEDCouplingMesh *>(f2->getMesh()))->setName(f1->getMesh()->getName().c_str()); WriteField(fileName,f2,false);// <- false important for the test // - auto *f3=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldNode(fileName,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7)); + MEDCouplingFieldDouble *f3=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldNode(fileName,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7)); f3->checkConsistencyLight(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); @@ -505,7 +491,7 @@ void MEDLoaderTest::testFieldNodeProfilRW2() f1->renumberNodes(renumArr); f1->checkConsistencyLight(); WriteField(fileName,f1,false);// <- false important for the test - auto *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7)); + MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7)); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); // f2->decrRef(); @@ -603,7 +589,7 @@ void MEDLoaderTest::testFieldShuffleRW1() const mcIdType renumber1[6]={2,1,5,0,3,4}; f1->renumberCells(renumber1,false); WriteField(fileName,f1,true); - auto *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7)); + MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7)); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); f2->decrRef(); // @@ -656,8 +642,8 @@ void MEDLoaderTest::testMultiFieldShuffleRW1() CPPUNIT_ASSERT(fs[2]->isEqual(f_3,1e-12,1e-12)); CPPUNIT_ASSERT(mm==fs[1]->getMesh());// <- important for the test CPPUNIT_ASSERT(mm==fs[2]->getMesh());// <- important for the test - for(auto & f : fs) - f->decrRef(); + for(std::vector<MEDCouplingFieldDouble *>::iterator iter=fs.begin();iter!=fs.end();iter++) + (*iter)->decrRef(); // f_1->decrRef(); f_2->decrRef(); @@ -674,7 +660,7 @@ void MEDLoaderTest::testWriteUMeshesRW1() const double vec[3]={0.,0.,1.}; std::vector<mcIdType> nodes; m3d->findNodesOnPlane(pt,vec,1e-12,nodes); - auto *m2d=(MEDCouplingUMesh *)m3d->buildFacePartOfMySelfNode(&nodes[0],&nodes[0]+nodes.size(),true); + MEDCouplingUMesh *m2d=(MEDCouplingUMesh *)m3d->buildFacePartOfMySelfNode(&nodes[0],&nodes[0]+nodes.size(),true); const mcIdType renumber[5]={1,2,0,4,3}; m2d->renumberCells(renumber,false); m2d->setName("ExampleOfMultiDimW"); @@ -704,7 +690,7 @@ void MEDLoaderTest::testWriteUMeshesRW1() f1->setTime(3.14,2,7); f1->checkConsistencyLight(); WriteFieldUsingAlreadyWrittenMesh(fileName,f1); - auto *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),-1,f1->getName().c_str(),2,7)); + MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),-1,f1->getName().c_str(),2,7)); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); f1->decrRef(); f2->decrRef(); @@ -769,7 +755,7 @@ void MEDLoaderTest::testMixCellAndNodesFieldRW1() CPPUNIT_ASSERT_EQUAL(ON_NODES,ts[0]); CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[1]); // - auto *f3=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7)); + MEDCouplingFieldDouble *f3=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7)); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); f3=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7)); @@ -822,7 +808,7 @@ void MEDLoaderTest::testMEDLoaderRead1() using namespace std; using namespace INTERP_KERNEL; - string const fileName= INTERP_TEST::getResourceFile("pointe.med", 3); + string fileName= INTERP_TEST::getResourceFile("pointe.med", 3); vector<string> meshNames=GetMeshNames(fileName.c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size()); MEDCouplingUMesh *mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0); @@ -900,7 +886,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(-1,its1[0].first); CPPUNIT_ASSERT_EQUAL(-1,its1[0].second); // - auto *field0=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second)); + MEDCouplingFieldDouble *field0=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second)); field0->checkConsistencyLight(); CPPUNIT_ASSERT(field0->getName()==fieldsName[0]); CPPUNIT_ASSERT_EQUAL(1,(int)field0->getNumberOfComponents()); @@ -910,7 +896,7 @@ void MEDLoaderTest::testMEDLoaderRead1() std::transform(field0->getArray()->getPointer(),field0->getArray()->getPointer()+16,expectedValues,diffValue,std::minus<double>()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue,diffValue+16),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue,diffValue+16),1e-12); - const auto *constMesh=dynamic_cast<const MEDCouplingUMesh *>(field0->getMesh()); + const MEDCouplingUMesh *constMesh=dynamic_cast<const MEDCouplingUMesh *>(field0->getMesh()); CPPUNIT_ASSERT(constMesh); CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension()); @@ -929,7 +915,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); field0->decrRef(); // - auto *field1=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[1].c_str(),its1[0].first,its1[0].second)); + MEDCouplingFieldDouble *field1=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[1].c_str(),its1[0].first,its1[0].second)); field1->checkConsistencyLight(); CPPUNIT_ASSERT(field1->getName()==fieldsName[1]); CPPUNIT_ASSERT_EQUAL(3,(int)field1->getNumberOfComponents()); @@ -970,7 +956,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(-1,its0Node[1].second); CPPUNIT_ASSERT_EQUAL(2,its0Node[2].first); CPPUNIT_ASSERT_EQUAL(-1,its0Node[2].second); - auto *field0Nodes=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second)); + MEDCouplingFieldDouble *field0Nodes=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second)); field0Nodes->checkConsistencyLight(); CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]); CPPUNIT_ASSERT_EQUAL(1,(int)field0Nodes->getNumberOfComponents()); @@ -1046,7 +1032,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() using namespace std; using namespace INTERP_KERNEL; - string const fileName=INTERP_TEST::getResourceFile("polygones.med", 3); + string fileName=INTERP_TEST::getResourceFile("polygones.med", 3); vector<string> meshNames=GetMeshNames(fileName.c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size()); CPPUNIT_ASSERT(meshNames[0]=="Bord"); @@ -1079,12 +1065,12 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() CPPUNIT_ASSERT(fieldsName[2]=="bord_:_non-ortho"); std::vector<std::pair<int,int> > its0=GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)its0.size()); - auto *field=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second)); + MEDCouplingFieldDouble *field=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second)); field->checkConsistencyLight(); CPPUNIT_ASSERT(field->getName()==fieldsName[0]); CPPUNIT_ASSERT_EQUAL(1,(int)field->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(538,(int)field->getNumberOfTuples()); - const auto *constMesh=dynamic_cast<const MEDCouplingUMesh *>(field->getMesh()); + const MEDCouplingUMesh *constMesh=dynamic_cast<const MEDCouplingUMesh *>(field->getMesh()); CPPUNIT_ASSERT(constMesh); CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,constMesh->getMeshDimension()); @@ -1112,7 +1098,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() using namespace std; using namespace INTERP_KERNEL; - string const fileName=INTERP_TEST::getResourceFile("poly3D.med", 3); + string fileName=INTERP_TEST::getResourceFile("poly3D.med", 3); vector<string> meshNames=GetMeshNames(fileName.c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size()); CPPUNIT_ASSERT(meshNames[0]=="poly3D"); @@ -1387,11 +1373,11 @@ MEDCouplingUMesh *MEDLoaderTest::build3DMesh_2() { MEDCouplingUMesh *m3dsurfBase=build3DSurfMesh_1(); mcIdType numbers[5]={0,1,2,3,5}; - auto *m3dsurf=(MEDCouplingUMesh *)m3dsurfBase->buildPartOfMySelf(numbers,numbers+5,false); + MEDCouplingUMesh *m3dsurf=(MEDCouplingUMesh *)m3dsurfBase->buildPartOfMySelf(numbers,numbers+5,false); m3dsurfBase->decrRef(); MEDCouplingUMesh *m1dBase=build1DMesh_1(); mcIdType numbers2[4]={0,1,2,3}; - auto *m1d=(MEDCouplingUMesh *)m1dBase->buildPartOfMySelf(numbers2,numbers2+4,false); + MEDCouplingUMesh *m1d=(MEDCouplingUMesh *)m1dBase->buildPartOfMySelf(numbers2,numbers2+4,false); m1dBase->decrRef(); m1d->changeSpaceDimension(3); const double vec[3]={0.,1.,0.}; @@ -1406,7 +1392,7 @@ MEDCouplingUMesh *MEDLoaderTest::build3DMesh_2() MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - mcIdType const nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); f1->setMesh(mesh); @@ -1429,7 +1415,7 @@ MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1() MEDCouplingFieldInt *MEDLoaderTest::buildIntVecFieldOnCells_1() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - mcIdType const nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldInt *f1=MEDCouplingFieldInt::New(ON_CELLS,ONE_TIME); f1->setName("IntVectorFieldOnCells"); f1->setMesh(mesh); @@ -1452,7 +1438,7 @@ MEDCouplingFieldInt *MEDLoaderTest::buildIntVecFieldOnCells_1() MEDCouplingFieldInt64 *MEDLoaderTest::buildInt64VecFieldOnCells_1() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - mcIdType const nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldInt64 *f1=MEDCouplingFieldInt64::New(ON_CELLS,ONE_TIME); f1->setName("Int64VectorFieldOnCells"); f1->setMesh(mesh); @@ -1475,7 +1461,7 @@ MEDCouplingFieldInt64 *MEDLoaderTest::buildInt64VecFieldOnCells_1() MEDCouplingFieldFloat *MEDLoaderTest::buildFloatVecFieldOnCells_1() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - mcIdType const nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldFloat *f1=MEDCouplingFieldFloat::New(ON_CELLS,ONE_TIME); f1->setName("FloatVectorFieldOnCells"); f1->setMesh(mesh); @@ -1499,7 +1485,7 @@ MEDCouplingFieldFloat *MEDLoaderTest::buildFloatVecFieldOnCells_1() MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnNodes_1() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - mcIdType const nbOfNodes=mesh->getNumberOfNodes(); + mcIdType nbOfNodes=mesh->getNumberOfNodes(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VectorFieldOnNodes"); f1->setMesh(mesh); @@ -1532,7 +1518,7 @@ MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnGauss_1() const double gsCoo1[12]={ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b, 2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 }; const double wg1[6]={ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 }; - std::vector<double> const _refCoo1(refCoo1,refCoo1+6); + std::vector<double> _refCoo1(refCoo1,refCoo1+6); std::vector<double> _gsCoo1(gsCoo1,gsCoo1+12); std::vector<double> _wg1(wg1,wg1+6); MEDCouplingUMesh *m=build2DMesh_2(); @@ -1541,12 +1527,12 @@ MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnGauss_1() f->setMesh(m); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1); const double refCoo2[12]={-1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 }; - std::vector<double> const _refCoo2(refCoo2,refCoo2+12); + std::vector<double> _refCoo2(refCoo2,refCoo2+12); std::vector<double> _gsCoo2(_gsCoo1); std::vector<double> _wg2(_wg1); _gsCoo2.resize(6); _wg2.resize(3); const double refCoo3[8]={ 0.,0., 1.,0., 1.,1., 0.,1. }; - std::vector<double> const _refCoo3(refCoo3,refCoo3+8); + std::vector<double> _refCoo3(refCoo3,refCoo3+8); _gsCoo1.resize(4); _wg1.resize(2); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo3,_gsCoo1,_wg1); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI6,_refCoo2,_gsCoo2,_wg2); diff --git a/src/MEDLoader/Test/MEDLoaderTest.hxx b/src/MEDLoader/Test/MEDLoaderTest.hxx index d059df3c5..dc3332af2 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.hxx +++ b/src/MEDLoader/Test/MEDLoaderTest.hxx @@ -22,8 +22,6 @@ #define __MEDLOADERTEST_HXX__ #include "MEDCouplingFieldInt.hxx" // this one can not use a class forward -#include <cppunit/TestFixture.h> -#include "MEDCouplingTraits.hxx" #include <cppunit/extensions/HelperMacros.h> namespace MEDCoupling diff --git a/src/MEDLoader/Test/SauvLoaderTest.cxx b/src/MEDLoader/Test/SauvLoaderTest.cxx index a79107242..408f26994 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.cxx +++ b/src/MEDLoader/Test/SauvLoaderTest.cxx @@ -19,30 +19,12 @@ #include "SauvLoaderTest.hxx" -#include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingUMesh.hxx" -#include "NormalizedGeometricTypes" -#include "MEDFileMesh.hxx" -#include "MEDFileField.hxx" -#include "MEDFileFieldMultiTS.hxx" -#include "MEDCouplingMesh.hxx" #include "SauvReader.hxx" #include "SauvWriter.hxx" #include "MEDFileData.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "TestInterpKernelUtils.hxx" // getResourceFile() -#include <algorithm> -#include <cppunit/TestAssert.h> -#include <iostream> -#include <cstddef> -#include <map> -#include <stdio.h> -#include <vector> -#include <utility> #ifdef WIN32 #include <windows.h> @@ -50,6 +32,7 @@ # include <unistd.h> #endif +#include <vector> #include <string> using namespace MEDCoupling; @@ -57,7 +40,7 @@ using namespace MEDCoupling; void SauvLoaderTest::testSauv2Med() { // read a file containing all types of readable piles - std::string const file = INTERP_TEST::getResourceFile("allPillesTest.sauv", 3); + std::string file = INTERP_TEST::getResourceFile("allPillesTest.sauv", 3); MCAuto<SauvReader> sr=SauvReader::New(file.c_str()); MCAuto<MEDFileData> d2=sr->loadInMEDFileDS(); // write MED @@ -130,7 +113,7 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily() // read SAUV and check groups MCAuto<SauvReader> sr=SauvReader::New(sauvFile); MCAuto<MEDFileData> d2=sr->loadInMEDFileDS(); - auto* m2 = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) ); + MEDFileUMesh* m2 = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) ); MCAuto<MEDCouplingUMesh> group1 = m2->getGroup(0, "Group1"); CPPUNIT_ASSERT_EQUAL(1,(int)group1->getNumberOfCells()); MCAuto<MEDCouplingUMesh> group2 = m2->getGroup(0, "Group2"); @@ -142,13 +125,13 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily() void SauvLoaderTest::testSauv2MedOnA3SubsField() { // read SAUV - std::string const sauvFile = INTERP_TEST::getResourceFile("portico_3subs.sauv", 3); + std::string sauvFile = INTERP_TEST::getResourceFile("portico_3subs.sauv", 3); MCAuto<SauvReader> sr=SauvReader::New(sauvFile.c_str()); MCAuto<MEDFileData> d2=sr->loadInMEDFileDS(); // check mesh - auto* m2 = static_cast<MEDFileUMesh*>(d2->getMeshes()->getMeshAtPos(0)); + MEDFileUMesh* m2 = static_cast<MEDFileUMesh*>(d2->getMeshes()->getMeshAtPos(0)); MCAuto<MEDCouplingUMesh> mesh1d = m2->getMeshAtLevel(0); - MCAuto<MEDCouplingFieldDouble> length1dField = mesh1d->getMeasureField(false); + MCAuto<MEDCouplingFieldDouble> length1dField = mesh1d->getMeasureField(0); std::cout << "Length of 1d elements: " << length1dField->accumulate(0) << std::endl; CPPUNIT_ASSERT_DOUBLES_EQUAL(3, length1dField->accumulate(0), 1e-12); // check field @@ -163,7 +146,7 @@ void SauvLoaderTest::testSauv2MedOnA3SubsField() // Check first component of the field // 2 gauss points per element => 12 values - double const values[12] = { + double values[12] = { -7.687500000000e-03, -7.687500000000e-03, -4.562500000000e-03, @@ -186,11 +169,11 @@ void SauvLoaderTest::testSauv2MedOnA3SubsField() void SauvLoaderTest::testMed2Sauv() { // read pointe.med - std::string const file = INTERP_TEST::getResourceFile("pointe.med", 3); + std::string file = INTERP_TEST::getResourceFile("pointe.med", 3); MCAuto<MEDFileData> pointeMed=MEDFileData::New(file.c_str()); // add 3 faces to pointeMed - auto* pointeMedMesh = static_cast<MEDFileUMesh*>(pointeMed->getMeshes()->getMeshAtPos(0)); + MEDFileUMesh* pointeMedMesh = static_cast<MEDFileUMesh*>(pointeMed->getMeshes()->getMeshAtPos(0)); MCAuto<MEDCouplingUMesh> pointeM1D = MEDCouplingUMesh::New(); DataArrayDouble *coords = pointeMedMesh->getCoords(); pointeM1D->setCoords( coords ); @@ -255,7 +238,7 @@ void SauvLoaderTest::testMed2Sauv() MCAuto<MEDFileData> d2=sr->loadInMEDFileDS(); CPPUNIT_ASSERT_EQUAL(1,d2->getNumberOfMeshes()); CPPUNIT_ASSERT_EQUAL(4,d2->getNumberOfFields()); - auto * m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) ); + MEDFileUMesh * m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) ); CPPUNIT_ASSERT_EQUAL(std::string("maa1"),std::string(m->getName() )); CPPUNIT_ASSERT_EQUAL(3,m->getMeshDimension()); std::vector<std::string > groups = m->getGroupsNames(); @@ -279,8 +262,8 @@ void SauvLoaderTest::testMed2Sauv() DataArrayDouble *coo = m->getCoords(); DataArrayDouble *pointeCoo = pointeMedMesh->getCoords(); CPPUNIT_ASSERT(coo->isEqualWithoutConsideringStr(*pointeCoo,1e-12)); - MCAuto<MEDCouplingFieldDouble> vol = um0->getMeasureField(false); - MCAuto<MEDCouplingFieldDouble> pointeVol = pointeUM0->getMeasureField(false); + MCAuto<MEDCouplingFieldDouble> vol = um0->getMeasureField(0); + MCAuto<MEDCouplingFieldDouble> pointeVol = pointeUM0->getMeasureField(0); CPPUNIT_ASSERT_DOUBLES_EQUAL( vol->accumulate(0), pointeVol->accumulate(0),1e-12); // check fields // fieldnodedouble @@ -335,7 +318,7 @@ void SauvLoaderTest::testMed2Sauv() void SauvLoaderTest::testCellsWithLingNames() { // test IMP 3285: [CEA 1778] SauvReader: only keep the meshes named in the table MED_MAIL - std::string const file = INTERP_TEST::getResourceFile("test_MED_MAIL.sauv", 3); + std::string file = INTERP_TEST::getResourceFile("test_MED_MAIL.sauv", 3); MCAuto<SauvReader> sr=SauvReader::New(file.c_str()); MCAuto<MEDFileData> d2=sr->loadInMEDFileDS(); // check that the mesh contains @@ -344,7 +327,7 @@ void SauvLoaderTest::testCellsWithLingNames() // - Nombre de mailles de type MED_QUAD4 : 43 // - Nombre de mailles de type MED_HEXA8 : 24 // - Nombre de mailles de type MED_PENTA6 : 3 - auto* m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0)); + MEDFileUMesh* m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0)); CPPUNIT_ASSERT_EQUAL(ToIdType(6), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 )); CPPUNIT_ASSERT_EQUAL(ToIdType(43), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_QUAD4 )); CPPUNIT_ASSERT_EQUAL(ToIdType(24), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 )); @@ -359,17 +342,17 @@ void SauvLoaderTest::tearDown() #else const char* fileToRemove[nbFilesToRemove] = { "allPillesTest.med", "pointe.sauv", "mesh_with_void_family.sauv" }; #endif - for (auto & i : fileToRemove) + for ( int i = 0; i < nbFilesToRemove; ++i ) { #ifdef WIN32 if (GetFileAttributes(fileToRemove[i]) != INVALID_FILE_ATTRIBUTES) #else - if (access(i, F_OK) == 0) + if (access(fileToRemove[i], F_OK) == 0) #endif #if defined(WIN32) && defined(UNICODE) _wremove(fileToRemove[i]); #else - remove(i); + remove(fileToRemove[i]); #endif } } diff --git a/src/MEDLoader/Test/SauvLoaderTest.hxx b/src/MEDLoader/Test/SauvLoaderTest.hxx index 27147aa92..799445d57 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.hxx +++ b/src/MEDLoader/Test/SauvLoaderTest.hxx @@ -20,9 +20,9 @@ #ifndef __SauvLoaderTest_HXX__ #define __SauvLoaderTest_HXX__ -#include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> +#include "MEDLoaderTest.hxx" namespace MEDCoupling { @@ -43,7 +43,7 @@ namespace MEDCoupling void testCellsWithLingNames(); public: - void tearDown() override; + void tearDown(); }; } diff --git a/src/MEDLoader/Test/TestMEDLoader.cxx b/src/MEDLoader/Test/TestMEDLoader.cxx index 73a391128..9e73982d1 100644 --- a/src/MEDLoader/Test/TestMEDLoader.cxx +++ b/src/MEDLoader/Test/TestMEDLoader.cxx @@ -18,9 +18,9 @@ // // Author : Anthony Geay (CEA/DEN) +#include "CppUnitTest.hxx" #include "MEDLoaderTest.hxx" #include "CrackAlgoTest.hxx" -#include <cppunit/extensions/HelperMacros.h> CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::MEDLoaderTest ); CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::CrackAlgoTest ); diff --git a/src/MEDLoader/Test/TestSauvLoader.cxx b/src/MEDLoader/Test/TestSauvLoader.cxx index 6f6e7d1dd..d2c8d4d68 100644 --- a/src/MEDLoader/Test/TestSauvLoader.cxx +++ b/src/MEDLoader/Test/TestSauvLoader.cxx @@ -17,8 +17,9 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#include "CppUnitTest.hxx" #include "SauvLoaderTest.hxx" -#include <cppunit/extensions/HelperMacros.h> CPPUNIT_TEST_SUITE_REGISTRATION( MEDCoupling::SauvLoaderTest ); +#include "BasicMainTest.hxx" diff --git a/src/MEDLoader/libmesh5.hxx b/src/MEDLoader/libmesh5.hxx index f1e6da8b3..f1d755390 100644 --- a/src/MEDLoader/libmesh5.hxx +++ b/src/MEDLoader/libmesh5.hxx @@ -52,7 +52,6 @@ // see MeshGems/Docs/meshgems_formats_description.pdf extern const char* GmfKwdFmt[ GmfMaxKwd + 1 ][4]; // occ/24009 -#include <cstdio> #include "MEDLoaderDefines.hxx" /*----------------------------------------------------------*/ /* Structures */ diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx index 0bc2be98c..9970753be 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx @@ -19,14 +19,9 @@ #include "MEDPARTITIONER_ConnectZone.hxx" -#include "MCIdType.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" #include "MEDCouplingSkyLineArray.hxx" #include <map> -#include <utility> -#include <vector> using namespace MEDCoupling; @@ -35,18 +30,18 @@ MEDPARTITIONER::ConnectZone::ConnectZone(): ,_description("") ,_local_domain_number(0) ,_distant_domain_number(0) - ,_local_mesh(nullptr) - ,_distant_mesh(nullptr) - ,_node_corresp(nullptr) - ,_face_corresp(nullptr) + ,_local_mesh(0) + ,_distant_mesh(0) + ,_node_corresp(0) + ,_face_corresp(0) { } MEDPARTITIONER::ConnectZone::~ConnectZone() { - for(auto & iter : _entity_corresp) + for(std::map < std::pair <mcIdType, mcIdType>,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++) { - iter.second->decrRef(); + iter->second->decrRef(); } } @@ -55,8 +50,8 @@ MEDPARTITIONER::ConnectZone::ConnectZone(const ConnectZone & myConnectZone): ,_description(myConnectZone._description) ,_local_domain_number(myConnectZone._local_domain_number) ,_distant_domain_number(myConnectZone._distant_domain_number) - ,_local_mesh(nullptr) - ,_distant_mesh(nullptr) + ,_local_mesh(0) + ,_distant_mesh(0) ,_node_corresp(myConnectZone._node_corresp) ,_face_corresp(myConnectZone._face_corresp) ,_entity_corresp(myConnectZone._entity_corresp) @@ -96,9 +91,9 @@ MEDCouplingUMesh *MEDPARTITIONER::ConnectZone::getDistantMesh() const bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(mcIdType localEntity, mcIdType distantEntity) const { typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter; - for(const auto & iter : _entity_corresp) + for(map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++) { - if ((iter.first).first==localEntity && (iter.first).second==distantEntity) + if ((iter->first).first==localEntity && (iter->first).second==distantEntity) return true; } return false; @@ -149,12 +144,12 @@ const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(mcIdType loca { typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter; - for(const auto & iter : _entity_corresp) + for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++) { - if ((iter.first).first==localEntity && (iter.first).second==distantEntity) - return iter.second->getIndex(); + if ((iter->first).first==localEntity && (iter->first).second==distantEntity) + return iter->second->getIndex(); } - return nullptr; + return 0; } const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(mcIdType localEntity, @@ -162,12 +157,12 @@ const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(mcIdType loca { typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter; - for (const auto & iter : _entity_corresp) + for (map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++) { - if ((iter.first).first==localEntity && (iter.first).second==distantEntity) - return iter.second->getValues(); + if ((iter->first).first==localEntity && (iter->first).second==distantEntity) + return iter->second->getValues(); } - return nullptr; + return 0; } mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(mcIdType localEntity, @@ -175,10 +170,10 @@ mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(mcIdType localEntit { typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter; - for(const auto & iter : _entity_corresp) + for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++) { - if((iter.first).first==localEntity && (iter.first).second==distantEntity) - return iter.second->getNumberOf(); + if((iter->first).first==localEntity && (iter->first).second==distantEntity) + return iter->second->getNumberOf(); } return 0; } @@ -188,10 +183,10 @@ mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(mcIdType localEntit { typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter; - for (const auto & iter : _entity_corresp) + for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++) { - if ((iter.first).first==localEntity && (iter.first).second==distantEntity) - return iter.second->getLength(); + if ((iter->first).first==localEntity && (iter->first).second==distantEntity) + return iter->second->getLength(); } return 0; } @@ -201,19 +196,19 @@ MEDPARTITIONER::ConnectZone::getEntityCorresp(mcIdType localEntity, mcIdType dis { typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter; - for (const auto & iter : _entity_corresp) + for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++) { - if ((iter.first).first==localEntity && (iter.first).second==distantEntity) - return iter.second; + if ((iter->first).first==localEntity && (iter->first).second==distantEntity) + return iter->second; } - return nullptr; + return 0; } std::vector< std::pair< mcIdType,mcIdType > > MEDPARTITIONER::ConnectZone::getEntities() const { std::vector< std::pair< mcIdType,mcIdType > > types; - auto + std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator iter = _entity_corresp.begin(); for ( ; iter != _entity_corresp.end(); iter++) { @@ -277,7 +272,7 @@ void MEDPARTITIONER::ConnectZone::setNodeCorresp(const mcIdType * nodeCorresp, m void MEDPARTITIONER::ConnectZone::setNodeCorresp(MEDCouplingSkyLineArray* array) { - MCAuto<MEDCouplingSkyLineArray> const arr(array); + MCAuto<MEDCouplingSkyLineArray> arr(array); _node_corresp = arr; } @@ -305,7 +300,7 @@ void MEDPARTITIONER::ConnectZone::setFaceCorresp(const mcIdType * faceCorresp, m void MEDPARTITIONER::ConnectZone::setFaceCorresp(MEDCouplingSkyLineArray* array) { - MCAuto<MEDCouplingSkyLineArray> const arr (array); + MCAuto<MEDCouplingSkyLineArray> arr (array); _face_corresp = arr; } @@ -337,7 +332,7 @@ void MEDPARTITIONER::ConnectZone::setEntityCorresp(mcIdType localEntity, mcIdTyp void MEDPARTITIONER::ConnectZone::setEntityCorresp(mcIdType localEntity, mcIdType distantEntity, MEDCouplingSkyLineArray *array) { - MEDCouplingSkyLineArray * nullArray = nullptr; + MEDCouplingSkyLineArray * nullArray = 0; std::map < std::pair <mcIdType,mcIdType>, MEDCouplingSkyLineArray * >::iterator it; it = _entity_corresp.insert ( std::make_pair( std::make_pair(localEntity,distantEntity), nullArray )).first; diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx index 9128c22ba..ef4eec328 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx @@ -20,10 +20,9 @@ #ifndef __MEDPARTITIONER_CONNECTZONE_HXX__ #define __MEDPARTITIONER_CONNECTZONE_HXX__ -#include "MCIdType.hxx" #include "MEDPARTITIONER.hxx" #include "MCAuto.hxx" -#include <utility> +#include "MCType.hxx" namespace MEDCoupling { diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx index 29ba8e788..652ba4f87 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx @@ -19,8 +19,6 @@ #include "MEDPARTITIONER_Graph.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MEDCouplingSkyLineArray.hxx" #include <set> @@ -28,19 +26,20 @@ namespace MEDPARTITIONER { Graph::Graph(): - _graph(nullptr),_partition(nullptr), - _edge_weight(nullptr),_cell_weight(nullptr) + _graph(0),_partition(0), + _edge_weight(0),_cell_weight(0) { } Graph::Graph(MEDCoupling::MEDCouplingSkyLineArray *array, int *edgeweight): - _graph(array),_partition(nullptr), - _edge_weight(edgeweight),_cell_weight(nullptr) + _graph(array),_partition(0), + _edge_weight(edgeweight),_cell_weight(0) { } Graph::~Graph() - = default; + { + } int Graph::nbDomains() const { @@ -48,8 +47,8 @@ namespace MEDPARTITIONER if ( _partition.isNotNull() ) if ( MEDCoupling::DataArrayIdType* array = _partition->getValuesArray() ) { - for (long const dom : *array) - domains.insert( dom ); + for ( const mcIdType * dom = array->begin(); dom != array->end(); ++dom ) + domains.insert( *dom ); } return (int)domains.size(); } diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx index 2beab244b..bd799a3b4 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx @@ -20,9 +20,9 @@ #ifndef __MEDPARTITIONER_GRAPH_HXX__ #define __MEDPARTITIONER_GRAPH_HXX__ -#include "MCIdType.hxx" #include "MEDPARTITIONER.hxx" #include "MCAuto.hxx" +#include "MCType.hxx" #include <string> @@ -39,18 +39,18 @@ namespace MEDPARTITIONER class MEDPARTITIONER_EXPORT Graph { public: - using splitter_type = enum {METIS,SCOTCH,PTSCOTCH}; + typedef enum {METIS,SCOTCH,PTSCOTCH} splitter_type; Graph(); //creates a graph from a SKYLINEARRAY- WARNING!! Graph takes ownership of the array. - Graph(MEDCouplingSkyLineArray* graph, int* edgeweight=nullptr); + Graph(MEDCouplingSkyLineArray* graph, int* edgeweight=0); virtual ~Graph(); void setEdgesWeights(int *edgeweight) { _edge_weight=edgeweight; } void setVerticesWeights(int *cellweight) { _cell_weight=cellweight; } //computes partitioning of the graph - virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=nullptr) = 0; + virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) = 0; //returns the partitioning const mcIdType *getPart() const; diff --git a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx index 6e1861f9c..229592f98 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx @@ -18,22 +18,13 @@ // #include "MEDPARTITIONER_JointFinder.hxx" - -#include <algorithm> -#include <cstddef> -#include <iostream> -#include <utility> -#include <map> -#include <vector> - -#include "MCType.hxx" -#include "MCIdType.hxx" #include "MEDPARTITIONER_MeshCollection.hxx" #include "MEDPARTITIONER_Topology.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" #include "MEDPARTITIONER_Utils.hxx" #include "MEDCouplingUMesh.hxx" +#include "BBTree.txx" /*! * Method contributing to the distant cell graph @@ -43,11 +34,12 @@ MEDPARTITIONER::JointFinder::JointFinder(const MeshCollection& mc):_mesh_collect } MEDPARTITIONER::JointFinder::~JointFinder() -= default; +{ +} void MEDPARTITIONER::JointFinder::findCommonDistantNodes() { - int const nbdomain=_topology->nbDomain(); + int nbdomain=_topology->nbDomain(); _distant_node_cell.resize(nbdomain); _node_node.resize(nbdomain); for (int i=0; i<nbdomain; i++) @@ -55,11 +47,11 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() _distant_node_cell[i].resize(nbdomain); _node_node[i].resize(nbdomain); } - int const nbproc=_domain_selector->nbProcs(); - std::vector<BBTreeOfDim* > bbtree(nbdomain,(BBTreeOfDim*) nullptr); - std::vector<double* > bbxi(nbdomain,(double*) nullptr); - std::vector<MEDCoupling::DataArrayIdType*> rev(nbdomain,(MEDCoupling::DataArrayIdType*) nullptr); - std::vector<MEDCoupling::DataArrayIdType*> revIndx(nbdomain,(MEDCoupling::DataArrayIdType*) nullptr); + int nbproc=_domain_selector->nbProcs(); + std::vector<BBTreeOfDim* > bbtree(nbdomain,(BBTreeOfDim*) 0); + std::vector<double* > bbxi(nbdomain,(double*) 0); + std::vector<MEDCoupling::DataArrayIdType*> rev(nbdomain,(MEDCoupling::DataArrayIdType*) 0); + std::vector<MEDCoupling::DataArrayIdType*> revIndx(nbdomain,(MEDCoupling::DataArrayIdType*) 0); //int meshDim=-1; int spaceDim=-1; @@ -74,14 +66,14 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() rev[mydomain] = MEDCoupling::DataArrayIdType::New(); revIndx[mydomain] = MEDCoupling::DataArrayIdType::New(); myMesh->getReverseNodalConnectivity(rev[mydomain],revIndx[mydomain]); - auto* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()]; + double* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()]; for (int i=0; i<myMesh->getNumberOfNodes()*spaceDim; i++) { const double* coords=myMesh->getCoords()->getConstPointer(); bbx[2*i]=(coords[i])-1e-12; bbx[2*i+1]=bbx[2*i]+2e-12; } - bbtree[mydomain]=new BBTreeOfDim( spaceDim, bbx,nullptr,0,myMesh->getNumberOfNodes(),-1e-12); + bbtree[mydomain]=new BBTreeOfDim( spaceDim, bbx,0,0,myMesh->getNumberOfNodes(),-1e-12); //keep bbx because need it in getIntersectingElems //no delete [] bbx yet bbxi[mydomain]=bbx; @@ -98,7 +90,7 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() if (_domain_selector->isMyDomain(isource)) { //preparing data for treatment on target proc - int const targetProc = _domain_selector->getProcessorID(itarget); + int targetProc = _domain_selector->getProcessorID(itarget); std::vector<double> vec(spaceDim*sourceMesh->getNumberOfNodes()); std::copy(sourceMesh->getCoords()->getConstPointer(),sourceMesh->getCoords()->getConstPointer()+sourceMesh->getNumberOfNodes()*spaceDim,&vec[0]); @@ -117,13 +109,13 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() if (_domain_selector->isMyDomain(itarget)) { //receiving data from source proc - int const sourceProc = isource%nbproc; + int sourceProc = isource%nbproc; std::vector<double> recvVec; RecvDoubleVec(recvVec,sourceProc); std::map<mcIdType,mcIdType> commonNodes; // (local nodes, distant nodes) list for (mcIdType inode=0; inode<ToIdType(recvVec.size()/spaceDim); inode++) { - auto* bbox=new double[2*spaceDim]; + double* bbox=new double[2*spaceDim]; for (int i=0; i<spaceDim; i++) { bbox[2*i]=recvVec[inode*spaceDim+i]-1e-12; @@ -140,15 +132,15 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() } std::vector<mcIdType> nodeCellCorrespondency; - for (auto & commonNode : commonNodes) + for (std::map<mcIdType,mcIdType>::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++) { - _node_node[itarget][isource].push_back(std::make_pair(commonNode.first, commonNode.second));//storing node pairs in a vector + _node_node[itarget][isource].push_back(std::make_pair(iter->first, iter->second));//storing node pairs in a vector const mcIdType* revIndxPtr=revIndx[itarget]->getConstPointer(); const mcIdType* revPtr=rev[itarget]->getConstPointer(); - for (mcIdType icell=revIndxPtr[commonNode.first]; icell<revIndxPtr[commonNode.first+1]; icell++) + for (mcIdType icell=revIndxPtr[iter->first]; icell<revIndxPtr[iter->first+1]; icell++) { - nodeCellCorrespondency.push_back(commonNode.second); // - mcIdType const globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]); + nodeCellCorrespondency.push_back(iter->second); // + mcIdType globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]); nodeCellCorrespondency.push_back(globalCell); } } @@ -160,13 +152,13 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() //free rev(nbdomain) revIndx(nbdomain) bbtree(nbdomain) bbxi(nbdomain) for (int i=0; i<nbdomain; i++) { - if (rev[i]!=nullptr) + if (rev[i]!=0) rev[i]->decrRef(); - if (revIndx[i]!=nullptr) + if (revIndx[i]!=0) revIndx[i]->decrRef(); - if (bbtree[i]!=nullptr) + if (bbtree[i]!=0) delete bbtree[i]; - if (bbxi[i]!=nullptr) + if (bbxi[i]!=0) delete [] bbxi[i]; } @@ -187,7 +179,7 @@ std::vector<std::vector<std::vector<std::pair<mcIdType,mcIdType> > > >& MEDPARTI void MEDPARTITIONER::JointFinder::print() //it is for debug on small arrays under mpi 2,3 cpus { - int const nbdomain=_topology->nbDomain(); + int nbdomain=_topology->nbDomain(); //MPI_Barrier(MPI_COMM_WORLD); if (MyGlobals::_Is0verbose>0) std::cout << "\nJointFinder print node-node (nn)iproc|itarget|isource|i|inodefirst-inodesecond\n\n" << diff --git a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx index 898813946..79c0d2d0d 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx @@ -20,11 +20,10 @@ #ifndef __MEDPARTITIONER_JOINTFINDER_HXX__ #define __MEDPARTITIONER_JOINTFINDER_HXX__ -#include "MCIdType.hxx" #include "MEDPARTITIONER.hxx" +#include "MCType.hxx" #include <map> -#include <utility> #include <vector> namespace MEDPARTITIONER diff --git a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx index 829fffa00..cf75ce812 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx @@ -18,15 +18,12 @@ // #include "MEDPARTITIONER_MEDPartitioner.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" #include "MEDPARTITIONER_MeshCollection.hxx" #include "MEDPARTITIONER_Topology.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" #include "MEDPARTITIONER_ParallelTopology.hxx" #include "MEDPARTITIONER_Utils.hxx" #include "MEDPARTITIONER_Graph.hxx" -#include <string> #ifdef MED_ENABLE_METIS # include "MEDPARTITIONER_MetisGraph.hxx" #endif @@ -41,6 +38,7 @@ #include "MEDCouplingUMesh.hxx" #include "MEDCouplingSkyLineArray.hxx" +#include <iostream> #include <vector> const char MEDPARTITIONER::MEDPartitioner::METIS_PART_ALG[]="Metis"; @@ -48,7 +46,7 @@ const char MEDPARTITIONER::MEDPartitioner::SCOTCH_PART_ALG[]="Scotch"; const char MEDPARTITIONER::MEDPartitioner::PTSCOTCH_PART_ALG[]="PTScotch"; MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const std::string& filename, int ndomains, const std::string& library,bool create_boundary_faces, bool create_joints, bool mesure_memory): - _input_collection( nullptr ), _output_collection( nullptr ), _new_topology( nullptr ) + _input_collection( 0 ), _output_collection( 0 ), _new_topology( 0 ) { MyGlobals::_World_Size = 1; MyGlobals::_Rank = 0; @@ -59,7 +57,7 @@ MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const std::string& filename, int _input_collection=new MeshCollection(filename,parallelizer); _input_collection->setParaDomainSelector( ¶llelizer ); - auto* aPT = + MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) _input_collection->getTopology(); aPT->setGlobalNumerotationDefault( _input_collection->getParaDomainSelector() ); _input_collection->prepareFieldDescriptions(); @@ -69,7 +67,7 @@ MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const std::string& filename, int } MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const MEDCoupling::MEDFileData* filedata, int ndomains, const std::string& library,bool create_boundary_faces, bool create_joints, bool mesure_memory): - _input_collection( nullptr ), _output_collection( nullptr ), _new_topology( nullptr ) + _input_collection( 0 ), _output_collection( 0 ), _new_topology( 0 ) { MyGlobals::_World_Size = 1; MyGlobals::_Rank = 0; @@ -81,7 +79,7 @@ MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const MEDCoupling::MEDFileData* f _input_collection->setParaDomainSelector( ¶llelizer ); _input_collection->retrieveDriver()->readMEDFileData(filedata); - auto* aPT = + MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) _input_collection->getTopology(); aPT->setGlobalNumerotationDefault( _input_collection->getParaDomainSelector() ); _input_collection->prepareFieldDescriptions(); @@ -91,7 +89,7 @@ MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const MEDCoupling::MEDFileData* f } MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const MEDCoupling::MEDFileData* filedata, MEDPARTITIONER ::Graph* graph, bool create_boundary_faces, bool create_joints, bool mesure_memory): - _input_collection( nullptr ), _output_collection( nullptr ), _new_topology( nullptr ) + _input_collection( 0 ), _output_collection( 0 ), _new_topology( 0 ) { MyGlobals::_World_Size = 1; MyGlobals::_Rank = 0; @@ -103,7 +101,7 @@ MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const MEDCoupling::MEDFileData* f _input_collection->setParaDomainSelector( ¶llelizer ); _input_collection->retrieveDriver()->readMEDFileData(filedata); - auto* aPT = + MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) _input_collection->getTopology(); aPT->setGlobalNumerotationDefault( _input_collection->getParaDomainSelector() ); _input_collection->prepareFieldDescriptions(); @@ -117,12 +115,12 @@ MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const MEDCoupling::MEDFileData* f MEDPARTITIONER::MEDPartitioner::~MEDPartitioner() { - delete _input_collection; _input_collection = nullptr; - delete _output_collection; _output_collection = nullptr; - delete _new_topology; _new_topology = nullptr; + delete _input_collection; _input_collection = 0; + delete _output_collection; _output_collection = 0; + delete _new_topology; _new_topology = 0; } -void MEDPARTITIONER::MEDPartitioner::createPartitionCollection(int ndomains, const std::string& library,bool /*create_boundary_faces*/, bool /*create_joints*/, bool /*mesure_memory*/) +void MEDPARTITIONER::MEDPartitioner::createPartitionCollection(int ndomains, const std::string& library,bool create_boundary_faces, bool create_joints, bool mesure_memory) { //ParallelTopology* aPT = (ParallelTopology*) _input_collection->getTopology(); if (library == "metis") @@ -148,7 +146,7 @@ MEDCoupling::MEDFileData* MEDPARTITIONER::MEDPartitioner::getMEDFileData() MEDPARTITIONER::Graph* MEDPARTITIONER::MEDPartitioner::Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split, int* edgeweight, DataArrayIdType *vlbloctab) { - MEDPARTITIONER::Graph* cellGraph=nullptr; + MEDPARTITIONER::Graph* cellGraph=0; // will be destroyed by XXXGraph class: MEDCoupling::MCAuto<MEDCoupling::MEDCouplingSkyLineArray> arr(MEDCoupling::MEDCouplingSkyLineArray::New(graph->getIndexArray(), graph->getValuesArray())); switch (split) diff --git a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx index fa53166b5..8d8fc07a9 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx @@ -24,7 +24,7 @@ #include "MEDPARTITIONER_Graph.hxx" #include "MCType.hxx" -#include <string> +#include <map> #include <vector> namespace MEDCoupling @@ -44,7 +44,7 @@ namespace MEDPARTITIONER MEDPartitioner(const std::string& filename, int ndomains=1, const std::string& library="metis",bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false); MEDPartitioner(const MEDCoupling::MEDFileData* fileData, int ndomains=1, const std::string& library="metis",bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false); MEDPartitioner(const MEDCoupling::MEDFileData* fileData, Graph* graph, bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false); - static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=nullptr, DataArrayIdType* vlbloctab=nullptr); + static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=0, DataArrayIdType* vlbloctab=0); static std::vector<std::string> AvailableAlgorithms(); static std::vector<std::string> AllAlgorithms(); static bool HasMetisAlg(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 54014d7ce..f3677d4a9 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -19,8 +19,6 @@ #include "MEDPARTITIONER_MeshCollection.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" #include "MEDPARTITIONER_ConnectZone.hxx" #include "MEDPARTITIONER_Graph.hxx" #include "MEDPARTITIONER_MeshCollectionDriver.hxx" @@ -31,9 +29,6 @@ #include "MEDPARTITIONER_Topology.hxx" #include "MEDPARTITIONER_UserGraph.hxx" #include "MEDPARTITIONER_Utils.hxx" -#include <cstddef> -#include "NormalizedGeometricTypes" -#include <sstream> #ifdef HAVE_MPI #include "MEDPARTITIONER_JointFinder.hxx" @@ -42,6 +37,7 @@ #include "MCAuto.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" +#include "MEDCouplingNormalizedUnstructuredMesh.hxx" #include "MEDCouplingSkyLineArray.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDLoader.hxx" @@ -61,22 +57,24 @@ #include "MEDPARTITIONER_ScotchGraph.hxx" #endif +#include <set> #include <vector> #include <string> +#include <limits> #include <iostream> #include <fstream> MEDPARTITIONER::MeshCollection::MeshCollection() - : _topology(nullptr), + : _topology(0), _owns_topology(false), - _driver(nullptr), - _domain_selector( nullptr ), + _driver(0), + _domain_selector( 0 ), _i_non_empty_mesh(-1), _driver_type(MEDPARTITIONER::MedXml), _subdomain_boundary_creates( MyGlobals::_Create_Boundary_Faces ), _family_splitting(false), _create_empty_groups(false), - _joint_finder(nullptr) + _joint_finder(0) { } @@ -97,7 +95,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection bool create_empty_groups) : _topology(topology), _owns_topology(false), - _driver(nullptr), + _driver(0), _domain_selector( initialCollection._domain_selector ), _i_non_empty_mesh(-1), _name(initialCollection._name), @@ -105,7 +103,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection _subdomain_boundary_creates(MyGlobals::_Create_Boundary_Faces), _family_splitting(family_splitting), _create_empty_groups(create_empty_groups), - _joint_finder(nullptr) + _joint_finder(0) { std::vector<std::vector<std::vector<mcIdType> > > new2oldIds(initialCollection.getTopology()->nbDomain()); std::vector<MEDCoupling::DataArrayIdType*> o2nRenumber; @@ -212,7 +210,7 @@ void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialColle { if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : castCellMeshes" << std::endl; - if (_topology==nullptr) + if (_topology==0) throw INTERP_KERNEL::Exception("Topology has not been defined on call to castCellMeshes"); int nbNewDomain=_topology->nbDomain(); @@ -220,20 +218,20 @@ void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialColle _mesh.resize(nbNewDomain); o2nRenumber.resize(nbNewDomain,0); - int const rank=MyGlobals::_Rank; + int rank=MyGlobals::_Rank; //splitting the initial domains into smaller bits std::vector<std::vector<MEDCoupling::MEDCouplingUMesh*> > splitMeshes; splitMeshes.resize(nbNewDomain); for (int inew=0; inew<nbNewDomain; inew++) { - splitMeshes[inew].resize(nbOldDomain, (MEDCoupling::MEDCouplingUMesh*)nullptr); + splitMeshes[inew].resize(nbOldDomain, (MEDCoupling::MEDCouplingUMesh*)0); } for (int iold=0; iold<nbOldDomain; iold++) { if (!isParallelMode() || initialCollection._domain_selector->isMyDomain(iold)) { - mcIdType const size=(initialCollection._mesh)[iold]->getNumberOfCells(); + mcIdType size=(initialCollection._mesh)[iold]->getNumberOfCells(); std::vector<mcIdType> globalids(size); initialCollection.getTopology()->getCellList(iold, &globalids[0]); std::vector<mcIdType> ilocalnew(size); //local @@ -331,7 +329,7 @@ void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialC { double* bbox; - BBTreeOfDim* tree = nullptr; + BBTreeOfDim* tree = 0; int dim = 3; if (!isParallelMode() || (_domain_selector->isMyDomain(iold))) { @@ -339,7 +337,7 @@ void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialC MEDCoupling::DataArrayDouble* coords = initialCollection.getMesh(iold)->getCoords(); double* coordsPtr=coords->getPointer(); dim = (int)coords->getNumberOfComponents(); - mcIdType const nvertices=initialCollection.getMesh(iold)->getNumberOfNodes(); + mcIdType nvertices=initialCollection.getMesh(iold)->getNumberOfNodes(); bbox=new double[nvertices*2*dim]; for (int i=0; i<nvertices*dim;i++) @@ -347,7 +345,7 @@ void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialC bbox[i*2]=coordsPtr[i]-1e-8; bbox[i*2+1]=coordsPtr[i]+1e-8; } - tree=new BBTreeOfDim( dim, bbox,nullptr,0,nvertices,1e-9); + tree=new BBTreeOfDim( dim, bbox,0,0,nvertices,1e-9); } for (int inew=0; inew<_topology->nbDomain(); inew++) @@ -402,10 +400,10 @@ void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCoupling using MEDPARTITIONER::BBTreeOfDim; //if (!&meshOne || !&meshTwo) return; //empty or not existing double* bbox; - BBTreeOfDim* tree = nullptr; - mcIdType const nv1=meshOne.getNumberOfNodes(); + BBTreeOfDim* tree = 0; + mcIdType nv1=meshOne.getNumberOfNodes(); MEDCoupling::DataArrayDouble* coords=meshOne.getCoords(); - int const dim = (int)coords->getNumberOfComponents(); + int dim = (int)coords->getNumberOfComponents(); bbox=new double[nv1*2*dim]; double* coordsPtr=coords->getPointer(); @@ -414,7 +412,7 @@ void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCoupling bbox[i*2]=coordsPtr[i]-1e-8; bbox[i*2+1]=coordsPtr[i]+1e-8; } - tree=new BBTreeOfDim( dim, bbox,nullptr,0,nv1,1e-9); + tree=new BBTreeOfDim( dim, bbox,0,0,nv1,1e-9); mcIdType nv2=meshTwo.getNumberOfNodes(); nodeIds.resize(nv2,-1); @@ -452,7 +450,7 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : castFaceMeshes" << std::endl; - if (_topology==nullptr) + if (_topology==0) throw INTERP_KERNEL::Exception("Topology has not been defined on call to castFaceMeshes"); int nbNewDomain=_topology->nbDomain(); @@ -466,7 +464,7 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle splitMeshes.resize(nbNewDomain); for (int inew=0; inew<nbNewDomain; inew++) { - splitMeshes[inew].resize(nbOldDomain, (MEDCoupling::MEDCouplingUMesh*)nullptr); + splitMeshes[inew].resize(nbOldDomain, (MEDCoupling::MEDCouplingUMesh*)0); } new2oldIds.resize(nbOldDomain); for (int iold=0; iold<nbOldDomain; iold++) new2oldIds[iold].resize(nbNewDomain); @@ -597,13 +595,13 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle for (int iold=0; iold<nbOldDomain; iold++) { MEDCoupling::MEDCouplingUMesh *umesh=splitMeshes[inew][iold]; - if (umesh!=nullptr) + if (umesh!=0) if (umesh->getNumberOfCells()>0) myMeshes.push_back(umesh); } - MEDCoupling::MEDCouplingUMesh *bndMesh = nullptr; + MEDCoupling::MEDCouplingUMesh *bndMesh = 0; if ( _subdomain_boundary_creates && _mesh[inew] && _mesh[inew]->getNumberOfCells()>0 ) @@ -749,7 +747,7 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, MEDCoupling::DataArrayDouble* targetCoords=targetMesh.computeCellCenterOfMass(); const double* tc=targetCoords->getConstPointer(); mcIdType targetSize=targetMesh.getNumberOfCells(); - mcIdType const sourceSize=sourceMesh.getNumberOfCells(); + mcIdType sourceSize=sourceMesh.getNumberOfCells(); if (MyGlobals::_Verbose>200) std::cout<<"remap vers target de taille "<<targetSize<<std::endl; std::vector<mcIdType> ccI; @@ -760,12 +758,12 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, const BBTreeOfDim* tree; bool cleantree=false; - MEDCoupling::DataArrayDouble* sourceBBox=nullptr; - int const dim = (int)targetCoords->getNumberOfComponents(); - if (myTree==nullptr) + MEDCoupling::DataArrayDouble* sourceBBox=0; + int dim = (int)targetCoords->getNumberOfComponents(); + if (myTree==0) { sourceBBox=sourceMesh.computeCellCenterOfMass()->computeBBoxPerTuple(1e-8); - tree=new BBTreeOfDim( dim, sourceBBox->getConstPointer(),nullptr,0, sourceBBox->getNumberOfTuples(),1e-10); + tree=new BBTreeOfDim( dim, sourceBBox->getConstPointer(),0,0, sourceBBox->getNumberOfTuples(),1e-10); cleantree=true; } else tree=myTree; @@ -819,7 +817,7 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, targetCoords->decrRef(); if (cleantree) delete tree; - if (sourceBBox !=nullptr) sourceBBox->decrRef(); + if (sourceBBox !=0) sourceBBox->decrRef(); } void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollection, std::string nameArrayTo) @@ -827,17 +825,17 @@ void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollec if (nameArrayTo!="cellFieldDouble") throw INTERP_KERNEL::Exception("Error castAllField only on cellFieldDouble"); - std::string const nameTo="typeData=6"; //resume the type of field casted + std::string nameTo="typeData=6"; //resume the type of field casted // send-recv operations - std::size_t const ioldMax=initialCollection.getMesh().size(); - std::size_t const inewMax=this->getMesh().size(); - std::size_t const iFieldMax=initialCollection.getFieldDescriptions().size(); + std::size_t ioldMax=initialCollection.getMesh().size(); + std::size_t inewMax=this->getMesh().size(); + std::size_t iFieldMax=initialCollection.getFieldDescriptions().size(); if (MyGlobals::_Verbose>10) std::cout << "castAllFields with:\n" << ReprVectorOfString(initialCollection.getFieldDescriptions()) << std::endl; //see collection.prepareFieldDescriptions() for (std::size_t ifield=0; ifield<iFieldMax; ifield++) { - std::string const descriptionField=initialCollection.getFieldDescriptions()[ifield]; + std::string descriptionField=initialCollection.getFieldDescriptions()[ifield]; if (descriptionField.find(nameTo)==std::string::npos) continue; //only nameTo accepted in Fields name description #ifdef HAVE_MPI @@ -848,7 +846,7 @@ void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollec //sending arrays for distant domains if (isParallelMode() && _domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew)) { - int const target=_domain_selector->getProcessorID(inew); + int target=_domain_selector->getProcessorID(inew); MEDCoupling::DataArrayDouble* field=initialCollection.getField(descriptionField,iold); if (MyGlobals::_Verbose>10) std::cout << "proc " << _domain_selector->rank() << " : castAllFields sendDouble" << std::endl; @@ -857,7 +855,7 @@ void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollec //receiving arrays from distant domains if (isParallelMode() && !_domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew)) { - int const source=_domain_selector->getProcessorID(iold); + int source=_domain_selector->getProcessorID(iold); //receive vector if (MyGlobals::_Verbose>10) std::cout << "proc " << _domain_selector->rank() << " : castAllFields recvDouble" << std::endl; @@ -903,15 +901,15 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, if (MyGlobals::_Verbose>300) std::cout << "proc " << MyGlobals::_Rank << " : remapDoubleField " << key << " size " << ccI->getNbOfElems() << std::endl; - mcIdType const nbcell=this->getMesh()[inew]->getNumberOfCells(); - std::size_t const nbcomp=fromArray->getNumberOfComponents(); - int const nbPtGauss=StrToInt(ExtractFromDescription(descriptionField, "nbPtGauss=")); + mcIdType nbcell=this->getMesh()[inew]->getNumberOfCells(); + std::size_t nbcomp=fromArray->getNumberOfComponents(); + int nbPtGauss=StrToInt(ExtractFromDescription(descriptionField, "nbPtGauss=")); std::string tag="inewFieldDouble="+IntToStr(inew); key=descriptionField+SerializeFromString(tag); - mcIdType const fromArrayNbOfElem=fromArray->getNbOfElems(); + mcIdType fromArrayNbOfElem=fromArray->getNbOfElems(); mcIdType fromArrayNbOfComp=ToIdType(fromArray->getNumberOfComponents()); - mcIdType const fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss; + mcIdType fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss; if (MyGlobals::_Verbose>1000) { @@ -922,7 +920,7 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, " nbComponents " << fromArray->getNumberOfComponents() << std::endl; } - MEDCoupling::DataArrayDouble* field=nullptr; + MEDCoupling::DataArrayDouble* field=0; std::map<std::string,MEDCoupling::DataArrayDouble*>::iterator it2; it2=_map_dataarray_double.find(key); if (it2==_map_dataarray_double.end()) @@ -952,7 +950,7 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, else { //replaced by setPartOfValuesAdv if nbPtGauss==1 - mcIdType const iMax=ccI->getNbOfElems(); + mcIdType iMax=ccI->getNbOfElems(); mcIdType* pccI=ccI->getPointer(); double* pField=field->getPointer(); double* pFrom=fromArray->getPointer(); @@ -963,8 +961,8 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, isource=pccI[i+1]; if ((itarget<0) || (itarget>=nbcell) || (isource<0) || (isource>=fromArrayNbOfCell)) throw INTERP_KERNEL::Exception("Error field override"); - mcIdType const ita=itarget*delta; - mcIdType const iso=isource*delta; + mcIdType ita=itarget*delta; + mcIdType iso=isource*delta; for (mcIdType k=0; k<delta; k++) pField[ita+k]=pFrom[iso+k]; //components and gausspoints } } @@ -1124,7 +1122,7 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM if ( corresp.empty() ) continue; - MEDPARTITIONER::ConnectZone* cz = nullptr; + MEDPARTITIONER::ConnectZone* cz = 0; for ( size_t i = 0; i < czVec.size() && !cz; ++i ) if ( czVec[i] && czVec[i]->getLocalDomainNumber () == idomain && @@ -1177,7 +1175,7 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM if ( types1.size() < 1 || types2.size() < 1 ) continue; // parallel mode? - MEDPARTITIONER::ConnectZone* cz21 = nullptr; // zone 2 -> 1 + MEDPARTITIONER::ConnectZone* cz21 = 0; // zone 2 -> 1 for ( size_t j = 0; j < czVec.size() && !cz21; ++j ) if ( czVec[j] && czVec[j]->getLocalDomainNumber () == cz->getDistantDomainNumber() && @@ -1241,9 +1239,9 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM } }// split and sort - cz->setEntityCorresp( 0, 0, nullptr, 0 ); // erase ids computed by _topology + cz->setEntityCorresp( 0, 0, 0, 0 ); // erase ids computed by _topology if ( cz21 ) - cz21->setEntityCorresp( 0, 0, nullptr, 0 ); + cz21->setEntityCorresp( 0, 0, 0, 0 ); } // loop on czVec @@ -1262,7 +1260,7 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM if ( cz->getDistantDomainNumber() < cz->getLocalDomainNumber() ) continue; // treat a pair of domains once - MEDPARTITIONER::ConnectZone* cz21 = nullptr; // zone 2 -> 1 + MEDPARTITIONER::ConnectZone* cz21 = 0; // zone 2 -> 1 for ( size_t j = 0; j < czVec.size() && !cz21; ++j ) if ( czVec[j] && czVec[j]->getLocalDomainNumber () == cz->getDistantDomainNumber() && @@ -1328,8 +1326,8 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() { for (unsigned int inew2 = inew1+1; inew2 < nbMeshes; inew2++ ) { - MEDCouplingUMesh* mesh1 = nullptr; - MEDCouplingUMesh* mesh2 = nullptr; + MEDCouplingUMesh* mesh1 = 0; + MEDCouplingUMesh* mesh2 = 0; //MEDCouplingUMesh* recvMesh = 0; bool mesh1Here = true, mesh2Here = true; if (isParallelMode()) @@ -1456,10 +1454,10 @@ void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< mcIdTy _group_info.erase( groupName ); // get family IDs array - mcIdType* famIDs = nullptr; - int const inew = (is2nd ? inew2 : inew1 ); + mcIdType* famIDs = 0; + int inew = (is2nd ? inew2 : inew1 ); mcIdType totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0; - std::string const cle = Cle1ToStr( "faceFamily_toArray", inew ); + std::string cle = Cle1ToStr( "faceFamily_toArray", inew ); if ( !_map_dataarray_int.count(cle) ) { if ( totalNbFaces > 0 ) @@ -1521,16 +1519,16 @@ void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< mcIdTy * \param filename name of the master file containing the list of all the MED files */ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename) - : _topology(nullptr), + : _topology(0), _owns_topology(true), - _driver(nullptr), - _domain_selector( nullptr ), + _driver(0), + _domain_selector( 0 ), _i_non_empty_mesh(-1), _driver_type(MEDPARTITIONER::Undefined), _subdomain_boundary_creates(MyGlobals::_Create_Boundary_Faces), _family_splitting(false), _create_empty_groups(false), - _joint_finder(nullptr) + _joint_finder(0) { try { @@ -1540,7 +1538,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename) } catch(...) { // Handle all exceptions - if ( _driver ) delete _driver; _driver=nullptr; + if ( _driver ) delete _driver; _driver=0; try { _driver=new MeshCollectionMedAsciiDriver(this); @@ -1550,7 +1548,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename) catch(...) { delete _driver; - _driver=nullptr; + _driver=0; throw INTERP_KERNEL::Exception("file does not comply with any recognized format"); } } @@ -1565,18 +1563,18 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename) * \param domainSelector - selector of domains to load */ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, ParaDomainSelector& domainSelector) - : _topology(nullptr), + : _topology(0), _owns_topology(true), - _driver(nullptr), + _driver(0), _domain_selector( &domainSelector ), _i_non_empty_mesh(-1), _driver_type(MEDPARTITIONER::Undefined), _subdomain_boundary_creates(MyGlobals::_Create_Boundary_Faces), _family_splitting(false), _create_empty_groups(false), - _joint_finder(nullptr) + _joint_finder(0) { - std::string const myfile=filename; + std::string myfile=filename; std::size_t found=myfile.find(".xml"); if (found!=std::string::npos) //file .xml { @@ -1652,7 +1650,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, Para } catch(...) { // Handle all exceptions - delete _driver; _driver=nullptr; + delete _driver; _driver=0; throw INTERP_KERNEL::Exception("file medpartitioner_xxx.xml does not comply with any recognized format"); } } @@ -1667,7 +1665,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, Para catch(...) { delete _driver; - _driver=nullptr; + _driver=0; throw INTERP_KERNEL::Exception("file name with no extension does not comply with any recognized format"); } } @@ -1724,17 +1722,17 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, Para * \param meshname name of the mesh that is to be read */ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, const std::string& meshname) - : _topology(nullptr), + : _topology(0), _owns_topology(true), - _driver(nullptr), - _domain_selector( nullptr ), + _driver(0), + _domain_selector( 0 ), _i_non_empty_mesh(-1), _name(meshname), _driver_type(MEDPARTITIONER::MedXml), _subdomain_boundary_creates(MyGlobals::_Create_Boundary_Faces), _family_splitting(false), _create_empty_groups(false), - _joint_finder(nullptr) + _joint_finder(0) { try // avoid memory leak in case of inexistent filename { @@ -1743,7 +1741,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, cons catch (...) { delete _driver; - _driver=nullptr; + _driver=0; throw INTERP_KERNEL::Exception("problem reading .med files"); } if ( _mesh[0] && _mesh[0]->getNumberOfNodes() > 0 ) @@ -1752,20 +1750,20 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, cons MEDPARTITIONER::MeshCollection::~MeshCollection() { - for (auto & i : _mesh) - if (i!=nullptr) i->decrRef(); + for (std::size_t i=0; i<_mesh.size();i++) + if (_mesh[i]!=0) _mesh[i]->decrRef(); - for (auto & _cell_family_id : _cell_family_ids) - if (_cell_family_id!=nullptr) - _cell_family_id->decrRef(); + for (std::size_t i=0; i<_cell_family_ids.size();i++) + if (_cell_family_ids[i]!=0) + _cell_family_ids[i]->decrRef(); - for (auto & i : _face_mesh) - if (i!=nullptr) - i->decrRef(); + for (std::size_t i=0; i<_face_mesh.size();i++) + if (_face_mesh[i]!=0) + _face_mesh[i]->decrRef(); - for (auto & _face_family_id : _face_family_ids) - if (_face_family_id!=nullptr) - _face_family_id->decrRef(); + for (std::size_t i=0; i<_face_family_ids.size();i++) + if (_face_family_ids[i]!=0) + _face_family_ids[i]->decrRef(); for (std::map<std::string, MEDCoupling::DataArrayIdType*>::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ ) if ((*it).second!=0) @@ -1776,7 +1774,7 @@ MEDPARTITIONER::MeshCollection::~MeshCollection() (*it).second->decrRef(); delete _driver; - if (_topology!=nullptr && _owns_topology) + if (_topology!=0 && _owns_topology) delete _topology; #ifdef HAVE_MPI delete _joint_finder; @@ -1797,7 +1795,7 @@ void MEDPARTITIONER::MeshCollection::write(const std::string& filename) { //suppresses link with driver so that it can be changed for writing delete _driver; - _driver=nullptr; + _driver=0; retrieveDriver()->write (filename.c_str(), _domain_selector); } @@ -1805,7 +1803,7 @@ void MEDPARTITIONER::MeshCollection::write(const std::string& filename) */ MEDPARTITIONER::MeshCollectionDriver* MEDPARTITIONER::MeshCollection::retrieveDriver() { - if (_driver==nullptr) + if (_driver==0) { switch(_driver_type) { @@ -1842,9 +1840,9 @@ int MEDPARTITIONER::MeshCollection::getMeshDimension() const int MEDPARTITIONER::MeshCollection::getNbOfLocalMeshes() const { int nb=0; - for (auto i : _mesh) + for (size_t i=0; i<_mesh.size(); i++) { - if (i) nb++; + if (_mesh[i]) nb++; } return nb; } @@ -1852,9 +1850,9 @@ int MEDPARTITIONER::MeshCollection::getNbOfLocalMeshes() const mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const { mcIdType nb=0; - for (auto i : _mesh) + for (size_t i=0; i<_mesh.size(); i++) { - if (i) nb=nb+i->getNumberOfCells(); + if (_mesh[i]) nb=nb+_mesh[i]->getNumberOfCells(); } return nb; } @@ -1862,9 +1860,9 @@ mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const { mcIdType nb=0; - for (auto i : _face_mesh) + for (size_t i=0; i<_face_mesh.size(); i++) { - if (i) nb=nb+i->getNumberOfCells(); + if (_face_mesh[i]) nb=nb+_face_mesh[i]->getNumberOfCells(); } return nb; } @@ -1905,7 +1903,7 @@ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::getTopology() const void MEDPARTITIONER::MeshCollection::setTopology(Topology* topo, bool takeOwneship) { - if (_topology!=nullptr) + if (_topology!=0) { throw INTERP_KERNEL::Exception("topology is already set"); } @@ -1922,7 +1920,7 @@ void MEDPARTITIONER::MeshCollection::setTopology(Topology* topo, bool takeOwnesh * \param edgeweight returns the pointer to the table that contains the edgeweights * (only used if indivisible regions are required) */ -void MEDPARTITIONER::MeshCollection::buildCellGraph(MEDCoupling::MEDCouplingSkyLineArray* & array, int *& /*edgeweights*/ ) +void MEDPARTITIONER::MeshCollection::buildCellGraph(MEDCoupling::MEDCouplingSkyLineArray* & array, int *& edgeweights ) { using std::map; @@ -1952,7 +1950,7 @@ void MEDPARTITIONER::MeshCollection::buildCellGraph(MEDCoupling::MEDCouplingSkyL * \param edgeweight returns the pointer to the table that contains the edgeweights * (only used if indivisible regions are required) */ -void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCouplingSkyLineArray* & array, int *& /*edgeweights*/ ) +void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCouplingSkyLineArray* & array, int *& edgeweights ) { using std::multimap; using std::vector; @@ -1964,7 +1962,7 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup std::multimap<mcIdType,mcIdType> cell2cell; std::vector<std::vector<std::multimap<mcIdType,mcIdType> > > commonDistantNodes; - int const nbdomain=_topology->nbDomain(); + int nbdomain=_topology->nbDomain(); #ifdef HAVE_MPI if (isParallelMode()) { @@ -1989,7 +1987,7 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup MEDCoupling::DataArrayIdType* index=MEDCoupling::DataArrayIdType::New(); MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New(); - mcIdType const nbNodes=_mesh[idomain]->getNumberOfNodes(); + mcIdType nbNodes=_mesh[idomain]->getNumberOfNodes(); _mesh[idomain]->getReverseNodalConnectivity(revConn,index); //problem saturation over 1 000 000 nodes for 1 proc if (MyGlobals::_Verbose>100) @@ -2000,8 +1998,8 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup { for (mcIdType icell=index_ptr[i]; icell<index_ptr[i+1]; icell++) { - mcIdType const globalNode=_topology->convertNodeToGlobal(idomain,i); - mcIdType const globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]); + mcIdType globalNode=_topology->convertNodeToGlobal(idomain,i); + mcIdType globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]); node2cell.insert(make_pair(globalNode, globalCell)); } } @@ -2011,8 +2009,8 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup for (int iother=0; iother<nbdomain; iother++) { std::multimap<mcIdType,mcIdType>::iterator it; - int const isource=idomain; - int const itarget=iother; + int isource=idomain; + int itarget=iother; for (it=_joint_finder->getDistantNodeCell()[isource][itarget].begin(); it!=_joint_finder->getDistantNodeCell()[isource][itarget].end(); it++) { @@ -2091,11 +2089,11 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup for (int idomain=0; idomain<nbdomain; idomain++) { if (isParallelMode() && !_domain_selector->isMyDomain(idomain)) continue; - mcIdType const nbCells=_mesh[idomain]->getNumberOfCells(); + mcIdType nbCells=_mesh[idomain]->getNumberOfCells(); for (mcIdType icell=0; icell<nbCells; icell++) { mcIdType size=0; - mcIdType const globalCell=_topology->convertCellToGlobal(idomain,icell); + mcIdType globalCell=_topology->convertCellToGlobal(idomain,icell); multimap<mcIdType,mcIdType>::iterator it; pair<multimap<mcIdType,mcIdType>::iterator,multimap<mcIdType,mcIdType>::iterator> ret; ret=cell2cell.equal_range(globalCell); @@ -2159,15 +2157,15 @@ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(int nb if (nbdomain <1) throw INTERP_KERNEL::Exception("Number of subdomains must be > 0"); - MEDCoupling::MEDCouplingSkyLineArray* array=nullptr; - int* edgeweights=nullptr; + MEDCoupling::MEDCouplingSkyLineArray* array=0; + int* edgeweights=0; if (_topology->nbDomain()>1 || isParallelMode()) buildParallelCellGraph(array,edgeweights); else buildCellGraph(array,edgeweights); - Graph* cellGraph = nullptr; + Graph* cellGraph = 0; switch (split) { case Graph::METIS: @@ -2203,9 +2201,9 @@ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(int nb } //!user-defined weights - if (user_edge_weights!=nullptr) + if (user_edge_weights!=0) cellGraph->setEdgesWeights(user_edge_weights); - if (user_vertices_weights!=nullptr) + if (user_vertices_weights!=0) cellGraph->setVerticesWeights(user_vertices_weights); if (MyGlobals::_Is0verbose>10) @@ -2215,7 +2213,7 @@ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(int nb if (MyGlobals::_Is0verbose>10) std::cout << "building new topology" << std::endl; //cellGraph is a shared pointer - Topology *topology=nullptr; + Topology *topology=0; topology=new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension()); //cleaning delete [] edgeweights; @@ -2233,8 +2231,8 @@ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(int nb */ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const int* partition) { - MEDCoupling::MEDCouplingSkyLineArray* array=nullptr; - int* edgeweights=nullptr; + MEDCoupling::MEDCouplingSkyLineArray* array=0; + int* edgeweights=0; if ( _topology->nbDomain()>1) buildParallelCellGraph(array,edgeweights); @@ -2250,7 +2248,7 @@ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const cellGraph=new UserGraph(array, partition, _topology->nbCells()); //cellGraph is a shared pointer - Topology *topology=nullptr; + Topology *topology=0; int nbdomain=(int)domains.size(); topology=new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension()); // if (array!=0) delete array; @@ -2273,7 +2271,7 @@ MEDCoupling::DataArrayDouble *MEDPARTITIONER::MeshCollection::getField(std::stri //getField look for and read it if not done, and assume decrRef() in ~MeshCollection; //something like MCAuto<MEDCouplingFieldDouble> f2=ReadFieldCell(name,f1->getMesh()->getName(),0,f1->getName(),0,1); { - int const rank=MyGlobals::_Rank; + int rank=MyGlobals::_Rank; std::string tag="ioldFieldDouble="+IntToStr(iold); std::string descriptionIold=descriptionField+SerializeFromString(tag); if (_map_dataarray_double.find(descriptionIold)!=_map_dataarray_double.end()) @@ -2327,7 +2325,7 @@ void MEDPARTITIONER::MeshCollection::prepareFieldDescriptions() } //here vector(procs*fields) of serialised vector(description) data _field_descriptions=r2; - std::size_t const nbfields=_field_descriptions.size(); //on all domains + std::size_t nbfields=_field_descriptions.size(); //on all domains if ((nbfields%nbfiles)!=0) { if (MyGlobals::_Rank==0) @@ -2341,12 +2339,12 @@ void MEDPARTITIONER::MeshCollection::prepareFieldDescriptions() throw INTERP_KERNEL::Exception("incoherent number of fields references in all files .med\n"); } _field_descriptions.resize(nbfields/nbfiles); - for (auto & _field_description : _field_descriptions) + for (std::size_t i=0; i<_field_descriptions.size(); i++) { - std::string str=_field_description; + std::string str=_field_descriptions[i]; str=EraseTagSerialized(str,"idomain="); str=EraseTagSerialized(str,"fileName="); - _field_description=str; + _field_descriptions[i]=str; } } @@ -2399,7 +2397,7 @@ void MEDPARTITIONER::MeshCollection::filterFaceOnCell() std::vector< mcIdType > faceOnCell; std::vector< mcIdType > faceNotOnCell; - mcIdType const nbface=mfac->getNumberOfCells(); + mcIdType nbface=mfac->getNumberOfCells(); for (mcIdType iface=0; iface<nbface; iface++) { bool ok; @@ -2420,10 +2418,10 @@ void MEDPARTITIONER::MeshCollection::filterFaceOnCell() std::cout << "filterFaceOnCell problem 1" << std::endl; continue; } - mcIdType const nbcell=revIndxC[inod+1]-revIndxC[inod]; + mcIdType nbcell=revIndxC[inod+1]-revIndxC[inod]; for (mcIdType j=0; j<nbcell; j++) //look for each cell with inod { - mcIdType const icel=revC[revIndxC[inod]+j]; + mcIdType icel=revC[revIndxC[inod]+j]; std::vector< mcIdType > inodesCell; mcel->getNodeIdsOfCell(icel, inodesCell); ok=isFaceOncell(inodesFace, inodesCell); @@ -2459,7 +2457,7 @@ void MEDPARTITIONER::MeshCollection::filterFaceOnCell() mfac->decrRef(); // filter the face families - std::string const key = Cle1ToStr("faceFamily_toArray",inew); + std::string key = Cle1ToStr("faceFamily_toArray",inew); if ( getMapDataArrayInt().count( key )) { MEDCoupling::DataArrayIdType * & fam = getMapDataArrayInt()[ key ]; diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx index 43e71f0f7..4816631bb 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx @@ -20,19 +20,16 @@ #ifndef __MEDPARTITIONER_MESHCOLLECTION_HXX__ #define __MEDPARTITIONER_MESHCOLLECTION_HXX__ -#include "MCType.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDPARTITIONER.hxx" #include "MEDPARTITIONER_Graph.hxx" #include "MEDPARTITIONER_Utils.hxx" #include "MEDCouplingSkyLineArray.hxx" #include <map> -#include <utility> #include <vector> #include <string> +#include "BBTree.txx" namespace MEDCoupling { @@ -83,7 +80,7 @@ namespace MEDPARTITIONER //creation and partition of the associated graph Topology* createPartition(int nbdomain, Graph::splitter_type type = Graph::METIS, - const std::string& ="", int* edgeweights=nullptr, int* verticesweights=nullptr); + const std::string& ="", int* edgeweights=0, int* verticesweights=0); //creation of a user specified partition Topology* createPartition(const int* partition); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx index 83a647c0b..7bb159719 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx @@ -19,11 +19,6 @@ #include "MEDPARTITIONER_MeshCollectionDriver.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" -#include "MCAuto.hxx" -#include "MEDFileFieldMultiTS.hxx" -#include "MEDFileField1TS.hxx" #include "MEDPARTITIONER_ConnectZone.hxx" #include "MEDPARTITIONER_MeshCollection.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" @@ -40,16 +35,19 @@ #include "MEDFileMesh.hxx" #include "MEDLoader.hxx" -#include <cstddef> #include <map> -#include <sstream> -#include <utility> +#include <set> #include <vector> #include <string> +#include <fstream> #include <iostream> +#include <libxml/tree.h> +#include <libxml/parser.h> +#include <libxml/xpath.h> +#include <libxml/xpathInternals.h> -#include "NormalizedGeometricTypes" +#include "med.h" using namespace MEDPARTITIONER; @@ -85,7 +83,7 @@ int MeshCollectionDriver::readSeq(const char* filename, const char* meshname) (_collection->getCZ()).clear(); - auto* aPT = new ParallelTopology((_collection->getMesh())); + ParallelTopology* aPT = new ParallelTopology((_collection->getMesh())); _collection->setTopology(aPT, true); _collection->setName(meshname); _collection->setDomainNames(meshname); @@ -96,20 +94,20 @@ int MeshCollectionDriver::readSeq(const char* filename, const char* meshname) void MeshCollectionDriver::readMEDFileData(const MEDCoupling::MEDFileData* filedata) { const int nbDomains = filedata->getMeshes()->getNumberOfMeshes(); - _collection->getMesh() .resize( nbDomains, nullptr ); - _collection->getFaceMesh() .resize( nbDomains, nullptr ); - _collection->getCellFamilyIds().resize( nbDomains, nullptr ); - _collection->getFaceFamilyIds().resize( nbDomains, nullptr ); + _collection->getMesh() .resize( nbDomains, 0 ); + _collection->getFaceMesh() .resize( nbDomains, 0 ); + _collection->getCellFamilyIds().resize( nbDomains, 0 ); + _collection->getFaceFamilyIds().resize( nbDomains, 0 ); for (int i=0; i<nbDomains; i++) { - auto *mfm = dynamic_cast<MEDCoupling::MEDFileUMesh *>(filedata->getMeshes()->getMeshAtPos(i)); + MEDCoupling::MEDFileUMesh *mfm = dynamic_cast<MEDCoupling::MEDFileUMesh *>(filedata->getMeshes()->getMeshAtPos(i)); readData(mfm,i); if ( mfm && mfm->getMeshDimension() > 0 ) _collection->setNonEmptyMesh( i ); } - auto* aPT = new ParallelTopology(_collection->getMesh()); + ParallelTopology* aPT = new ParallelTopology(_collection->getMesh()); _collection->setTopology(aPT, true); if ( nbDomains > 0 ) { @@ -180,16 +178,16 @@ void MeshCollectionDriver::readData(MEDCoupling::MEDFileUMesh* mfm, int idomain) void MeshCollectionDriver::readSubdomain(int idomain) { - std::string const meshname=MyGlobals::_Mesh_Names[idomain]; - std::string const file=MyGlobals::_File_Names[idomain]; + std::string meshname=MyGlobals::_Mesh_Names[idomain]; + std::string file=MyGlobals::_File_Names[idomain]; readFileData(file,meshname,idomain); std::vector<std::string> localInformation; - std::string const str; + std::string str; localInformation.push_back(str+"ioldDomain="+IntToStr(idomain)); localInformation.push_back(str+"meshName="+meshname); MyGlobals::_General_Informations.push_back(SerializeFromVectorOfString(localInformation)); - std::vector<std::string> const localFields=BrowseAllFieldsOnMesh(file, meshname, idomain); + std::vector<std::string> localFields=BrowseAllFieldsOnMesh(file, meshname, idomain); if (localFields.size()>0) MyGlobals::_Field_Descriptions.push_back(SerializeFromVectorOfString(localFields)); } @@ -214,7 +212,7 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const std::string finalMeshName=""; if (MyGlobals::_General_Informations.size()!=0) { - std::size_t const found=MyGlobals::_General_Informations[0].find("finalMeshName="); + std::size_t found=MyGlobals::_General_Informations[0].find("finalMeshName="); if ((found!=std::string::npos) && (found>0)) { finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName="); @@ -306,16 +304,16 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const j1st->pushCorrespondence( corr ); } - std::vector< std::pair< mcIdType,mcIdType > > const types = cz->getEntities(); + std::vector< std::pair< mcIdType,mcIdType > > types = cz->getEntities(); INTERP_KERNEL::NormalizedCellType t1, t2; - for (auto & type : types) + for ( size_t it = 0; it < types.size(); ++it ) { const MEDCouplingSkyLineArray * cellCorr = - cz->getEntityCorresp( type.first, type.second ); + cz->getEntityCorresp( types[it].first, types[it].second ); if ( cellCorr && cellCorr->getNumberOf() > 0 ) { - t1 = INTERP_KERNEL::NormalizedCellType( type.first ); - t2 = INTERP_KERNEL::NormalizedCellType( type.second ); + t1 = INTERP_KERNEL::NormalizedCellType( types[it].first ); + t2 = INTERP_KERNEL::NormalizedCellType( types[it].second ); MCAuto< MEDFileJointCorrespondence> corr = MEDFileJointCorrespondence::New( cellCorr->getValuesArray(), t1, t2 ); j1st->pushCorrespondence( corr ); @@ -328,18 +326,18 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const return mfm; } -MEDCoupling::MEDCouplingFieldDouble* MeshCollectionDriver::getField(std::string /*key*/, std::string description, MEDCoupling::DataArrayDouble* data, MEDCoupling::MEDFileMesh* mfm, int /*idomain*/) const +MEDCoupling::MEDCouplingFieldDouble* MeshCollectionDriver::getField(std::string key, std::string description, MEDCoupling::DataArrayDouble* data, MEDCoupling::MEDFileMesh* mfm, int idomain) const { - std::string const desc=description; + std::string desc=description; if (MyGlobals::_Verbose>20) std::cout << "proc " << MyGlobals::_Rank << " : write field " << desc << std::endl; std::string meshName, fieldName; int typeField, DT, IT, entity; FieldShortDescriptionToData(desc, fieldName, typeField, entity, DT, IT); - double const time=StrToDouble(ExtractFromDescription(desc, "time=")); - int const typeData=StrToInt(ExtractFromDescription(desc, "typeData=")); - std::string const entityName=ExtractFromDescription(desc, "entityName="); - MEDCoupling::MEDCouplingFieldDouble* field=nullptr; + double time=StrToDouble(ExtractFromDescription(desc, "time=")); + int typeData=StrToInt(ExtractFromDescription(desc, "typeData=")); + std::string entityName=ExtractFromDescription(desc, "entityName="); + MEDCoupling::MEDCouplingFieldDouble* field=0; if (typeData!=6) { std::cout << "WARNING : writeMedFile : typeData " << typeData << " not implemented for fields\n"; @@ -370,7 +368,7 @@ MEDCoupling::MEDCouplingFieldDouble* MeshCollectionDriver::getField(std::string r1=SelectTagsInVectorOfString(r1,"DT="+IntToStr(DT)); r1=SelectTagsInVectorOfString(r1,"IT="+IntToStr(IT)); //not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription=")); - std::size_t const nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents=")); + std::size_t nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents=")); if (nbc==da->getNumberOfComponents()) { for (unsigned int i=0; i<nbc; i++) @@ -392,15 +390,15 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile MEDCoupling::MEDFileMesh* mfm = getMesh( idomain ); mfm->write(distfilename,2); - std::string const key="/inewFieldDouble="+IntToStr(idomain)+"/"; + std::string key="/inewFieldDouble="+IntToStr(idomain)+"/"; std::map<std::string,MEDCoupling::DataArrayDouble*>::iterator it; int nbfFieldFound=0; for (it=_collection->getMapDataArrayDouble().begin() ; it!=_collection->getMapDataArrayDouble().end(); it++) { - size_t const found=(*it).first.find(key); + size_t found=(*it).first.find(key); if (found==std::string::npos) continue; - MEDCoupling::MEDCouplingFieldDouble* field=nullptr; + MEDCoupling::MEDCouplingFieldDouble* field=0; field = getField(key, (*it).first, (*it).second, mfm, idomain); nbfFieldFound++; try @@ -436,15 +434,15 @@ MEDCoupling::MEDFileData* MeshCollectionDriver::getMEDFileData() MEDCoupling::MEDFileMesh* mfm = getMesh( i ); meshes->pushMesh(mfm); - std::string const key="/inewFieldDouble="+IntToStr(i)+"/"; + std::string key="/inewFieldDouble="+IntToStr(i)+"/"; std::map<std::string,MEDCoupling::DataArrayDouble*>::iterator it; MEDCoupling::MEDFileFieldMultiTS* fieldsMTS = MEDCoupling::MEDFileFieldMultiTS::New(); for (it=_collection->getMapDataArrayDouble().begin() ; it!=_collection->getMapDataArrayDouble().end(); it++) { - size_t const found=(*it).first.find(key); + size_t found=(*it).first.find(key); if (found==std::string::npos) continue; - MEDCoupling::MEDCouplingFieldDouble* field=nullptr; + MEDCoupling::MEDCouplingFieldDouble* field=0; field=getField(key, (*it).first, (*it).second, mfm, i); MEDCoupling::MEDFileField1TS* f1ts = MEDCoupling::MEDFileField1TS::New(); f1ts->setFieldNoProfileSBT(field); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.hxx index f042c70bd..ac0c699e4 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.hxx @@ -22,6 +22,7 @@ #include "MEDPARTITIONER.hxx" +#include <vector> #include <string> namespace MEDCoupling @@ -42,11 +43,11 @@ namespace MEDPARTITIONER { public: MeshCollectionDriver(MeshCollection*); - virtual ~MeshCollectionDriver() = default; - virtual int read(const char*, ParaDomainSelector* sel=nullptr) = 0; + virtual ~MeshCollectionDriver() { } + virtual int read(const char*, ParaDomainSelector* sel=0) = 0; int readSeq(const char*,const char*); MEDCoupling::MEDFileData *getMEDFileData(); - virtual void write(const char*, ParaDomainSelector* sel=nullptr) const = 0; + virtual void write(const char*, ParaDomainSelector* sel=0) const = 0; void readMEDFileData(const MEDCoupling::MEDFileData* filedata); protected: void readSubdomain(int idomain); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx index 72c828241..d200a1121 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx @@ -17,7 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MCIdType.hxx" #include "MEDPARTITIONER_ParallelTopology.hxx" #include "MEDPARTITIONER_MeshCollectionDriver.hxx" #include "MEDPARTITIONER_MeshCollection.hxx" @@ -28,14 +27,18 @@ #include "MEDCouplingUMesh.hxx" #include "MEDLoader.hxx" -#include <cstddef> -#include <cstdlib> +#include <map> +#include <set> #include <vector> #include <string> #include <fstream> #include <iostream> #include <sstream> +#include <libxml/tree.h> +#include <libxml/parser.h> +#include <libxml/xpath.h> +#include <libxml/xpathInternals.h> using namespace MEDPARTITIONER; @@ -54,24 +57,24 @@ int MeshCollectionMedAsciiDriver::read(MEDCoupling::MEDFileData* filedata) { readMEDFileData(filedata); - std::vector<MEDPARTITIONER::ConnectZone*> const cz; // to fill from filedata + std::vector<MEDPARTITIONER::ConnectZone*> cz; // to fill from filedata std::vector<mcIdType*> cellglobal; std::vector<mcIdType*> nodeglobal; std::vector<mcIdType*> faceglobal; - std::size_t const size = _collection->getMesh().size(); + std::size_t size = _collection->getMesh().size(); cellglobal.resize(size); nodeglobal.resize(size); faceglobal.resize(size); for ( unsigned int idomain = 0; idomain < size; ++idomain ) { - cellglobal[idomain]=nullptr; - faceglobal[idomain]=nullptr; - nodeglobal[idomain]=nullptr; + cellglobal[idomain]=0; + faceglobal[idomain]=0; + nodeglobal[idomain]=0; if ( (_collection->getMesh())[idomain] && (_collection->getMesh())[idomain]->getNumberOfNodes() > 0 ) _collection->setNonEmptyMesh(idomain); } //creation of topology from mesh and connect zones - auto* aPT = new ParallelTopology((_collection->getMesh()), cz, cellglobal, nodeglobal, faceglobal); + ParallelTopology* aPT = new ParallelTopology((_collection->getMesh()), cz, cellglobal, nodeglobal, faceglobal); _collection->setTopology(aPT,true); return 0; @@ -122,9 +125,9 @@ int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* //reading information about the domain std::string mesh,host; int idomain; - cellglobal[i]=nullptr; - faceglobal[i]=nullptr; - nodeglobal[i]=nullptr; + cellglobal[i]=0; + faceglobal[i]=0; + nodeglobal[i]=0; asciiinput >> mesh >> idomain >> MyGlobals::_Mesh_Names[i] >> host >> MyGlobals::_File_Names[i]; @@ -147,7 +150,7 @@ int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* } //creation of topology from mesh and connect zones - auto* aPT = new ParallelTopology((_collection->getMesh()), (_collection->getCZ()), cellglobal, nodeglobal, faceglobal); + ParallelTopology* aPT = new ParallelTopology((_collection->getMesh()), (_collection->getCZ()), cellglobal, nodeglobal, faceglobal); _collection->setTopology(aPT, true); for (int i=0; i<nbdomain; i++) @@ -165,7 +168,7 @@ int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* */ void MeshCollectionMedAsciiDriver::write(const char* filename, ParaDomainSelector* domainSelector) const { - std::size_t const nbdomains=_collection->getMesh().size(); + std::size_t nbdomains=_collection->getMesh().size(); std::vector<std::string> filenames; filenames.resize(nbdomains); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx index 8315ebbe2..1da628556 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx @@ -22,7 +22,6 @@ #include "MEDPARTITIONER.hxx" #include "MEDPARTITIONER_MeshCollectionDriver.hxx" -#include <string> namespace MEDPARTITIONER { @@ -31,10 +30,10 @@ namespace MEDPARTITIONER { public: MeshCollectionMedAsciiDriver(MeshCollection*); - ~MeshCollectionMedAsciiDriver() override = default; - int read(const char*, ParaDomainSelector* sel=nullptr) override; + virtual ~MeshCollectionMedAsciiDriver() { } + int read(const char*, ParaDomainSelector* sel=0); int read(MEDCoupling::MEDFileData*); - void write(const char*, ParaDomainSelector* sel=nullptr) const override; + void write(const char*, ParaDomainSelector* sel=0) const; private: std::string _master_filename; }; diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx index f1dee14fd..e8af4feff 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx @@ -26,13 +26,14 @@ #include "MEDCouplingUMesh.hxx" #include "MEDLoader.hxx" -#include "libxml/xmlstring.h" +#include "MEDFileMesh.hxx" -#include <cstdio> -#include <ctime> +#include <map> +#include <set> #include <vector> #include <string> #include <cstring> +#include <fstream> #include <sstream> #include <iostream> #ifdef WIN32 @@ -44,6 +45,7 @@ #include <libxml/tree.h> #include <libxml/parser.h> #include <libxml/xpath.h> +#include <libxml/xpathInternals.h> using namespace MEDPARTITIONER; @@ -90,7 +92,7 @@ int MeshCollectionMedXmlDriver::read(const char* filename, ParaDomainSelector* d //number of domains xmlXPathContextPtr xpathCtx = xmlXPathNewContext(master_doc); xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression(BAD_CAST "//splitting/subdomain", xpathCtx); - if (xpathObj==nullptr || xpathObj->nodesetval->nodeNr ==0) + if (xpathObj==0 || xpathObj->nodesetval->nodeNr ==0) throw INTERP_KERNEL::Exception("Xml Master File does not contain /MED/splitting/subdomain node"); //as subdomain has only one property which is "number" @@ -101,7 +103,7 @@ int MeshCollectionMedXmlDriver::read(const char* filename, ParaDomainSelector* d //mesh name xmlXPathFreeObject(xpathObj); xpathObj = xmlXPathEvalExpression(BAD_CAST "//content/mesh", xpathCtx); - if (xpathObj==nullptr || xpathObj->nodesetval->nodeNr ==0) + if (xpathObj==0 || xpathObj->nodesetval->nodeNr ==0) throw INTERP_KERNEL::Exception("Xml Master File does not contain /MED/content/mesh node"); _collection->setName( (const char*)xpathObj->nodesetval->nodeTab[0]->properties->children->content); @@ -117,20 +119,20 @@ int MeshCollectionMedXmlDriver::read(const char* filename, ParaDomainSelector* d const char filechar[]="//files/subfile"; xmlXPathFreeObject(xpathObj); xpathObj = xmlXPathEvalExpression(BAD_CAST filechar, xpathCtx); - if (xpathObj==nullptr || xpathObj->nodesetval->nodeNr ==0) + if (xpathObj==0 || xpathObj->nodesetval->nodeNr ==0) throw INTERP_KERNEL::Exception("Xml Master File does not contain /MED/files/subfile nodes"); - int const nbfiles = xpathObj->nodesetval ->nodeNr; + int nbfiles = xpathObj->nodesetval ->nodeNr; for (int i=0; i<nbfiles;i++) { //reading information about the domain - std::string const host; + std::string host; //reading file names std::ostringstream name_search_string; name_search_string<<"//files/subfile[@id=\""<<i+1<<"\"]/name"; xmlXPathObjectPtr xpathObjfilename = xmlXPathEvalExpression(BAD_CAST name_search_string.str().c_str(),xpathCtx); - if (xpathObjfilename->nodesetval ==nullptr) + if (xpathObjfilename->nodesetval ==0) throw INTERP_KERNEL::Exception("Error retrieving a file name from subfile of Xml Master File"); MyGlobals::_File_Names[i]=(const char*)xpathObjfilename->nodesetval->nodeTab[0]->children->content; @@ -139,7 +141,7 @@ int MeshCollectionMedXmlDriver::read(const char* filename, ParaDomainSelector* d mesh_search_string<<"//mapping/mesh/chunk[@subdomain=\""<<i+1<<"\"]/name"; xmlXPathObjectPtr xpathMeshObj = xmlXPathEvalExpression(BAD_CAST mesh_search_string.str().c_str(),xpathCtx); - if (xpathMeshObj->nodesetval ==nullptr) + if (xpathMeshObj->nodesetval ==0) throw INTERP_KERNEL::Exception("Error retrieving mesh name from chunk of Xml Master File"); MyGlobals::_Mesh_Names[i]=(const char*)xpathMeshObj->nodesetval->nodeTab[0]->children->content; @@ -160,7 +162,7 @@ int MeshCollectionMedXmlDriver::read(const char* filename, ParaDomainSelector* d throw INTERP_KERNEL::Exception("I/O error reading parallel MED file"); } - auto* aPT = new ParallelTopology(_collection->getMesh()); + ParallelTopology* aPT = new ParallelTopology(_collection->getMesh()); //creation of topology from mesh and connect zones if ( _collection->isParallelMode() ) { @@ -180,18 +182,18 @@ int MeshCollectionMedXmlDriver::read(const char* filename, ParaDomainSelector* d */ void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* domainSelector) const { - xmlDocPtr master_doc = nullptr; - xmlNodePtr root_node = nullptr, node, node2; + xmlDocPtr master_doc = 0; + xmlNodePtr root_node = 0, node, node2; char buff[256]; //Creating the Xml document master_doc = xmlNewDoc(BAD_CAST "1.0"); - root_node = xmlNewNode(nullptr, BAD_CAST "root"); + root_node = xmlNewNode(0, BAD_CAST "root"); xmlDocSetRootElement(master_doc,root_node); //Creating child nodes // Version tag - node = xmlNewChild(root_node, nullptr, BAD_CAST "version",nullptr); + node = xmlNewChild(root_node, 0, BAD_CAST "version",0); xmlNewProp(node, BAD_CAST "maj", BAD_CAST "2"); xmlNewProp(node, BAD_CAST "min", BAD_CAST "3"); xmlNewProp(node, BAD_CAST "ver", BAD_CAST "1"); @@ -214,39 +216,39 @@ void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* ,st.wDay); #endif - node = xmlNewChild(root_node,nullptr, BAD_CAST "description",nullptr); + node = xmlNewChild(root_node,0, BAD_CAST "description",0); xmlNewProp(node, BAD_CAST "what", BAD_CAST _collection->getDescription().c_str()); xmlNewProp(node, BAD_CAST "when", BAD_CAST date); //Content tag - node =xmlNewChild(root_node,nullptr, BAD_CAST "content",nullptr); - node2 = xmlNewChild(node, nullptr, BAD_CAST "mesh",nullptr); + node =xmlNewChild(root_node,0, BAD_CAST "content",0); + node2 = xmlNewChild(node, 0, BAD_CAST "mesh",0); xmlNewProp(node2, BAD_CAST "name", BAD_CAST _collection->getName().c_str()); //Splitting tag - node=xmlNewChild(root_node,nullptr,BAD_CAST "splitting",nullptr); - node2=xmlNewChild(node,nullptr,BAD_CAST "subdomain",nullptr); + node=xmlNewChild(root_node,0,BAD_CAST "splitting",0); + node2=xmlNewChild(node,0,BAD_CAST "subdomain",0); sprintf(buff, "%d", (int)_collection->getMesh().size()); xmlNewProp(node2, BAD_CAST "number", BAD_CAST buff); - node2=xmlNewChild(node,nullptr,BAD_CAST "global_numbering",nullptr); + node2=xmlNewChild(node,0,BAD_CAST "global_numbering",0); xmlNewProp(node2, BAD_CAST "present", BAD_CAST "yes"); //Files tag - xmlNodePtr file_node=xmlNewChild(root_node,nullptr,BAD_CAST "files",nullptr); + xmlNodePtr file_node=xmlNewChild(root_node,0,BAD_CAST "files",0); //Mapping tag - node = xmlNewChild(root_node,nullptr,BAD_CAST "mapping",nullptr); - xmlNodePtr mesh_node = xmlNewChild(node, nullptr, BAD_CAST "mesh",nullptr); + node = xmlNewChild(root_node,0,BAD_CAST "mapping",0); + xmlNodePtr mesh_node = xmlNewChild(node, 0, BAD_CAST "mesh",0); xmlNewProp(mesh_node, BAD_CAST "name", BAD_CAST _collection->getName().c_str()); - int const nbdomains= _collection->getNbOfGlobalMeshes(); + int nbdomains= _collection->getNbOfGlobalMeshes(); //loop on the domains std::string finalMeshName=""; if (MyGlobals::_General_Informations.size()!=0) { - std::size_t const found=MyGlobals::_General_Informations[0].find("finalMeshName="); + std::size_t found=MyGlobals::_General_Informations[0].find("finalMeshName="); if ((found!=std::string::npos) && (found>0)) { finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName="); @@ -278,15 +280,15 @@ void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* if (domainSelector->rank()==0) { //updating the ascii description file - node = xmlNewChild(file_node, nullptr, BAD_CAST "subfile",nullptr); + node = xmlNewChild(file_node, 0, BAD_CAST "subfile",0); sprintf (buff,"%d",idomain+1); xmlNewProp(node, BAD_CAST "id", BAD_CAST buff); - xmlNewChild(node,nullptr,BAD_CAST "name",BAD_CAST distfilename.c_str()); - xmlNewChild(node,nullptr,BAD_CAST "machine",BAD_CAST "localhost"); + xmlNewChild(node,0,BAD_CAST "name",BAD_CAST distfilename.c_str()); + xmlNewChild(node,0,BAD_CAST "machine",BAD_CAST "localhost"); - node = xmlNewChild(mesh_node,nullptr, BAD_CAST "chunk",nullptr); + node = xmlNewChild(mesh_node,0, BAD_CAST "chunk",0); xmlNewProp(node, BAD_CAST "subdomain", BAD_CAST buff); - xmlNewChild(node,nullptr,BAD_CAST "name", BAD_CAST finalMeshName.c_str()); + xmlNewChild(node,0,BAD_CAST "name", BAD_CAST finalMeshName.c_str()); //xmlNewChild(node,0,BAD_CAST "name", BAD_CAST ((_collection->getMesh())[idomain]->getName()).c_str()); } } diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx index adcc4cc6a..5b6ca6022 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx @@ -22,7 +22,6 @@ #include "MEDPARTITIONER.hxx" #include "MEDPARTITIONER_MeshCollectionDriver.hxx" -#include <string> namespace MEDPARTITIONER { @@ -31,9 +30,9 @@ namespace MEDPARTITIONER { public: MeshCollectionMedXmlDriver(MeshCollection*); - ~MeshCollectionMedXmlDriver() override = default; - int read(const char*, ParaDomainSelector* sel=nullptr) override; - void write(const char*, ParaDomainSelector* sel=nullptr) const override; + virtual ~MeshCollectionMedXmlDriver() { } + int read(const char*, ParaDomainSelector* sel=0); + void write(const char*, ParaDomainSelector* sel=0) const; private : std::string _master_filename; }; diff --git a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx index a8901a970..e9a339acb 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx @@ -18,15 +18,13 @@ // #include "MEDPARTITIONER_MetisGraph.hxx" -#include "MCIdType.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" #include "MEDPARTITIONER_Utils.hxx" #include "MEDCouplingSkyLineArray.hxx" +#include "InterpKernelException.hxx" #include <iostream> -#include <string> -#include <vector> extern "C" { @@ -45,11 +43,12 @@ METISGraph::METISGraph(MEDCoupling::MEDCouplingSkyLineArray* graph, int* edgewei } METISGraph::~METISGraph() -= default; +{ +} void METISGraph::partGraph(int ndomain, const std::string& options_string, - ParaDomainSelector * /*parallelizer*/) + ParaDomainSelector *parallelizer) { using std::vector; if (MyGlobals::_Verbose>10) @@ -70,7 +69,7 @@ void METISGraph::partGraph(int ndomain, //constraints int * vwgt=_cell_weight; int * adjwgt=_edge_weight; - int wgtflag=(_edge_weight!=nullptr)?1:0+(_cell_weight!=nullptr)?2:0; + int wgtflag=(_edge_weight!=0)?1:0+(_cell_weight!=0)?2:0; //base 0 or 1 int base=0; //ndomain diff --git a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.hxx b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.hxx index fb8ab7339..79ed24cd2 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.hxx @@ -31,9 +31,9 @@ namespace MEDPARTITIONER { public: METISGraph(); - METISGraph(MEDCoupling::MEDCouplingSkyLineArray*, int *edgeweight=nullptr); - ~METISGraph() override; - void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=nullptr) override; + METISGraph(MEDCoupling::MEDCouplingSkyLineArray*, int *edgeweight=0); + virtual ~METISGraph(); + void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0); }; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx index 1c737c3c7..b97847c84 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx @@ -18,18 +18,15 @@ // #include "MEDPARTITIONER_PTScotchGraph.hxx" -#include "MEDPARTITIONER_Graph.hxx" #include "MEDPARTITIONER_Utils.hxx" -#include "MCIdType.hxx" #include "MEDCouplingSkyLineArray.hxx" #include "MEDCouplingMemArray.hxx" #include "MCType.hxx" -#include "scotch.h" #include <cstdio> +#include <memory> #include <mpi.h> -#include <string> #ifdef MED_ENABLE_PTSCOTCH extern "C" @@ -47,9 +44,10 @@ PTSCOTCHGraph::PTSCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray *graph, int *e } PTSCOTCHGraph::~PTSCOTCHGraph() -= default; +{ +} -void PTSCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* /*sel*/) +void PTSCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* sel) { if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : PTSCOTCHGraph::partGraph" << std::endl; @@ -57,10 +55,10 @@ void PTSCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Pa //number of graph vertices int n = FromIdType<int>(_graph->getNumberOf()); //graph - auto * xadj=const_cast<mcIdType*>(_graph->getIndex()); - auto * adjncy=const_cast<mcIdType*>(_graph->getValues()); + mcIdType * xadj=const_cast<mcIdType*>(_graph->getIndex()); + mcIdType * adjncy=const_cast<mcIdType*>(_graph->getValues()); //ndomain - int const nparts=ndomain; + int nparts=ndomain; #if !defined(MED_ENABLE_PTSCOTCH) throw INTERP_KERNEL::Exception("PTSCOTCHGraph::partGraph : PTSCOTCH is not available. Check your products, please."); @@ -97,13 +95,13 @@ void PTSCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Pa n, // vertlocnbr , nb of local graph nodes n, // vertlocmax , should be set to vertlocnbr for graphs without holes xadj, // vertloctab[vertnbr+1] , index vertex table - nullptr, // vendloctab , index end vertex table if disjoint, set to zero + 0, // vendloctab , index end vertex table if disjoint, set to zero cellWeightPtr, // veloloctab , graph vertices loads, set to zero vlbloctab, // vlblocltab , vertex label array : global vertex index xadj[n], // edgelocnbr , number of edges xadj[n], // edgelocsiz , same as edgelocnbr if edgeloctab is compact adjncy, // edgeloctab[edgelocnbr], global indexes of edges - nullptr, // edgegsttab , optional, should be computed internally, set to zero + 0, // edgegsttab , optional, should be computed internally, set to zero edgeWeightPtr); // edloloctab , graph edges loads, set to zero SCOTCH_Strat scotch_strategy; diff --git a/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.hxx b/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.hxx index 53c4420ed..b7aea8507 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.hxx @@ -35,10 +35,10 @@ namespace MEDPARTITIONER class MEDPARTITIONER_EXPORT PTSCOTCHGraph : public Graph { public: - PTSCOTCHGraph() = default; - PTSCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray* , int *edgeweight=nullptr, DataArrayIdType *vlbloctab=nullptr); - ~PTSCOTCHGraph() override; - void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=nullptr) override; + PTSCOTCHGraph() { } + PTSCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray* , int *edgeweight=0, DataArrayIdType *vlbloctab=0); + virtual ~PTSCOTCHGraph(); + void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=0); protected: MEDCoupling::DataArrayIdType *_vlbloctab; }; diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx index a679f47b8..3c0378d6e 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx @@ -18,7 +18,6 @@ // #include "MEDPARTITIONER_ParMetisGraph.hxx" -#include "MCIdType.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" #include "MEDPARTITIONER_Utils.hxx" @@ -26,8 +25,6 @@ #include "InterpKernelException.hxx" #include <iostream> -#include <string> -#include <vector> #ifdef MED_ENABLE_PARMETIS #include <parmetis.h> @@ -48,11 +45,12 @@ ParMETISGraph::ParMETISGraph(MEDCoupling::MEDCouplingSkyLineArray* graph, int* e } ParMETISGraph::~ParMETISGraph() -= default; +{ +} void ParMETISGraph::partGraph(int ndomain, - const std::string& /*options_string*/, - ParaDomainSelector * /*parallelizer*/) + const std::string& options_string, + ParaDomainSelector *parallelizer) { using std::vector; vector<int> ran,vx,va; //for randomize @@ -61,7 +59,7 @@ void ParMETISGraph::partGraph(int ndomain, std::cout << "proc " << MyGlobals::_Rank << " : ParMETISGraph::partGraph" << std::endl; // number of graph vertices - int const n=FromIdType<int>(_graph->getNumberOf()); + int n=FromIdType<int>(_graph->getNumberOf()); //graph #ifdef MEDCOUPLING_USE_64BIT_IDS std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() ); @@ -75,11 +73,11 @@ void ParMETISGraph::partGraph(int ndomain, //constraints int * vwgt=_cell_weight; int * adjwgt=_edge_weight; - int const wgtflag=(_edge_weight!=nullptr)?1:0+(_cell_weight!=nullptr)?2:0; + int wgtflag=(_edge_weight!=0)?1:0+(_cell_weight!=0)?2:0; //base 0 or 1 - int const base=0; + int base=0; //ndomain - int const nparts=ndomain; + int nparts=ndomain; //options /* (0=default_option,option,random_seed) see defs.h @@ -89,7 +87,7 @@ void ParMETISGraph::partGraph(int ndomain, #define PMV3_OPTION_PSR 3 seems no changes int options[4]={1,0,33,0}; //test for a random seed of 33 */ - int const options[4]={0,0,0,0}; + int options[4]={0,0,0,0}; // output parameters int edgecut; #if !defined(MED_ENABLE_PARMETIS) diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.hxx b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.hxx index 8143e3067..1e9d97479 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.hxx @@ -31,9 +31,9 @@ namespace MEDPARTITIONER { public: ParMETISGraph(); - ParMETISGraph(MEDCoupling::MEDCouplingSkyLineArray*, int *edgeweight=nullptr); - ~ParMETISGraph() override; - void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=nullptr) override; + ParMETISGraph(MEDCoupling::MEDCouplingSkyLineArray*, int *edgeweight=0); + virtual ~ParMETISGraph(); + void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0); }; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx index b1cd85bd4..1f6b821a8 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx @@ -18,11 +18,7 @@ // #include "MEDPARTITIONER_ParaDomainSelector.hxx" -#include "MEDPARTITIONER_Graph.hxx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingPointSet.hxx" -#include "MEDCouplingMesh.hxx" +#include "MEDPARTITIONER_UserGraph.hxx" #include "MEDPARTITIONER_Utils.hxx" #include "MEDPARTITIONER_Utils.hxx" @@ -30,9 +26,8 @@ #include "MEDCouplingSkyLineArray.hxx" #include "MCIdType.hxx" -#include <cstddef> #include <iostream> -#include <linux/sysinfo.h> +#include <numeric> #ifdef HAVE_MPI @@ -81,7 +76,8 @@ MEDPARTITIONER::ParaDomainSelector::ParaDomainSelector(bool mesure_memory) } MEDPARTITIONER::ParaDomainSelector::~ParaDomainSelector() -= default; +{ +} /*! * \brief Return true if is running on different hosts @@ -96,9 +92,9 @@ bool MEDPARTITIONER::ParaDomainSelector::isOnDifferentHosts() const int size; MPI_Get_processor_name( name_here, &size); - int const next_proc = (rank() + 1) % nbProcs(); - int const prev_proc = (rank() - 1 + nbProcs()) % nbProcs(); - int const tag = 1111111; + int next_proc = (rank() + 1) % nbProcs(); + int prev_proc = (rank() - 1 + nbProcs()) % nbProcs(); + int tag = 1111111; MPI_Status status; MPI_Sendrecv((void*)&name_here[0], MPI_MAX_PROCESSOR_NAME, MPI_CHAR, next_proc, tag, @@ -226,7 +222,7 @@ void MEDPARTITIONER::ParaDomainSelector::gatherNbOf(const std::vector<MEDCouplin _nb_vert_of_procs[0] = 0; // base = 0 for (int i=0; i<nb_domains; ++i) { - int const rankk = getProcessorID(i); + int rankk = getProcessorID(i); _nb_vert_of_procs[rankk+1] += all_nb_elems[i*2]; } for (std::size_t i=1; i<_nb_vert_of_procs.size(); ++i) @@ -301,7 +297,7 @@ mcIdType MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const */ std::unique_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gatherGraph(const Graph* graph) const { - Graph* glob_graph = nullptr; + Graph* glob_graph = 0; evaluateMemory(); #ifdef HAVE_MPI @@ -314,8 +310,8 @@ std::unique_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gathe for ( std::size_t i = 1; i < _nb_vert_of_procs.size(); ++i ) index_size_of_proc[i-1] = FromIdType<int>(_nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ]); - mcIdType const index_size = 1 + _cell_shift_by_domain.back(); - auto *graph_index = new mcIdType[ index_size ]; + mcIdType index_size = 1 + _cell_shift_by_domain.back(); + mcIdType *graph_index = new mcIdType[ index_size ]; const mcIdType *index = graph->getGraph()->getIndex(); MCAuto< DataArrayInt > nb_vert_of_procs = FromIdTypeVec( _nb_vert_of_procs ); int *proc_index_displacement = nb_vert_of_procs->getPointer(); @@ -344,7 +340,7 @@ std::unique_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gathe // update graph_index for ( int i = 1; i < nbProcs(); ++i ) { - mcIdType const shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0]; + mcIdType shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0]; for ( int j = proc_index_displacement[i]; j < proc_index_displacement[i+1]; ++j ) graph_index[ j ] += shift; } @@ -353,8 +349,8 @@ std::unique_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gathe // Gather values // -------------- - mcIdType const value_size = graph_index[ index_size-1 ] - graph_index[ 0 ]; - auto *graph_value = new mcIdType[ value_size ]; + mcIdType value_size = graph_index[ index_size-1 ] - graph_index[ 0 ]; + mcIdType *graph_value = new mcIdType[ value_size ]; const mcIdType *value = graph->getGraph()->getValues(); MPI_Allgatherv((void*) value, // send local value @@ -370,7 +366,7 @@ std::unique_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gathe // Gather partition // ----------------- - auto * partition = new mcIdType[ _cell_shift_by_domain.back() ]; + mcIdType * partition = new mcIdType[ _cell_shift_by_domain.back() ]; const mcIdType* part = graph->getPart(); MPI_Allgatherv((void*) part, // send local partition @@ -413,7 +409,7 @@ void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( mcIdType nb_cell_pairs, if ( _nb_cell_pairs_by_joint.empty() ) _nb_cell_pairs_by_joint.resize( _nb_result_domains*(_nb_result_domains+1), 0); - int const joint_id = jointId( loc_domain, dist_domain ); + int joint_id = jointId( loc_domain, dist_domain ); _nb_cell_pairs_by_joint[ joint_id ] = nb_cell_pairs; } evaluateMemory(); @@ -429,7 +425,7 @@ mcIdType MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, in { evaluateMemory(); - int const joint_id = jointId( loc_domain, dist_domain ); + int joint_id = jointId( loc_domain, dist_domain ); return _nb_cell_pairs_by_joint[ joint_id ]; } @@ -471,12 +467,12 @@ mcIdType MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int lo // (got in gatherNbOf( MED_FACE )). evaluateMemory(); - mcIdType const total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back(); + mcIdType total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back(); mcIdType id = total_nb_faces + 1; if ( _nb_cell_pairs_by_joint.empty() ) throw INTERP_KERNEL::Exception("gatherNbCellPairs() must be called before"); - int const joint_id = jointId( loc_domain, dist_domain ); + int joint_id = jointId( loc_domain, dist_domain ); for ( int j = 0; j < joint_id; ++j ) id += _nb_cell_pairs_by_joint[ j ]; @@ -494,8 +490,8 @@ int *MEDPARTITIONER::ParaDomainSelector::exchangeSubentityIds( int loc_domain, i { int* loc_ids_dist = new int[ loc_ids_here.size()]; #ifdef HAVE_MPI - int const dest = getProcessorID( dist_domain ); - int const tag = 2002 + jointId( loc_domain, dist_domain ); + int dest = getProcessorID( dist_domain ); + int tag = 2002 + jointId( loc_domain, dist_domain ); MPI_Status status; MPI_Sendrecv((void*)&loc_ids_here[0], (int)loc_ids_here.size(), MPI_INT, dest, tag, (void*) loc_ids_dist, (int)loc_ids_here.size(), MPI_INT, dest, tag, @@ -567,12 +563,12 @@ void MEDPARTITIONER::ParaDomainSelector::sendMesh(const MEDCoupling::MEDCoupling if (mesh.getNumberOfCells()>0) //no sends if empty { - MEDCoupling::DataArrayIdType *v1Local=nullptr; - MEDCoupling::DataArrayDouble *v2Local=nullptr; + MEDCoupling::DataArrayIdType *v1Local=0; + MEDCoupling::DataArrayDouble *v2Local=0; //serialization of local mesh to send data to distant proc. mesh.serialize(v1Local,v2Local); int nbLocalElems=0; - mcIdType* ptLocal=nullptr; + mcIdType* ptLocal=0; if(v1Local) //if empty getNbOfElems() is 1! { nbLocalElems=FromIdType<int>(v1Local->getNbOfElems()); // if empty be 1! @@ -580,7 +576,7 @@ void MEDPARTITIONER::ParaDomainSelector::sendMesh(const MEDCoupling::MEDCoupling } MPI_Send(ptLocal, nbLocalElems, MPI_ID_TYPE, target, 1111, MPI_COMM_WORLD); int nbLocalElems2=0; - double *ptLocal2=nullptr; + double *ptLocal2=0; if(v2Local) //if empty be 0! { nbLocalElems2=FromIdType<int>(v2Local->getNbOfElems()); @@ -632,14 +628,14 @@ void MEDPARTITIONER::ParaDomainSelector::recvMesh(MEDCoupling::MEDCouplingUMesh* mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); int nbDistElem=0; - mcIdType *ptDist=nullptr; + mcIdType *ptDist=0; if(v1Distant) { nbDistElem=FromIdType<int>(v1Distant->getNbOfElems()); ptDist=v1Distant->getPointer(); } MPI_Recv(ptDist, nbDistElem, MPI_ID_TYPE, source,1111, MPI_COMM_WORLD, &status); - double *ptDist2=nullptr; + double *ptDist2=0; nbDistElem=0; if(v2Distant) { @@ -675,7 +671,7 @@ int MEDPARTITIONER::ParaDomainSelector::evaluateMemory() const int used_memory = 0; #if !defined WIN32 && !defined __APPLE__ struct sysinfo si; - int const err = sysinfo( &si ); + int err = sysinfo( &si ); if ( !err ) used_memory = (int)(( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024; #endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx index 232f63085..8502c693d 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx @@ -20,8 +20,8 @@ #ifndef __MEDPARTITIONER_PARADOMAINSELECTOR_HXX__ #define __MEDPARTITIONER_PARADOMAINSELECTOR_HXX__ -#include "MCIdType.hxx" #include "MEDPARTITIONER.hxx" +#include "MCType.hxx" #include <memory> #include <vector> diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx index 2a81568ff..cf607dfc6 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx @@ -30,8 +30,8 @@ #include "InterpKernelHashMap.hxx" #include "MCIdType.hxx" -#include <cstddef> -#include <utility> +#include <set> +#include <map> #include <vector> #include <iostream> @@ -99,7 +99,7 @@ void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSe for (int idomain=0; idomain<_nb_domain; idomain++) { _loc_to_glob[idomain].resize(_nb_cells[idomain]); - mcIdType const domainCellShift=domainSelector->getDomainCellShift(idomain); + mcIdType domainCellShift=domainSelector->getDomainCellShift(idomain); for (mcIdType i=0; i<_nb_cells[idomain]; i++) { mcIdType global=domainCellShift+i ; @@ -118,7 +118,7 @@ void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSe for (int idomain=0; idomain<_nb_domain; idomain++) { _node_loc_to_glob[idomain].resize(_nb_nodes[idomain]); - mcIdType const domainNodeShift=domainSelector->getDomainNodeShift(idomain); + mcIdType domainNodeShift=domainSelector->getDomainNodeShift(idomain); for (mcIdType i=0; i<_nb_nodes[idomain]; i++) { mcIdType global=domainNodeShift+i ; @@ -150,7 +150,7 @@ ParallelTopology::ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMe _nb_domain=(int)meshes.size(); mcIdType index_global=0; mcIdType index_node_global=0; - mcIdType const index_face_global=0; + mcIdType index_face_global=0; _nb_cells.resize(_nb_domain); _nb_nodes.resize(_nb_domain); @@ -230,7 +230,7 @@ ParallelTopology::ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMe for (mcIdType i=0; i< nb_node; i++) { mcIdType local= node_corresp[i*2]; - mcIdType const distant = node_corresp[i*2+1]; + mcIdType distant = node_corresp[i*2+1]; local2distant.insert(std::make_pair(local, std::make_pair(distant_ip,distant))); } } @@ -301,7 +301,7 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d int icellProc=0; //all cells of my domains are concatenated in part for (int iold=0; iold<oldTopology->nbDomain(); iold++) { - mcIdType const ioldNbCell=oldTopology->getCellNumber(iold); + mcIdType ioldNbCell=oldTopology->getCellNumber(iold); //std::cout<<"proc "<<MyGlobals::_Rank<<" : cell number old domain "<<iold<<" : "<<ioldNbCell<<std::endl; //if not my old domains getCellNumber is 0 std::vector<mcIdType> globalids(ioldNbCell); @@ -340,7 +340,7 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d int iGlobDom = FromIdType<int>(part[ iGlob ]); for ( mcIdType i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ ) { - mcIdType const iGlobNear = value[ i ]; + mcIdType iGlobNear = value[ i ]; if ( iGlob > iGlobNear ) continue; // treat ( iGlob, iGlobNear ) pair once int iGlobNearDom = FromIdType<int>(part[ iGlobNear ]); @@ -362,7 +362,7 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d std::vector< mcIdType > & corresp = cellCorresp[ idomain ][ idomainNear ]; if ( corresp.empty() ) continue; - auto* cz = new MEDPARTITIONER::ConnectZone(); + MEDPARTITIONER::ConnectZone* cz = new MEDPARTITIONER::ConnectZone(); cz->setName( "Connect Zone defined by MEDPARTITIONER" ); cz->setDistantDomainNumber( idomainNear ); cz->setLocalDomainNumber ( idomain ); @@ -375,10 +375,10 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d ParallelTopology::~ParallelTopology() { - for (auto & _connect_zone : _connect_zones) + for ( size_t i = 0; i < _connect_zones.size(); ++i ) { - delete _connect_zone; - _connect_zone = nullptr; + delete _connect_zones[i]; + _connect_zones[i] = 0; } _connect_zones.clear(); } @@ -564,7 +564,7 @@ void ParallelTopology::convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnode for (mcIdType inode=0; inode<nbnodes; inode++) { // cout <<" inode :"<<inode<< " global = "<<type_connectivity[type][inode]; - mcIdType const global = nodes[inode]; + mcIdType global = nodes[inode]; typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter; std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(global); for (mmiter it=range.first; it !=range.second; it++) diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.hxx b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.hxx index 45700c46c..13f9b3ee0 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.hxx @@ -20,14 +20,12 @@ #ifndef __MEDPARTITIONER_PARALLELTOPOLOGY_HXX__ #define __MEDPARTITIONER_PARALLELTOPOLOGY_HXX__ -#include "MCIdType.hxx" #include "MEDPARTITIONER.hxx" #include "MEDPARTITIONER_Topology.hxx" #include "InterpKernelHashMap.hxx" #include <set> -#include <utility> #include <vector> namespace MEDPARTITIONER @@ -49,118 +47,118 @@ namespace MEDPARTITIONER std::vector<mcIdType*>&, std::vector<mcIdType*>&); ParallelTopology(Graph* graph, Topology* oldTopology, int nbdomain, int mesh_dimension); - ~ParallelTopology() override; + ~ParallelTopology(); void setGlobalNumerotationDefault(ParaDomainSelector* domainSelector); /*! converts a list of global cell numbers * to a distributed array with local cell numbers */ - void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int*) override; - void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int) override; - void convertGlobalNodeListWithTwins(const mcIdType* face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) override; + void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int*); + void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int); + void convertGlobalNodeListWithTwins(const mcIdType* face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size); /*! converts a list of global node numbers * to a distributed array with local cell numbers */ - void convertGlobalCellList(const mcIdType*, mcIdType , mcIdType*, int *) override; + void convertGlobalCellList(const mcIdType*, mcIdType , mcIdType*, int *); /*! converts a list of global face numbers * to a distributed array with local face numbers */ - void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int *) override; - void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int) override; - void convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size) override; + void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int *); + void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int); + void convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size); /*! converting node global numberings to local numberings */ - void convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain) override; + void convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain); /*! converting node local numbering to global */ - mcIdType convertNodeToGlobal(int ip, mcIdType icell) const override { return _node_loc_to_glob[ip][icell]; } + mcIdType convertNodeToGlobal(int ip, mcIdType icell) const { return _node_loc_to_glob[ip][icell]; } /*! converting face local numbering to global */ - mcIdType convertFaceToGlobal(int ip, mcIdType iface) const override { return _face_loc_to_glob[ip][iface]; } + mcIdType convertFaceToGlobal(int ip, mcIdType iface) const { return _face_loc_to_glob[ip][iface]; } /*! converting cell global numbering to local */ - mcIdType convertCellToGlobal(int ip, mcIdType icell) const override { return _loc_to_glob[ip][icell]; } + mcIdType convertCellToGlobal(int ip, mcIdType icell) const { return _loc_to_glob[ip][icell]; } - void convertNodeToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const override + void convertNodeToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const { for (mcIdType i=0; i<n; i++) global[i]=_node_loc_to_glob[ip][local[i]]; } - void convertCellToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const override + void convertCellToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const { for (mcIdType i=0; i<n; i++) global[i]=_loc_to_glob[ip][local[i]]; } - void convertFaceToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const override + void convertFaceToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const { for (mcIdType i=0; i<n; i++) global[i]=_face_loc_to_glob[ip][local[i]]; } - int nbDomain() const override { return _nb_domain; } + int nbDomain() const { return _nb_domain; } - mcIdType nbCells() const override { return _nb_total_cells; } + mcIdType nbCells() const { return _nb_total_cells; } - mcIdType nbNodes() const override { return _nb_total_nodes; } + mcIdType nbNodes() const { return _nb_total_nodes; } - mcIdType nbCells( int idomain) const override { return _nb_cells[idomain]; } + mcIdType nbCells( int idomain) const { return _nb_cells[idomain]; } /*! retrieving number of nodes */ - mcIdType getNodeNumber(int idomain) const override { return _nb_nodes[idomain]; } + mcIdType getNodeNumber(int idomain) const { return _nb_nodes[idomain]; } - mcIdType getNodeNumber() const override; + mcIdType getNodeNumber() const; - void getNodeList(int idomain, mcIdType* list) const override; + void getNodeList(int idomain, mcIdType* list) const; /*! retrieving cell numbers after merging in parallel mode */ - std::vector<mcIdType> & getFusedCellNumbers(int idomain) override { return _cell_loc_to_glob_fuse[idomain]; } + std::vector<mcIdType> & getFusedCellNumbers(int idomain) { return _cell_loc_to_glob_fuse[idomain]; } - const std::vector<mcIdType>& getFusedCellNumbers(int idomain) const override { return _cell_loc_to_glob_fuse[idomain]; } + const std::vector<mcIdType>& getFusedCellNumbers(int idomain) const { return _cell_loc_to_glob_fuse[idomain]; } /*! retrieving face numbers after merging in parallel mode */ - std::vector<mcIdType> & getFusedFaceNumbers(int idomain) override { return _face_loc_to_glob_fuse[idomain]; } + std::vector<mcIdType> & getFusedFaceNumbers(int idomain) { return _face_loc_to_glob_fuse[idomain]; } - const std::vector<mcIdType>& getFusedFaceNumbers(int idomain) const override { return _face_loc_to_glob_fuse[idomain]; } + const std::vector<mcIdType>& getFusedFaceNumbers(int idomain) const { return _face_loc_to_glob_fuse[idomain]; } /*! retrieving number of nodes */ - mcIdType getCellNumber(int idomain) const override { return _nb_cells[idomain]; } + mcIdType getCellNumber(int idomain) const { return _nb_cells[idomain]; } mcIdType getCellDomainNumber(int global) const { return (_glob_to_loc.find(global)->second).first; } - void getCellList(int idomain, mcIdType* list) const override; + void getCellList(int idomain, mcIdType* list) const; - mcIdType getFaceNumber(int idomain) const override { return _nb_faces[idomain]; } + mcIdType getFaceNumber(int idomain) const { return _nb_faces[idomain]; } - mcIdType getFaceNumber() const override; + mcIdType getFaceNumber() const; - void getFaceList(int idomain, mcIdType* list) const override; + void getFaceList(int idomain, mcIdType* list) const; /*! converting a global cell number to a local representation (domain + local number) */ - std::pair<int,mcIdType> convertGlobalCell(mcIdType iglobal) const override { return _glob_to_loc.find(iglobal)->second; } + std::pair<int,mcIdType> convertGlobalCell(mcIdType iglobal) const { return _glob_to_loc.find(iglobal)->second; } - mcIdType convertGlobalFace(mcIdType iglobal, int idomain) override; + mcIdType convertGlobalFace(mcIdType iglobal, int idomain); - mcIdType convertGlobalNode(mcIdType iglobal, int idomain) override; + mcIdType convertGlobalNode(mcIdType iglobal, int idomain); - std::vector<MEDPARTITIONER::ConnectZone*>& getCZ() override; + std::vector<MEDPARTITIONER::ConnectZone*>& getCZ(); //adding a face to the topology - void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal) override; + void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal); //return max global face number - mcIdType getMaxGlobalFace() const override; + mcIdType getMaxGlobalFace() const; private: bool hasCellWithNodes( const MeshCollection&, int dom, const std::set<mcIdType>& nodes ); private: //mapping global -> local - using TGlob2DomainLoc = INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int, mcIdType>>; + typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> > TGlob2DomainLoc; TGlob2DomainLoc _glob_to_loc; TGlob2DomainLoc _node_glob_to_loc; @@ -174,7 +172,7 @@ namespace MEDPARTITIONER std::vector<std::vector <mcIdType> > _face_loc_to_glob_fuse; // glob nums after merging //mapping global -> local - using TGlob2LocsMap = INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int, mcIdType>>; + typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> > TGlob2LocsMap; TGlob2LocsMap _face_glob_to_loc; //mapping local -> global diff --git a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx index 97b2c6739..cbb451e2a 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx @@ -17,17 +17,13 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MCIdType.hxx" #include "MEDPARTITIONER_Graph.hxx" #include "MEDPARTITIONER_ScotchGraph.hxx" #include "MEDPARTITIONER_Utils.hxx" #include "MEDCouplingSkyLineArray.hxx" -#include <iostream> #include <cstdio> -#include <string> -#include <vector> #ifdef MED_ENABLE_SCOTCH extern "C" @@ -48,15 +44,16 @@ SCOTCHGraph::SCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray* graph, int* edgew } SCOTCHGraph::~SCOTCHGraph() -= default; +{ +} -void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* /*sel*/) +void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* sel) { if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : SCOTCHGraph::partGraph" << std::endl; //number of graph vertices - int const n = FromIdType<int>(_graph->getNumberOf()); + int n = FromIdType<int>(_graph->getNumberOf()); //graph #ifdef MEDCOUPLING_USE_64BIT_IDS std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() ); @@ -68,7 +65,7 @@ void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Par int * adjncy=const_cast<int*>(_graph->getValues()); #endif //ndomain - int const nparts=ndomain; + int nparts=ndomain; #if !defined(MED_ENABLE_SCOTCH) throw INTERP_KERNEL::Exception("SCOTCHGraph::partGraph : SCOTCH is not available. Check your products, please."); diff --git a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.hxx b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.hxx index de6015735..2db7ded55 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.hxx @@ -31,9 +31,9 @@ namespace MEDPARTITIONER { public: SCOTCHGraph(); - SCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray*, int* edgeweight=nullptr); - ~SCOTCHGraph() override; - void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=nullptr) override; + SCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray*, int* edgeweight=0); + virtual ~SCOTCHGraph(); + void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=0); }; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx b/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx index e61fa9d83..f7672817f 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx @@ -20,10 +20,10 @@ #ifndef __MEDPARTITIONER_TOPOLOGY_HXX__ #define __MEDPARTITIONER_TOPOLOGY_HXX__ -#include "MCIdType.hxx" #include "MEDPARTITIONER.hxx" +#include "MCType.hxx" -#include <utility> +#include <map> #include <vector> namespace MEDCoupling @@ -41,9 +41,9 @@ namespace MEDPARTITIONER class MEDPARTITIONER_EXPORT Topology { public: - Topology() = default; + Topology() { } Topology(std::vector<MEDCoupling::MEDCouplingUMesh*>, std::vector<MEDPARTITIONER::ConnectZone*>) { } - virtual ~Topology() = default; + virtual ~Topology() { } /*! converts a list of global cell numbers * to a distributed array with local cell numbers diff --git a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx index 88a9862cd..35136b2ef 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx @@ -17,14 +17,12 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MCIdType.hxx" #include "MEDPARTITIONER_Graph.hxx" #include "MEDPARTITIONER_UserGraph.hxx" #include "MEDCouplingSkyLineArray.hxx" #include <iostream> -#include <string> #include <vector> using namespace MEDPARTITIONER; @@ -34,7 +32,7 @@ using namespace MEDPARTITIONER; * (domain numbers range from 0 to ndomain-1 * \param n number of cells in the mesh */ -UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, mcIdType n):Graph(array,nullptr) +UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, mcIdType n):Graph(array,0) { std::vector<mcIdType> index(n+1),value(n); @@ -51,9 +49,10 @@ UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *par } UserGraph::~UserGraph() -= default; +{ +} -void UserGraph::partGraph(int /*ndomain*/, const std::string& /*options*/, ParaDomainSelector* /*sel*/) +void UserGraph::partGraph(int ndomain, const std::string& options, ParaDomainSelector* sel) { std::cerr << "MEDPARTITIONER::UserGraph::partGraph() should not have to be used" << std::endl; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx index 2450f52df..ff93ed32d 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx @@ -20,7 +20,6 @@ #ifndef __MEDPARTITIONER_USERGRAPH_HXX__ #define __MEDPARTITIONER_USERGRAPH_HXX__ -#include "MCIdType.hxx" #include "MEDPARTITIONER.hxx" #include "MEDPARTITIONER_Graph.hxx" @@ -32,8 +31,8 @@ namespace MEDPARTITIONER { public: UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const int*, mcIdType); - ~UserGraph() override; - void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector *sel=nullptr) override; + virtual ~UserGraph(); + void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector *sel=0); }; } #endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx index cbdb56c6b..1b85e136e 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx @@ -19,32 +19,22 @@ #include "MEDPARTITIONER_Utils.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "BBTree.txx" #include "MEDLoader.hxx" #include "MEDLoaderBase.hxx" +#include "MEDFileUtilities.hxx" +#include "CellModel.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "InterpKernelException.hxx" #include "MCAuto.hxx" #include "InterpKernelAutoPtr.hxx" -#include "med.h" -#include "medfile.h" -#include "medfield.h" -#include <cstdlib> -#include <algorithm> +#include <fstream> #include <iostream> #include <iomanip> -#include <map> #include <sstream> #include <string> #include <cstring> -#include <vector> -#include <utility> using namespace MEDPARTITIONER; @@ -123,8 +113,8 @@ std::vector<int> MEDPARTITIONER::CreateRandomSize(const int size) srand( MyGlobals::_Randomize ); for (int i=0; i<size; i++) { - int const ii=rand()%size; - int const tmp=res[ii]; + int ii=rand()%size; + int tmp=res[ii]; res[ii]=res[i]; res[i]=tmp; } @@ -141,20 +131,20 @@ void MEDPARTITIONER::RandomizeAdj(int* xadj, int* adjncy, std::vector<int>& ran, std::cerr << "MEDPARTITIONER::RandomizeAdj only works on one proc!" << std::endl; return; } - std::size_t const size=ran.size(); + std::size_t size=ran.size(); std::vector<int> invran(size); for (unsigned int i=0; i<size; i++) invran[ran[i]]=i; vx.resize(size+1); - int const lga=xadj[size]; + int lga=xadj[size]; va.resize(lga); int jj=0; vx[0]=0; for (std::size_t i=0; i<size; i++) { - int const ir=ran[i]; + int ir=ran[i]; int ii=xadj[ir]; - int const lgj=xadj[ir+1]-ii; + int lgj=xadj[ir+1]-ii; for (int j=0; j<lgj; j++) { va[jj]=invran[adjncy[ii]]; @@ -171,7 +161,7 @@ void MEDPARTITIONER::TestRandomize() //int adjncy[13]={1,4,0,2,4,1,3,4,2,4,4,3,4}; int xadj[6]={0,2,5,9,12,13}; int adjncy[13]={0,0,1,1,1,2,2,2,2,3,3,3,4}; - int const size=5; + int size=5; std::vector<int> r=CreateRandomSize(size); std::vector<int> vx,va; RandomizeAdj(&xadj[0],&adjncy[0],r,vx,va); @@ -182,8 +172,8 @@ std::string MEDPARTITIONER::ReprVectorOfString(const std::vector<std::string>& v if (vec.size()==0) return std::string(" NONE\n"); std::ostringstream oss; - for (const auto & i : vec) - oss << " -> '" << i << "'" << std::endl; + for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i) + oss << " -> '" << *i << "'" << std::endl; return oss.str(); } @@ -192,8 +182,8 @@ std::string MEDPARTITIONER::ReprVectorOfString(const std::vector<std::string>& v if (vec.size()==0) return std::string(" NONE\n"); std::ostringstream oss; - for (const auto & i : vec) - oss << separator << i; + for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i) + oss << separator << *i; return oss.str(); } @@ -202,8 +192,8 @@ std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map<std::string,mcIdTy if (mymap.size()==0) return std::string(" NONE\n"); std::ostringstream oss; - for (const auto & i : mymap) - oss << " -> [" << i.first << "]=" << i.second << std::endl; + for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) + oss << " -> [" << (*i).first << "]=" << (*i).second << std::endl; return oss.str(); } @@ -212,8 +202,8 @@ std::string MEDPARTITIONER::ReprMapOfStringVectorOfString(const std::map< std::s if (mymap.size()==0) return std::string(" NONE\n"); std::ostringstream oss; - for (const auto & i : mymap) - oss << " -> [" << i.first << "]=" << std::endl << ReprVectorOfString(i.second) << std::endl; + for (std::map< std::string,std::vector<std::string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) + oss << " -> [" << (*i).first << "]=" << std::endl << ReprVectorOfString((*i).second) << std::endl; return oss.str(); } @@ -222,10 +212,10 @@ std::string MEDPARTITIONER::ReprFieldDescriptions(const std::vector<std::string> if (vec.size()==0) return std::string(" NONE\n"); std::ostringstream oss; - for (const auto & i : vec) + for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i) { oss << " ->"; - oss << ReprVectorOfString(DeserializeToVectorOfString(i), separator) << std::endl; + oss << ReprVectorOfString(DeserializeToVectorOfString(*i), separator) << std::endl; } return oss.str(); } @@ -248,8 +238,8 @@ std::string MEDPARTITIONER::SerializeFromString(const std::string& s) std::string MEDPARTITIONER::SerializeFromVectorOfString(const std::vector<std::string>& vec) { std::ostringstream oss; - for (const auto & i : vec) - oss<< std::setw(5) << i.size() << "/" << i << "/"; + for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i) + oss<< std::setw(5) << (*i).size() << "/" << *i << "/"; return oss.str(); } @@ -260,7 +250,7 @@ std::vector<std::string> MEDPARTITIONER::DeserializeToVectorOfString(const std:: { std::vector<std::string> res; std::size_t pos=0; - std::size_t const posmax=str.size(); + std::size_t posmax=str.size(); if (posmax==0) return res; //empty vector std::size_t length; @@ -281,12 +271,12 @@ std::vector<std::string> MEDPARTITIONER::DeserializeToVectorOfString(const std:: std::string MEDPARTITIONER::EraseTagSerialized(const std::string& fromStr, const std::string& tag) { - std::vector<std::string> const vec=DeserializeToVectorOfString(fromStr); + std::vector<std::string> vec=DeserializeToVectorOfString(fromStr); std::vector<std::string> res; - for (const auto & i : vec) + for (std::size_t i=0; i<vec.size(); i++) { - if (i.find(tag)==std::string::npos) - res.push_back(i); + if (vec[i].find(tag)==std::string::npos) + res.push_back(vec[i]); } return MEDPARTITIONER::SerializeFromVectorOfString(res); } @@ -298,10 +288,10 @@ std::string MEDPARTITIONER::EraseTagSerialized(const std::string& fromStr, const std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map<std::string,mcIdType>& mymap) { std::vector<std::string> res; - for (const auto & i : mymap) + for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) { std::ostringstream oss; - oss << i.second << "/" << i.first; + oss << (*i).second << "/" << (*i).first; res.push_back(oss.str()); } return res; @@ -313,18 +303,18 @@ std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringInt(const std:: std::map<std::string,mcIdType> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string>& vec) { std::map<std::string,mcIdType> res; - for (const auto & i : vec) + for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i) { - std::size_t const pos=0; - std::size_t const posmax=i.size(); - std::size_t const found=i.find('/'); //first slash + std::size_t pos=0; + std::size_t posmax=(*i).size(); + std::size_t found=(*i).find('/'); //first slash if ((found==std::string::npos) || (found<1)) throw INTERP_KERNEL::Exception("Error aIntNumber/anyString is expected"); mcIdType second; - std::istringstream iss(i.substr(pos,found)); + std::istringstream iss((*i).substr(pos,found)); iss >> second; - std::string const first=i.substr(pos+found+1,posmax-found); - auto const it=res.find(first); + std::string first=(*i).substr(pos+found+1,posmax-found); + std::map<std::string,mcIdType>::iterator it=res.find(first); if (it!=res.end()) if ((*it).second!=second) throw INTERP_KERNEL::Exception("Error not the same map value"); @@ -341,11 +331,11 @@ std::map<std::string,mcIdType> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap) { std::vector<std::string> res; - for (const auto & i : mymap) + for (std::map< std::string,std::vector<std::string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) { - std::vector<std::string> vs=i.second; //a vector of string; + std::vector<std::string> vs=(*i).second; //a vector of string; std::ostringstream oss; - oss << "Keymap/" << i.first << "/" << i.second.size(); + oss << "Keymap/" << (*i).first << "/" << (*i).second.size(); vs.insert(vs.begin(), oss.str()); res.push_back(SerializeFromVectorOfString(vs)); } @@ -359,20 +349,20 @@ std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringVectorOfString( std::map< std::string,std::vector<std::string> > MEDPARTITIONER::DevectorizeToMapOfStringVectorOfString(const std::vector<std::string>& vec) { std::map< std::string,std::vector<std::string> > res; - for (const auto & i : vec) + for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i) { - std::vector<std::string> vs=DeserializeToVectorOfString(i); + std::vector<std::string> vs=DeserializeToVectorOfString(*i); - std::string const enTete=vs[0]; - std::size_t const posmax=enTete.size(); - std::size_t const foundKey=enTete.find("Keymap/"); - std::size_t const foundSizeVector=enTete.find_last_of('/'); + std::string enTete=vs[0]; + std::size_t posmax=enTete.size(); + std::size_t foundKey=enTete.find("Keymap/"); + std::size_t foundSizeVector=enTete.find_last_of('/'); if ((foundKey==std::string::npos) || (foundKey!=0) || ((foundKey+7)>=foundSizeVector)) throw INTERP_KERNEL::Exception("Error Keymap/anyString/aIntNumber is expected"); int sizeVector; std::istringstream iss(enTete.substr(foundSizeVector+1,posmax-foundSizeVector)); iss >> sizeVector; - std::string const keymap=enTete.substr(foundKey+7,foundSizeVector-foundKey-7); + std::string keymap=enTete.substr(foundKey+7,foundSizeVector-foundKey-7); for (int ii=1; ii<=sizeVector; ii++) res[keymap].push_back(vs[ii]); //add unconditionally,so merge duplicates in second vector } @@ -388,9 +378,9 @@ std::vector<std::string> MEDPARTITIONER::SelectTagsInVectorOfString(const std::v std::vector<std::string> res; if (vec.size()==0) return res; - for (const auto & i : vec) + for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i) { - if (i.find(tag)!=std::string::npos) res.push_back(i); + if ((*i).find(tag)!=std::string::npos) res.push_back(*i); } return res; } @@ -404,18 +394,18 @@ std::vector<std::string> MEDPARTITIONER::DeleteDuplicatesInVectorOfString(const if (vec.size()==0) return res; //shit for unique and unique_copy for the duplicate CONSECUTIVE elements //I do not want to sort - for (const auto & i : vec) + for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i) { bool found=false; - for (const auto & re : res) + for (std::vector<std::string>::const_iterator j=res.begin(); j!=res.end(); ++j) { - if (i.compare(re)==0) + if ((*i).compare(*j)==0) { found=true; break; } } - if (!found) res.push_back(i); + if (!found) res.push_back(*i); } return res; } @@ -423,8 +413,8 @@ std::vector<std::string> MEDPARTITIONER::DeleteDuplicatesInVectorOfString(const std::map< std::string,std::vector<std::string> > MEDPARTITIONER::DeleteDuplicatesInMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap) { std::map< std::string,std::vector<std::string> > res; - for (const auto & i : mymap) - res[i.first]=DeleteDuplicatesInVectorOfString(i.second); + for (std::map< std::string,std::vector<std::string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) + res[(*i).first]=DeleteDuplicatesInVectorOfString((*i).second); return res; } @@ -439,8 +429,8 @@ std::string MEDPARTITIONER::Cle1ToStr(const std::string& s, const int inew) void MEDPARTITIONER::Cle1ToData(const std::string& key, std::string& s, int& inew) { - std::size_t const posmax=key.size(); - std::size_t const found=key.find(' '); + std::size_t posmax=key.size(); + std::size_t found=key.find(' '); if ((found==std::string::npos) || (found<1)) throw INTERP_KERNEL::Exception("Error 'aStringWithoutWhitespace aInt' is expected"); s=key.substr(0,found); @@ -457,8 +447,8 @@ std::string MEDPARTITIONER::Cle2ToStr(const std::string& s, const int inew, cons void MEDPARTITIONER::Cle2ToData(const std::string& key, std::string& s, int& inew, int& iold) { - std::size_t const posmax=key.size(); - std::size_t const found=key.find(' '); + std::size_t posmax=key.size(); + std::size_t found=key.find(' '); if ((found==std::string::npos) || (found<1)) throw INTERP_KERNEL::Exception("Error 'aStringWithoutWhitespace aInt aInt' is expected"); s=key.substr(0,found); @@ -489,7 +479,7 @@ std::string MEDPARTITIONER::ExtractFromDescription(const std::string& descriptio res=res.substr(0,found); return res; } - std::size_t const lg=StrToInt(description.substr(found-6,found)); + std::size_t lg=StrToInt(description.substr(found-6,found)); beg+=tag.length(); return description.substr(beg,lg-tag.length()); } @@ -549,7 +539,7 @@ std::vector<std::string> MEDPARTITIONER::BrowseFieldDouble(const MEDCoupling::ME std::vector<std::string> res; if (fd->getArray()) { - std::size_t const nb=fd->getArray()->getNumberOfComponents(); + std::size_t nb=fd->getArray()->getNumberOfComponents(); res.push_back("nbComponents="); res.back()+=IntToStr((int)nb); for (unsigned int i=0; i<nb; i++) { @@ -570,31 +560,31 @@ std::vector<std::string> MEDPARTITIONER::BrowseFieldDouble(const MEDCoupling::ME std::vector<std::string> MEDPARTITIONER::BrowseAllFields(const std::string& myfile) { std::vector<std::string> res; - std::vector<std::string> const meshNames=MEDCoupling::GetMeshNames(myfile); + std::vector<std::string> meshNames=MEDCoupling::GetMeshNames(myfile); - for (const auto & meshName : meshNames) + for (std::size_t i=0; i<meshNames.size(); i++) { - std::vector<std::string> const fieldNames= - MEDCoupling::GetAllFieldNamesOnMesh(myfile,meshName); - for (const auto & fieldName : fieldNames) + std::vector<std::string> fieldNames= + MEDCoupling::GetAllFieldNamesOnMesh(myfile,meshNames[i]); + for (std::size_t j = 0; j < fieldNames.size(); j++) { - std::vector< MEDCoupling::TypeOfField > const typeFields= - MEDCoupling::GetTypesOfField(myfile, meshName, fieldName); - for (auto & typeField : typeFields) + std::vector< MEDCoupling::TypeOfField > typeFields= + MEDCoupling::GetTypesOfField(myfile, meshNames[i], fieldNames[j]); + for (std::size_t k = 0; k < typeFields.size(); k++) { - std::vector< std::pair< int, int > > const its= - GetFieldIterations(typeField, myfile, meshName, fieldName); + std::vector< std::pair< int, int > > its= + GetFieldIterations(typeFields[k], myfile, meshNames[i], fieldNames[j]); if (MyGlobals::_Is0verbose>100) - std::cout<< "fieldName " << fieldName << " typeField " << typeField << " its.size() " << its.size() << std::endl; - for (auto & it : its) + std::cout<< "fieldName " << fieldNames[j] << " typeField " << typeFields[k] << " its.size() " << its.size() << std::endl; + for (std::size_t m = 0; m < its.size(); m++) { std::vector<std::string> resi; resi.push_back("fileName="); resi.back()+=myfile; - resi.push_back("meshName="); resi.back()+=meshName; - resi.push_back("fieldName="); resi.back()+=fieldName; - resi.push_back("typeField="); resi.back()+=IntToStr((int)typeField); - resi.push_back("DT="); resi.back()+=IntToStr((int)it.first); - resi.push_back("IT="); resi.back()+=IntToStr((int)it.second); + resi.push_back("meshName="); resi.back()+=meshNames[i]; + resi.push_back("fieldName="); resi.back()+=fieldNames[j]; + resi.push_back("typeField="); resi.back()+=IntToStr((int)typeFields[k]); + resi.push_back("DT="); resi.back()+=IntToStr((int)its[m].first); + resi.push_back("IT="); resi.back()+=IntToStr((int)its[m].second); res.push_back(SerializeFromVectorOfString(resi)); } } @@ -603,7 +593,7 @@ std::vector<std::string> MEDPARTITIONER::BrowseAllFields(const std::string& myfi return res; } -std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, const char * /*meshName*/, const int idomain) +std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, const char *meshName, const int idomain) { const int lggeom=10; const med_geometry_type GEOMTYPE[lggeom]={ //MED_N_CELL_FIXED_GEO] = { @@ -681,8 +671,8 @@ std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, c }; std::vector<std::string> res; - med_idt const fid=MEDfileOpen(fileName,MED_ACC_RDONLY); - med_int const nbFields=MEDnField(fid); + med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + med_int nbFields=MEDnField(fid); if (MyGlobals::_Verbose>20) std::cout << "on filename " << fileName << " nbOfField " << nbFields << std::endl; // @@ -695,14 +685,14 @@ std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, c // for(int i=1; i<=nbFields; i++) { - med_int const ncomp=MEDfieldnComponent(fid,i); + med_int ncomp=MEDfieldnComponent(fid,i); INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1]; INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1]; med_int nbPdt; MEDfieldInfo(fid,i,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt); - std::string const curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); - std::string const curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); for (int k=1; k<=nbPdt; k++) { MEDfieldComputingStepInfo(fid,nomcha,k,&numdt,&numo,&dt); @@ -715,16 +705,16 @@ std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, c for (int j=0; j<lggeom; j++) { med_int profilesize=0,nbi=0; - med_entity_type const enttype=ENTITYTYPE[ie]; + med_entity_type enttype=ENTITYTYPE[ie]; //enttype=MED_NODE;enttype=MED_CELL;enttype=MED_NODE_ELEMENT; char pflname[MED_NAME_SIZE+1]=""; char locname[MED_NAME_SIZE+1]=""; - med_int const nbofprofile=MEDfieldnProfile(fid,nomcha,numdt,numo,enttype,GEOMTYPE[j],pflname,locname); - int const profileit=1; + med_int nbofprofile=MEDfieldnProfile(fid,nomcha,numdt,numo,enttype,GEOMTYPE[j],pflname,locname); + int profileit=1; if (enttype==MED_NODE) { - med_geometry_type const mygeomtype=MED_UNDEF_ENTITY_TYPE; - med_int const nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,enttype,mygeomtype,profileit, + med_geometry_type mygeomtype=MED_UNDEF_ENTITY_TYPE; + med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,enttype,mygeomtype,profileit, MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi); if (nbOfVal>0) { @@ -755,8 +745,8 @@ std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, c } else { - med_geometry_type const mygeomtype=GEOMTYPE[j]; - med_int const nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,enttype,mygeomtype,profileit, + med_geometry_type mygeomtype=GEOMTYPE[j]; + med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,enttype,mygeomtype,profileit, MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi); if (nbOfVal>0) { @@ -874,7 +864,7 @@ namespace MEDPARTITIONER _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 1 >; break; default: - _tree=nullptr; + _tree=0; throw INTERP_KERNEL::Exception("BBTreeOfDim(): wrong space dimension"); } } @@ -887,13 +877,13 @@ namespace MEDPARTITIONER void BBTreeOfDim::getElementsAroundPoint( const double* coordsPtr, std::vector<mcIdType>& elems ) const { - auto* me = (BBTreeOfDim*) this; + BBTreeOfDim* me = (BBTreeOfDim*) this; (me->*_PgetElementsAroundPoint) ( coordsPtr, elems ); } void BBTreeOfDim::getIntersectingElems(const double* bb, std::vector<mcIdType>& elems) const { - auto* me = (BBTreeOfDim*) this; + BBTreeOfDim* me = (BBTreeOfDim*) this; (me->*_PgetIntersectingElems) ( bb, elems ); } } diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx index e2b069333..5fa75974e 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx @@ -20,17 +20,11 @@ #ifndef __MEDPARTITIONER_UTILS_HXX__ #define __MEDPARTITIONER_UTILS_HXX__ -#include "MCIdType.hxx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingMesh.hxx" -#include "MCAuto.hxx" #include "MEDPARTITIONER.hxx" #include "MEDCouplingUMesh.hxx" #include "BBTree.txx" -#include <cstddef> #include <string> #include <vector> #include <map> diff --git a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx index 1fc7c1825..3fcc686e5 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx @@ -17,19 +17,24 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDPARTITIONER_Utils.hxx" #include "MEDLoader.hxx" +#include "MEDLoaderBase.hxx" +#include "MEDFileUtilities.hxx" +#include "CellModel.hxx" +#include "MEDCouplingUMesh.hxx" +#include "MEDCouplingFieldDouble.hxx" #include "InterpKernelException.hxx" +#include "MCAuto.hxx" +#include "MEDCouplingMemArray.txx" +#include "InterpKernelAutoPtr.hxx" -#include <cstddef> +#include <fstream> #include <iostream> #include <iomanip> #include <sstream> #include <string> -#include <vector> #ifdef HAVE_MPI @@ -51,14 +56,14 @@ using namespace MEDPARTITIONER; */ std::vector<std::string> MEDPARTITIONER::SendAndReceiveVectorOfString(const std::vector<std::string>& vec, const int source, const int target) { - int const rank=MyGlobals::_Rank; + int rank=MyGlobals::_Rank; MPI_Status status; - int const tag = 111001; + int tag = 111001; if (rank == source) { - std::string const str=SerializeFromVectorOfString(vec); - int const size=(int)str.length(); + std::string str=SerializeFromVectorOfString(vec); + int size=(int)str.length(); MPI_Send( &size, 1, MPI_INT, target, tag, MPI_COMM_WORLD ); MPI_Send( (void*)str.data(), (int)str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD ); } @@ -67,7 +72,7 @@ std::vector<std::string> MEDPARTITIONER::SendAndReceiveVectorOfString(const std: if (rank == target) { MPI_Recv(&recSize, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status); - std::string const recData(recSize,'x'); + std::string recData(recSize,'x'); MPI_Recv((void*)recData.data(), recSize, MPI_CHAR, source, tag+100, MPI_COMM_WORLD, &status); return DeserializeToVectorOfString(recData); //not empty one for target proc } @@ -83,11 +88,11 @@ std::vector<std::string> MEDPARTITIONER::AllgathervVectorOfString(const std::vec if (MyGlobals::_World_Size==1) //nothing to do return vec; - int const world_size=MyGlobals::_World_Size; + int world_size=MyGlobals::_World_Size; std::string str=SerializeFromVectorOfString(vec); std::vector<int> indexes(world_size); - int const size=(int)str.length(); + int size=(int)str.length(); MPI_Allgather(&size, 1, MPI_INT, &indexes[0], 1, MPI_INT, MPI_COMM_WORLD); @@ -118,7 +123,7 @@ std::vector<std::string> MEDPARTITIONER::AllgathervVectorOfString(const std::vec */ void MEDPARTITIONER::SendDoubleVec(const std::vector<double>& vec, const int target) { - int const tag = 111002; + int tag = 111002; int size=(int)vec.size(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDoubleVec " << size << std::endl; @@ -136,7 +141,7 @@ void MEDPARTITIONER::SendDoubleVec(const std::vector<double>& vec, const int tar */ std::vector<double>* MEDPARTITIONER::RecvDoubleVec(const int source) { - int const tag = 111002; + int tag = 111002; int size; #ifdef HAVE_MPI MPI_Status status; @@ -152,7 +157,7 @@ std::vector<double>* MEDPARTITIONER::RecvDoubleVec(const int source) void MEDPARTITIONER::RecvDoubleVec(std::vector<double>& vec, const int source) { - int const tag = 111002; + int tag = 111002; int size; #ifdef HAVE_MPI MPI_Status status; @@ -170,7 +175,7 @@ void MEDPARTITIONER::RecvDoubleVec(std::vector<double>& vec, const int source) */ void MEDPARTITIONER::SendIntVec(const std::vector<mcIdType>& vec, const int target) { - int const tag = 111003; + int tag = 111003; int size=(int)vec.size(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendIntVec " << size << std::endl; @@ -187,7 +192,7 @@ void MEDPARTITIONER::SendIntVec(const std::vector<mcIdType>& vec, const int targ */ std::vector<int> *MEDPARTITIONER::RecvIntVec(const int source) { - int const tag = 111003; + int tag = 111003; int size; #ifdef HAVE_MPI MPI_Status status; @@ -203,7 +208,7 @@ std::vector<int> *MEDPARTITIONER::RecvIntVec(const int source) void MEDPARTITIONER::RecvIntVec(std::vector<mcIdType>& vec, const int source) { - int const tag = 111003; + int tag = 111003; int size; #ifdef HAVE_MPI MPI_Status status; @@ -223,9 +228,9 @@ void MEDPARTITIONER::RecvIntVec(std::vector<mcIdType>& vec, const int source) */ void MEDPARTITIONER::SendDataArrayInt(const MEDCoupling::DataArrayInt *da, const int target) { - if (da==nullptr) + if (da==0) throw INTERP_KERNEL::Exception("Problem send DataArrayInt* NULL"); - int const tag = 111004; + int tag = 111004; int size[3]; size[0]=(int)da->getNbOfElems(); size[1]=(int)da->getNumberOfTuples(); @@ -246,7 +251,7 @@ void MEDPARTITIONER::SendDataArrayInt(const MEDCoupling::DataArrayInt *da, const */ MEDCoupling::DataArrayInt *MEDPARTITIONER::RecvDataArrayInt(const int source) { - int const tag = 111004; + int tag = 111004; int size[3]; #ifdef HAVE_MPI MPI_Status status; @@ -271,9 +276,9 @@ MEDCoupling::DataArrayInt *MEDPARTITIONER::RecvDataArrayInt(const int source) */ void MEDPARTITIONER::SendDataArrayDouble(const MEDCoupling::DataArrayDouble *da, const int target) { - if (da==nullptr) + if (da==0) throw INTERP_KERNEL::Exception("Problem send DataArrayDouble* NULL"); - int const tag = 111005; + int tag = 111005; int size[3]; size[0]=(int)da->getNbOfElems(); size[1]=(int)da->getNumberOfTuples(); @@ -294,7 +299,7 @@ void MEDPARTITIONER::SendDataArrayDouble(const MEDCoupling::DataArrayDouble *da, */ MEDCoupling::DataArrayDouble* MEDPARTITIONER::RecvDataArrayDouble(const int source) { - int const tag = 111005; + int tag = 111005; int size[3]; #ifdef HAVE_MPI MPI_Status status; @@ -383,7 +388,7 @@ void MEDPARTITIONER::TestVectorOfStringMpi() void MEDPARTITIONER::TestMapOfStringIntMpi() { - int const rank=MyGlobals::_Rank; + int rank=MyGlobals::_Rank; std::map<std::string,mcIdType> myMap; myMap["one"]=1; myMap["two"]=22; //a bug @@ -413,7 +418,7 @@ void MEDPARTITIONER::TestMapOfStringIntMpi() void MEDPARTITIONER::TestMapOfStringVectorOfStringMpi() { - int const rank=MyGlobals::_Rank; + int rank=MyGlobals::_Rank; std::vector<std::string> myVector; std::ostringstream oss; oss << "hello from " << std::setw(5) << MyGlobals::_Rank << " " << std::string(rank+1,'n') << " next is an empty one"; @@ -459,13 +464,13 @@ void MEDPARTITIONER::TestMapOfStringVectorOfStringMpi() void MEDPARTITIONER::TestDataArrayMpi() { - int const rank=MyGlobals::_Rank; + int rank=MyGlobals::_Rank; //int { MEDCoupling::DataArrayInt* send=MEDCoupling::DataArrayInt::New(); - MEDCoupling::DataArrayInt* recv=nullptr; - int const nbOfTuples=5; - int const numberOfComponents=3; + MEDCoupling::DataArrayInt* recv=0; + int nbOfTuples=5; + int numberOfComponents=3; send->alloc(nbOfTuples,numberOfComponents); std::vector<int> vals; for (int j=0; j<nbOfTuples; j++) @@ -492,9 +497,9 @@ void MEDPARTITIONER::TestDataArrayMpi() //double { MEDCoupling::DataArrayDouble* send=MEDCoupling::DataArrayDouble::New(); - MEDCoupling::DataArrayDouble* recv=nullptr; - int const nbOfTuples=5; - int const numberOfComponents=3; + MEDCoupling::DataArrayDouble* recv=0; + int nbOfTuples=5; + int numberOfComponents=3; send->alloc(nbOfTuples,numberOfComponents); std::vector<double> vals; for (int j=0; j<nbOfTuples; j++) @@ -523,9 +528,9 @@ void MEDPARTITIONER::TestDataArrayMpi() void MEDPARTITIONER::TestPersistantMpi0To1(int taille, int nb) { double temps_debut=MPI_Wtime(); - int const rank=MyGlobals::_Rank; + int rank=MyGlobals::_Rank; std::vector<int> x, y; - int const tag=111111; + int tag=111111; MPI_Request requete0, requete1; MPI_Status statut; int ok=0; @@ -653,10 +658,10 @@ void MEDPARTITIONER::TestPersistantMpiRing(int taille, int nb) void MEDPARTITIONER::TestPersistantMpiRingOnCommSplit(int size, int nb) { double temps_debut=MPI_Wtime(); - int const rank=MyGlobals::_Rank; + int rank=MyGlobals::_Rank; MPI_Comm newcomm; int color=1; - int const rankMax=4; + int rankMax=4; if (rank>=rankMax) color=MPI_UNDEFINED; //MPI_Comm_dup (MPI_COMM_WORLD, &newcomm) ; diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index be29070d2..f9816ce69 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -19,10 +19,6 @@ #include "MEDPARTITIONERTest.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" #include "MEDPARTITIONER_MeshCollection.hxx" #include "MEDPARTITIONER_ParallelTopology.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" @@ -31,21 +27,21 @@ #include "CellModel.hxx" #include "MEDFileMesh.hxx" #include "MEDLoader.hxx" +#include "MEDLoaderBase.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingMemArray.txx" +#include "MEDCouplingMemArray.hxx" #include "MEDCouplingMultiFields.hxx" -#include "NormalizedGeometricTypes" #include <cppunit/TestAssert.h> -#include <iostream> -#include <memory> +#include <sstream> #include <fstream> #include <cmath> +#include <list> +#include <stdexcept> #include <cstdlib> -#include <string> #include <vector> #ifdef WIN32 #include<direct.h> @@ -106,7 +102,7 @@ std::string MEDPARTITIONERTest::getPartitionerExe() const if (my_file.good()) return execName; } - execName = getcwd(nullptr, 0); + execName = getcwd(NULL, 0); #ifndef WIN32 execName += "/../../MEDPartitioner/medpartitioner"; #else @@ -235,7 +231,7 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() std::copy(conn.begin()+i*8,conn.begin()+(i+1)*8,onehexa); if (false) //(_verbose) { - for (long const j : onehexa) cout<<j<<" "; + for (int j=0; j<8; j++) cout<<onehexa[j]<<" "; cout<<endl; } mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,onehexa); @@ -259,13 +255,13 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh() for (int j=0; j<=_nj; j++) for (int i=0; i<=_ni; i++) { - int const k=j; + int k=j; coor.push_back(i+.1); coor.push_back(j+.2); coor.push_back(k+.3); } int ii; - int const k=0; + int k=0; for (int j=0; j<_nj; j++) for (int i=0; i<_ni; i++) { @@ -303,7 +299,7 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh() std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa); if (false) //(_verbose) { - for (long const j : onequa) cout<<j<<" "; + for (int j=0; j<4; j++) cout<<onequa[j]<<" "; cout<<endl; } mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,onequa); @@ -327,13 +323,13 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh() for (int j=0; j<=_nj; j++) for (int i=0; i<=_ni; i++) { - int const k=0; + int k=0; coor.push_back(i+.1); coor.push_back(j+.2); coor.push_back(k+.3); } int ii; - int const k=0; + int k=0; for (int j=0; j<_nj; j++) for (int i=0; i<_ni; i++) { @@ -372,7 +368,7 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh() std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa); if (false) //(_verbose) { - for (long const j : onequa) cout<<j<<" "; + for (int j=0; j<4; j++) cout<<onequa[j]<<" "; cout<<endl; } mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,onequa); @@ -402,7 +398,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnCells(string myfileN } MEDCouplingUMesh *mesh=ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0); - mcIdType const nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); f1->setDescription("DescriptionOfFieldOnCells"); //not saved in file? @@ -435,7 +431,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnNodes() } MEDCouplingUMesh *mesh=ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0); - mcIdType const nbOfNodes=mesh->getNumberOfNodes(); + mcIdType nbOfNodes=mesh->getNumberOfNodes(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VectorFieldOnNodes"); f1->setDescription("DescriptionOfFieldOnNodes"); //not saved in file? @@ -607,7 +603,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int DataArrayDouble* coords=mesh->getCoords(); //int nbOfComp=coords->getNumberOfComponents(); //be 3D - mcIdType const nbOfTuple=coords->getNumberOfTuples(); + mcIdType nbOfTuple=coords->getNumberOfTuples(); double* ptr=coords->getPointer(); double* ptrini=ptrInit; for (mcIdType i=0; i<nbOfTuple; i++) @@ -694,10 +690,10 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells() //more nbptgauss=8 by default needs set MEDCouplingFieldDiscretizationPerCell //theory: (may be) http://www.code-aster.org/V2/doc/v9/fr/man_r/r3/r3.06.03.pdf - int const nbptgauss=8; //nb pt de gauss by cell - mcIdType const nbcell=f3->getMesh()->getNumberOfCells(); - mcIdType const nb=nbcell*nbptgauss; - int const nbcomp=2; + int nbptgauss=8; //nb pt de gauss by cell + mcIdType nbcell=f3->getMesh()->getNumberOfCells(); + mcIdType nb=nbcell*nbptgauss; + int nbcomp=2; array->alloc(nb,nbcomp); double *ptr=array->getPointer(); int ii=0; @@ -810,9 +806,9 @@ void MEDPARTITIONERTest::testMeshCollectionSingle() createTestMeshes(); MyGlobals::_World_Size=1; MyGlobals::_Rank=0; - string const fileName=_file_name_with_faces; + string fileName=_file_name_with_faces; MEDPARTITIONER::ParaDomainSelector parallelizer(false); - MEDPARTITIONER::MeshCollection const collection(fileName,parallelizer); + MEDPARTITIONER::MeshCollection collection(fileName,parallelizer); CPPUNIT_ASSERT(collection.isParallelMode()); CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension()); CPPUNIT_ASSERT(collection.getName()=="testMesh"); @@ -826,9 +822,9 @@ void MEDPARTITIONERTest::testMeshCollectionXml() { setSmallSize(); createHugeTestMesh(_ni, _nj, _nk, 2, 2, 2, 32); //xml but not so huge - string const fileName=_file_name_huge_xml; + string fileName=_file_name_huge_xml; MEDPARTITIONER::ParaDomainSelector parallelizer(false); - MEDPARTITIONER::MeshCollection const collection(fileName,parallelizer); + MEDPARTITIONER::MeshCollection collection(fileName,parallelizer); CPPUNIT_ASSERT(collection.isParallelMode()); CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension()); CPPUNIT_ASSERT(collection.getName()=="testMesh"); @@ -849,14 +845,14 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionMetis() setSmallSize(); createTestMeshes(); //MyGlobals::_Verbose=500; - string const fileName=_file_name_with_faces; - int const ndomains=2; + string fileName=_file_name_with_faces; + int ndomains=2; bool split_family=false; bool empty_groups=false; MEDPARTITIONER::ParaDomainSelector parallelizer(false); MEDPARTITIONER::MeshCollection collection(fileName,parallelizer); - auto* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology(); + MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology(); aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector()); //Creating the graph and partitioning it auto_ptr< MEDPARTITIONER::Topology > new_topo; @@ -883,13 +879,13 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionMetis() { setSmallSize(); createHugeTestMesh(_ni, _nj, _nk, 2, 2, 2, 32); //xml on 2*2*2 meshes but not so huge - string const fileName=_file_name_huge_xml; + string fileName=_file_name_huge_xml; bool split_family=false; bool empty_groups=false; MEDPARTITIONER::ParaDomainSelector parallelizer(false); MEDPARTITIONER::MeshCollection collection(fileName,parallelizer); - auto* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology(); + MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology(); aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector()); for (int ndomains=2 ; ndomains<=16 ; ndomains++) @@ -912,7 +908,7 @@ void MEDPARTITIONERTest::testMetisSmallSize() //#if !defined(HAVE_MPI) setSmallSize(); createTestMeshes(); - std::string const MetisOrScotch("metis"); + std::string MetisOrScotch("metis"); launchMetisOrScotchMedpartitionerOnTestMeshes(MetisOrScotch); verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(MetisOrScotch); verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnCells(MetisOrScotch); @@ -1081,15 +1077,15 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std std::vector<MEDCoupling::MEDCouplingUMesh*>cellMeshes=collection.getMesh(); CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size()); mcIdType nbcells=0; - for (auto & cellMeshe : cellMeshes) - nbcells+=cellMeshe->getNumberOfCells(); + for (std::size_t i = 0; i < cellMeshes.size(); i++) + nbcells+=cellMeshes[i]->getNumberOfCells(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); std::vector<MEDCoupling::MEDCouplingUMesh*>faceMeshes=collection.getFaceMesh(); CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size()); mcIdType nbfaces=0; - for (auto & faceMeshe : faceMeshes) - nbfaces+=faceMeshe->getNumberOfCells(); + for (std::size_t i=0; i < faceMeshes.size(); i++) + nbfaces+=faceMeshes[i]->getNumberOfCells(); CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces); //merge split meshes and test equality @@ -1222,8 +1218,8 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC mcIdType* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - std::size_t const i1=pc[i]*nbcomp; - std::size_t const i2=i*nbcomp; + std::size_t i1=pc[i]*nbcomp; + std::size_t i2=i*nbcomp; for (std::size_t j = 0; j < nbcomp; j++) { if (p1[i1+j]==p2[i2+j]) nbequal++; @@ -1304,15 +1300,15 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG } int nbequal=0; - int const nbptgauss=8; + int nbptgauss=8; std::size_t nbcomp=field1->getNumberOfComponents(); double* p1=f1->getPointer(); double* p2=f2->getPointer(); mcIdType* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - std::size_t const i1=pc[i]*nbcomp*nbptgauss; - std::size_t const i2=i*nbcomp*nbptgauss; + std::size_t i1=pc[i]*nbcomp*nbptgauss; + std::size_t i2=i*nbcomp*nbptgauss; for (std::size_t j = 0; j < nbcomp*nbptgauss; j++) { if (p1[i1+j]==p2[i2+j]) nbequal++; @@ -1424,7 +1420,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() const int ndomains = 4; ParaDomainSelector parallelizer(false); MeshCollection collection(fileName,parallelizer); - auto* aPT = (ParallelTopology*) collection.getTopology(); + ParallelTopology* aPT = (ParallelTopology*) collection.getTopology(); aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector()); std::unique_ptr< Topology > new_topo; diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx index 922a3f86f..dbec8117f 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx @@ -20,7 +20,6 @@ #ifndef __MEDPARTITIONERTEST_HXX__ #define __MEDPARTITIONERTEST_HXX__ -#include <cppunit/TestFixture.h> #ifdef WIN32 # if defined MEDPARTITIONERTEST_EXPORTS || defined MEDPARTITIONERTest_EXPORTS # define MEDPARTITIONERTEST_EXPORT __declspec( dllexport ) @@ -34,7 +33,9 @@ #include <cppunit/extensions/HelperMacros.h> +#include <set> #include <string> +#include <iostream> #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" @@ -117,8 +118,8 @@ public: void deleteTestMeshes(); //for CPPUNIT_TEST - void setUp() override; - void tearDown() override; + void setUp(); + void tearDown(); void testMeshCollectionSingle(); void testMeshCollectionXml(); #if defined(MED_ENABLE_METIS) diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx index 890ddc3bf..5649aa477 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx @@ -17,9 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDPARTITIONERTest.hxx" #include "MEDPARTITIONER_MeshCollection.hxx" @@ -27,8 +24,10 @@ #include "MEDPARTITIONER_ParaDomainSelector.hxx" #include "MEDPARTITIONER_Utils.hxx" +#include "CellModel.hxx" #include "MEDFileMesh.hxx" #include "MEDLoader.hxx" +#include "MEDLoaderBase.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" @@ -37,11 +36,12 @@ #include <cppunit/TestAssert.h> -#include <fstream> -#include <iostream> +#include <sstream> #include <cmath> +#include <list> +#include <stdexcept> #include <cstdlib> -#include <string> +#include <vector> #include <unistd.h> // get_current_dir_name() @@ -59,7 +59,7 @@ std::string MEDPARTITIONERTest::getPartitionerParaExe() const { execName=getenv("MEDCOUPLING_ROOT_DIR"); execName+="/bin/medpartitioner_para"; - std::ifstream const my_file(execName.c_str()); + std::ifstream my_file(execName.c_str()); if (my_file.good()) return execName; } @@ -92,7 +92,7 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForMesh() input=targetName+".xml"; MEDPARTITIONER::ParaDomainSelector parallelizer(false); - MEDPARTITIONER::MeshCollection const collection(input,parallelizer); + MEDPARTITIONER::MeshCollection collection(input,parallelizer); CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension()); std::vector<MEDCoupling::MEDCouplingUMesh*>cellMeshes=collection.getMesh(); CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size()); @@ -235,8 +235,8 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnCells() int* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - int const i1=pc[i]*nbcomp; - int const i2=i*nbcomp; + int i1=pc[i]*nbcomp; + int i2=i*nbcomp; for (int j = 0; j < nbcomp; j++) { if (p1[i1+j]==p2[i2+j]) nbequal++; @@ -316,15 +316,15 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() } int nbequal=0; - int const nbptgauss=8; + int nbptgauss=8; int nbcomp=field1->getNumberOfComponents(); double* p1=f1->getPointer(); double* p2=f2->getPointer(); int* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - int const i1=pc[i]*nbcomp*nbptgauss; - int const i2=i*nbcomp*nbptgauss; + int i1=pc[i]*nbcomp*nbptgauss; + int i2=i*nbcomp*nbptgauss; for (int j = 0; j < nbcomp*nbptgauss; j++) { if (p1[i1+j]==p2[i2+j]) nbequal++; diff --git a/src/MEDPartitioner/Test/TestMEDPARTITIONER.cxx b/src/MEDPartitioner/Test/TestMEDPARTITIONER.cxx index a95650853..ef9d8f10a 100644 --- a/src/MEDPartitioner/Test/TestMEDPARTITIONER.cxx +++ b/src/MEDPartitioner/Test/TestMEDPARTITIONER.cxx @@ -19,7 +19,6 @@ //include all MEDPARTITIONER Test #include "MEDPARTITIONERTest.hxx" -#include <cppunit/extensions/HelperMacros.h> //Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION( MEDPARTITIONERTest ); diff --git a/src/MEDPartitioner/medpartitioner.cxx b/src/MEDPartitioner/medpartitioner.cxx index 36f2fbe10..59198ebe9 100644 --- a/src/MEDPartitioner/medpartitioner.cxx +++ b/src/MEDPartitioner/medpartitioner.cxx @@ -33,22 +33,16 @@ #include "MEDPARTITIONER_Utils.hxx" */ -#include "InterpKernelException.hxx" #include "MEDPARTITIONER_MeshCollection.hxx" #include "MEDPARTITIONER_ParallelTopology.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" #include "MEDPARTITIONER_Utils.hxx" -#include <stdio.h> -#include <memory> -#include <cstdio> -#include <exception> #include <string> #include <fstream> #include <cstring> #include <cstdlib> #include <iostream> -#include <vector> using namespace std; using namespace MEDPARTITIONER; @@ -63,14 +57,14 @@ int main(int argc, char** argv) // Defining options // by parsing the command line - bool const split_family=false; - bool const empty_groups=false; + bool split_family=false; + bool empty_groups=false; bool mesure_memory=false; - bool const filter_face=true; + bool filter_face=true; string input; string output; - string const meshname; + string meshname; string library="metis"; //default int ndomains; int help=0; @@ -82,7 +76,7 @@ int main(int argc, char** argv) MyGlobals::_Create_Joints=0; // Primitive parsing of command-line options - string const desc ("Available options of medpartitioner V1.0:\n" + string desc ("Available options of medpartitioner V1.0:\n" "\t--help : produces this help message\n" "\t--verbose : echoes arguments\n" "\t--input-file=<string> : name of the input .med file or .xml master file\n" @@ -167,8 +161,8 @@ int main(int argc, char** argv) //testing whether it is possible to write a file at the specified location if (MyGlobals::_Rank==0) { - string const outputtest = output + ".testioms."; - ofstream const testfile (outputtest.c_str()); + string outputtest = output + ".testioms."; + ofstream testfile (outputtest.c_str()); if (testfile.fail()) { cerr << "output-file directory does not exist or is in read-only access" << endl; @@ -208,7 +202,7 @@ int main(int argc, char** argv) }*/ MEDPARTITIONER::ParaDomainSelector parallelizer(mesure_memory); MEDPARTITIONER::MeshCollection collection(input,parallelizer); - auto* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology(); + MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology(); aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector()); //to have unique valid fields names/pointers/descriptions for partitionning collection.prepareFieldDescriptions(); @@ -243,12 +237,12 @@ int main(int argc, char** argv) r2=SelectTagsInVectorOfString(r2,"meshName="); if (r2.size()==(collection.getMesh()).size()) { - for (auto & i : r2) - i=EraseTagSerialized(i,"ioldDomain="); + for (std::size_t i=0; i<r2.size(); i++) + r2[i]=EraseTagSerialized(r2[i],"ioldDomain="); r2=DeleteDuplicatesInVectorOfString(r2); if (r2.size()==1) { - string const finalMesh="finalMeshName="+ExtractFromDescription(r2[0], "meshName="); + string finalMesh="finalMeshName="+ExtractFromDescription(r2[0], "meshName="); finalInformations.push_back(SerializeFromString(finalMesh)); } } @@ -263,11 +257,11 @@ int main(int argc, char** argv) r2=SelectTagsInVectorOfString(r1,"fieldName="); r2=SelectTagsInVectorOfString(r2,"nbComponents="); //may be yes? or not? - for (auto & i : r2) - i=EraseTagSerialized(i,"ioldFieldDouble="); + for (std::size_t i=0; i<r2.size(); i++) + r2[i]=EraseTagSerialized(r2[i],"ioldFieldDouble="); r2=DeleteDuplicatesInVectorOfString(r2); - for (const auto & i : r2) - finalInformations.push_back(i); + for (std::size_t i=0; i<r2.size(); i++) + finalInformations.push_back(r2[i]); MyGlobals::_General_Informations=finalInformations; if (MyGlobals::_Is0verbose) diff --git a/src/MEDPartitioner/medpartitioner_para.cxx b/src/MEDPartitioner/medpartitioner_para.cxx index 33af294b4..9874f7717 100644 --- a/src/MEDPartitioner/medpartitioner_para.cxx +++ b/src/MEDPartitioner/medpartitioner_para.cxx @@ -39,10 +39,18 @@ */ +#include "MEDPARTITIONER_MeshCollection.hxx" +#include "MEDPARTITIONER_ParallelTopology.hxx" +#include "MEDPARTITIONER_ParaDomainSelector.hxx" #include "MEDPARTITIONER_Utils.hxx" +#include "MEDLoader.hxx" +#include <fstream> #include <iostream> +#include <iomanip> +#include <sstream> +#include <string> #include <cstring> #ifdef HAVE_MPI @@ -52,7 +60,7 @@ using namespace std; using namespace MEDPARTITIONER; -int main(int /*argc*/, char** /*argv*/) +int main(int argc, char** argv) { #if !defined(MED_ENABLE_PARMETIS) cout << "Sorry, no one split method is available. Please, compile with ParMETIS."<<endl; diff --git a/src/ParaMEDLoader/ParaMEDFileMesh.cxx b/src/ParaMEDLoader/ParaMEDFileMesh.cxx index 6e6e8e6bc..67d2c8829 100644 --- a/src/ParaMEDLoader/ParaMEDFileMesh.cxx +++ b/src/ParaMEDLoader/ParaMEDFileMesh.cxx @@ -19,22 +19,15 @@ // Author : Anthony Geay (EDF R&D) #include "ParaMEDFileMesh.hxx" -#include "InterpKernelAutoPtr.hxx" #include "MCAuto.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCType.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "MEDFileMesh.hxx" #include "MEDFileMeshLL.hxx" +#include "MEDLoader.hxx" #include "MEDFileField1TS.hxx" #include "MEDFileUtilities.hxx" #include "MEDFileEntities.hxx" -#include "med.h" -#include "NormalizedGeometricTypes" -#include "MEDLoader.hxx" -#include <string> +#include <iostream> +#include <fstream> // From MEDLOader.cxx TU @@ -174,7 +167,7 @@ MEDFileUMesh *ParaMEDFileUMesh::ParaNew(int iPart, int nbOfParts, const MPI_Comm * Loads mesh \a mName in parallel using a custom partition of the mesh cells among the processes. * See ParaMEDFileUMesh::ParaNew for detailed description. */ -MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, const MPI_Comm& com, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, const std::string& /*fileName*/, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, const MPI_Comm& com, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { MCAuto<MEDFileUMesh> ret; for(std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>::const_iterator iter=distrib.begin(); iter!= distrib.end(); iter++) diff --git a/src/ParaMEDLoader/ParaMEDFileMesh.hxx b/src/ParaMEDLoader/ParaMEDFileMesh.hxx index 10582e78a..b65763183 100644 --- a/src/ParaMEDLoader/ParaMEDFileMesh.hxx +++ b/src/ParaMEDLoader/ParaMEDFileMesh.hxx @@ -26,9 +26,11 @@ #include "mpi.h" #include <string> +#include <vector> +#include <map> +#include "MCIdType.hxx" #include "MEDCouplingRefCountObject.hxx" #include "NormalizedGeometricTypes" -#include "MCIdType.hxx" namespace MEDCoupling { @@ -41,16 +43,16 @@ namespace MEDCoupling class ParaMEDFileMesh { public: - static MEDFileMesh *New(int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - static MEDFileMesh *ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); + static MEDFileMesh *New(int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + static MEDFileMesh *ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); }; class ParaMEDFileUMesh { public: - static MEDFileUMesh *New(int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - static MEDFileUMesh *ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); - static MEDFileUMesh *ParaNew(const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>&, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=nullptr); + static MEDFileUMesh *New(int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + static MEDFileUMesh *ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + static MEDFileUMesh *ParaNew(const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>&, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); private: static MEDFileUMesh *NewPrivate(med_idt fid, int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); diff --git a/src/ParaMEDLoader/ParaMEDLoader.cxx b/src/ParaMEDLoader/ParaMEDLoader.cxx index 9155b069b..233461126 100644 --- a/src/ParaMEDLoader/ParaMEDLoader.cxx +++ b/src/ParaMEDLoader/ParaMEDLoader.cxx @@ -24,21 +24,21 @@ #include "BlockTopology.hxx" #include "MEDCouplingUMesh.hxx" -#include <cstddef> #include <fstream> #include <sstream> using namespace MEDCoupling; ParaMEDLoader::ParaMEDLoader() -= default; +{ +} void ParaMEDLoader::WriteParaMesh(const char *fileName, MEDCoupling::ParaMESH *mesh) { if(!mesh->getBlockTopology()->getProcGroup()->containsMyRank()) return ; - int const myRank=mesh->getBlockTopology()->getProcGroup()->myRank(); - int const nbDomains=mesh->getBlockTopology()->getProcGroup()->size(); + int myRank=mesh->getBlockTopology()->getProcGroup()->myRank(); + int nbDomains=mesh->getBlockTopology()->getProcGroup()->size(); std::vector<std::string> fileNames(nbDomains); for(int i=0;i<nbDomains;i++) { diff --git a/src/ParaMEDMEM/BlockTopology.cxx b/src/ParaMEDMEM/BlockTopology.cxx index 77cd48008..34051ef1e 100644 --- a/src/ParaMEDMEM/BlockTopology.cxx +++ b/src/ParaMEDMEM/BlockTopology.cxx @@ -18,21 +18,18 @@ // #include "BlockTopology.hxx" -#include "MCType.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingCMesh.hxx" #include "CommInterface.hxx" -#include "ParaIdType.hxx" #include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" #include "ComponentTopology.hxx" #include "InterpKernelUtilities.hxx" -#include <cstddef> +#include <vector> #include <algorithm> #include <utility> #include <iostream> -#include <vector> using namespace std; @@ -142,8 +139,8 @@ namespace MEDCoupling */ BlockTopology::BlockTopology(const ProcessorGroup& group, mcIdType nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false) { - auto* nbelems_per_proc = new mcIdType[group.size()]; - const auto* mpi_group=dynamic_cast<const MPIProcessorGroup*>(_proc_group); + mcIdType* nbelems_per_proc = new mcIdType[group.size()]; + const MPIProcessorGroup* mpi_group=dynamic_cast<const MPIProcessorGroup*>(_proc_group); const MPI_Comm* comm=mpi_group->getComm(); mcIdType nbtemp=nb_elem; mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_ID_TYPE, @@ -190,8 +187,8 @@ namespace MEDCoupling { int subdomain_id=0; mcIdType position=global; - mcIdType const size=_nb_elems; - std::size_t const size_procs=_proc_group->size(); + mcIdType size=_nb_elems; + std::size_t size_procs=_proc_group->size(); mcIdType increment=size; vector<mcIdType>axis_position(_dimension); vector<mcIdType>axis_offset(_dimension); @@ -200,8 +197,8 @@ namespace MEDCoupling std::size_t axis_size=_local_array_indices[idim].size()-1; mcIdType axis_nb_elem=_local_array_indices[idim][axis_size]; increment=increment/axis_nb_elem; - int const proc_increment = (int)(size_procs/axis_size); - mcIdType const axis_pos=position/increment; + int proc_increment = (int)(size_procs/axis_size); + mcIdType axis_pos=position/increment; position=position%increment; int iaxis=1; while (_local_array_indices[idim][iaxis]<=axis_pos) @@ -238,7 +235,7 @@ namespace MEDCoupling mcIdType axis_nb_elem=_local_array_indices[idim][axis_size]; increment=axis_nb_elem==0?0:increment/axis_nb_elem; proc_increment = proc_increment/axis_size; - std::size_t const proc_axis=subdomain_id/proc_increment; + std::size_t proc_axis=subdomain_id/proc_increment; subdomain_id=subdomain_id%proc_increment; mcIdType local_axis_nb_elem=_local_array_indices[idim][proc_axis+1]-_local_array_indices[idim][proc_axis]; local_increment = (local_axis_nb_elem==0)?0:(local_increment/local_axis_nb_elem); @@ -258,7 +255,7 @@ namespace MEDCoupling for (int i=_dimension-1; i>=0; i--) { increment *=_nb_procs_per_dim[i]; - int const idim=position%increment; + int idim=position%increment; position=position/increment; mcIdType imin=_local_array_indices[i][idim]; mcIdType imax=_local_array_indices[i][idim+1]; @@ -275,12 +272,12 @@ namespace MEDCoupling std::vector<std::pair<int,mcIdType> > BlockTopology::getLocalArrayMinMax() const { vector<pair<int,mcIdType> > local_indices (_dimension); - int const myrank=_proc_group->myRank(); + int myrank=_proc_group->myRank(); int increment=1; for (int i=_dimension-1; i>=0; i--) { increment *=_nb_procs_per_dim[i]; - int const idim=myrank%increment; + int idim=myrank%increment; local_indices[i].first=(int)_local_array_indices[i][idim]; local_indices[i].second=_local_array_indices[i][idim+1]; cout << local_indices[i].first << " "<< local_indices[i].second<<endl; @@ -308,7 +305,7 @@ namespace MEDCoupling //serializing the comm group mcIdType size_comm=_proc_group->size(); buffer.push_back(size_comm); - MPIProcessorGroup const world_group(_proc_group->getCommInterface()); + MPIProcessorGroup world_group(_proc_group->getCommInterface()); for (int i=0; i<size_comm;i++) { int world_rank=world_group.translateRank(_proc_group, i); @@ -343,7 +340,7 @@ namespace MEDCoupling _local_array_indices[i][j]=*(ptr_serializer++); } set<int> procs; - mcIdType const size_comm=*(ptr_serializer++); + mcIdType size_comm=*(ptr_serializer++); for (int i=0; i<size_comm; i++) procs.insert((int)*(ptr_serializer++)); diff --git a/src/ParaMEDMEM/BlockTopology.hxx b/src/ParaMEDMEM/BlockTopology.hxx index 7412ce3ed..c88a1261a 100644 --- a/src/ParaMEDMEM/BlockTopology.hxx +++ b/src/ParaMEDMEM/BlockTopology.hxx @@ -20,12 +20,9 @@ #ifndef __BLOCKTOPOLOGY_HXX__ #define __BLOCKTOPOLOGY_HXX__ -#include "MCType.hxx" -#include "CommInterface.hxx" #include "Topology.hxx" #include "ProcessorGroup.hxx" -#include <utility> #include <vector> namespace MEDCoupling @@ -52,13 +49,13 @@ namespace MEDCoupling BlockTopology(const ProcessorGroup& group, MEDCouplingCMesh *grid); BlockTopology(const BlockTopology& geom_topo, const ComponentTopology& comp_topo); BlockTopology(const ProcessorGroup& group, mcIdType nb_elem); - ~BlockTopology() override; + virtual ~BlockTopology(); void release(); //!Retrieves the number of elements for a given topology - mcIdType getNbElements()const override { return _nb_elems; } - mcIdType getNbLocalElements() const override; - const ProcessorGroup* getProcGroup()const override { return _proc_group; } + mcIdType getNbElements()const { return _nb_elems; } + mcIdType getNbLocalElements() const; + const ProcessorGroup* getProcGroup()const { return _proc_group; } std::pair<int,mcIdType> globalToLocal (const mcIdType) const ; mcIdType localToGlobal (const std::pair<int,mcIdType>) const; std::vector<std::pair<int,mcIdType> > getLocalArrayMinMax() const ; diff --git a/src/ParaMEDMEM/ByStringMPIProcessorGroup.cxx b/src/ParaMEDMEM/ByStringMPIProcessorGroup.cxx index fffb5e134..49f39e8a0 100644 --- a/src/ParaMEDMEM/ByStringMPIProcessorGroup.cxx +++ b/src/ParaMEDMEM/ByStringMPIProcessorGroup.cxx @@ -19,9 +19,9 @@ #include "ByStringMPIProcessorGroup.hxx" -#include <cstddef> -#include <string> -#include "MPIProcessorGroup.hxx" +#include <iostream> +#include <set> +#include <algorithm> #include "mpi.h" using namespace std; @@ -106,7 +106,8 @@ namespace MEDCoupling } ByStringMPIProcessorGroup::~ByStringMPIProcessorGroup() - = default; + { + } ByStringMPIProcessorGroup *ByStringMPIProcessorGroup::deepCopy() const { diff --git a/src/ParaMEDMEM/ByStringMPIProcessorGroup.hxx b/src/ParaMEDMEM/ByStringMPIProcessorGroup.hxx index 5e90bbd38..21bf13fdb 100644 --- a/src/ParaMEDMEM/ByStringMPIProcessorGroup.hxx +++ b/src/ParaMEDMEM/ByStringMPIProcessorGroup.hxx @@ -21,7 +21,6 @@ #define __BYSTRINGMPIPROCESSORGROUP_HXX__ #include "MPIProcessorGroup.hxx" -#include <string> namespace MEDCoupling { @@ -33,8 +32,8 @@ namespace MEDCoupling ByStringMPIProcessorGroup(const CommInterface& interface); ByStringMPIProcessorGroup(const CommInterface& interface, const std::string& simCodeTag, const MPI_Comm& world_comm=MPI_COMM_WORLD); ByStringMPIProcessorGroup(const ByStringMPIProcessorGroup& other); - ~ByStringMPIProcessorGroup() override; - ByStringMPIProcessorGroup *deepCopy() const override; + virtual ~ByStringMPIProcessorGroup(); + virtual ByStringMPIProcessorGroup *deepCopy() const; }; } diff --git a/src/ParaMEDMEM/CommInterface.cxx b/src/ParaMEDMEM/CommInterface.cxx index caadf1b00..04e3e8d42 100644 --- a/src/ParaMEDMEM/CommInterface.cxx +++ b/src/ParaMEDMEM/CommInterface.cxx @@ -18,9 +18,6 @@ // #include "CommInterface.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingMemArray.hxx" namespace MEDCoupling { diff --git a/src/ParaMEDMEM/CommInterface.hxx b/src/ParaMEDMEM/CommInterface.hxx index 2c34eaf41..3d52fe9a5 100644 --- a/src/ParaMEDMEM/CommInterface.hxx +++ b/src/ParaMEDMEM/CommInterface.hxx @@ -19,18 +19,13 @@ #pragma once -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingTraits.hxx" #include "ParaIdType.hxx" #include "MEDCouplingMemArray.hxx" -#include <limits> -#include <cstddef> #include <mpi.h> -#include <numeric> #include <memory> +#include <numeric> namespace MEDCoupling { @@ -95,8 +90,8 @@ namespace MEDCoupling class CommInterface { public: - CommInterface() = default; - virtual ~CommInterface() = default; + CommInterface() { } + virtual ~CommInterface() { } int worldSize() const { int size; MPI_Comm_size(MPI_COMM_WORLD, &size); diff --git a/src/ParaMEDMEM/ComponentTopology.cxx b/src/ParaMEDMEM/ComponentTopology.cxx index 53c55410f..b6895f7bb 100644 --- a/src/ParaMEDMEM/ComponentTopology.cxx +++ b/src/ParaMEDMEM/ComponentTopology.cxx @@ -19,6 +19,7 @@ #include "ComponentTopology.hxx" #include "ProcessorGroup.hxx" +#include "InterpolationUtils.hxx" namespace MEDCoupling { @@ -27,7 +28,7 @@ namespace MEDCoupling */ ComponentTopology::ComponentTopology(int nb_comp, ProcessorGroup* group):_proc_group(group) { - int const nb_blocks=group->size(); + int nb_blocks=group->size(); if (nb_blocks>nb_comp) throw INTERP_KERNEL::Exception("ComponentTopology Number of components must be larger than number of blocks"); @@ -45,7 +46,7 @@ namespace MEDCoupling /* Generic constructor for \a nb_comp components equally parted * in \a nb_blocks blocks */ - ComponentTopology::ComponentTopology(int nb_comp, int nb_blocks):_proc_group(nullptr) + ComponentTopology::ComponentTopology(int nb_comp, int nb_blocks):_proc_group(0) { if (nb_blocks>nb_comp) throw INTERP_KERNEL::Exception("ComponentTopology Number of components must be larger than number of blocks"); @@ -62,7 +63,7 @@ namespace MEDCoupling } //!Constructor for one block of \a nb_comp components - ComponentTopology::ComponentTopology(int nb_comp):_proc_group(nullptr) + ComponentTopology::ComponentTopology(int nb_comp):_proc_group(0) { _component_array.resize(2); @@ -72,7 +73,7 @@ namespace MEDCoupling } //! Constructor for one component - ComponentTopology::ComponentTopology():_proc_group(nullptr) + ComponentTopology::ComponentTopology():_proc_group(0) { _component_array.resize(2); _component_array[0]=0; @@ -81,15 +82,16 @@ namespace MEDCoupling } ComponentTopology::~ComponentTopology() - = default; + { + } int ComponentTopology::nbLocalComponents() const { - if (_proc_group==nullptr) + if (_proc_group==0) return nbComponents(); int nbcomp; - int const myrank = _proc_group->myRank(); + int myrank = _proc_group->myRank(); if (myrank!=-1) nbcomp = _component_array[myrank+1]-_component_array[myrank]; else @@ -99,11 +101,11 @@ namespace MEDCoupling int ComponentTopology::firstLocalComponent() const { - if (_proc_group==nullptr) + if (_proc_group==0) return 0; int icomp; - int const myrank = _proc_group->myRank(); + int myrank = _proc_group->myRank(); if (myrank!=-1) icomp = _component_array[myrank]; else diff --git a/src/ParaMEDMEM/DEC.cxx b/src/ParaMEDMEM/DEC.cxx index caf3b916b..1a6a4d615 100644 --- a/src/ParaMEDMEM/DEC.cxx +++ b/src/ParaMEDMEM/DEC.cxx @@ -17,13 +17,21 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#include "CommInterface.hxx" +#include "Topology.hxx" +#include "BlockTopology.hxx" +#include "ComponentTopology.hxx" +#include "ParaFIELD.hxx" +#include "ParaMESH.hxx" #include "DEC.hxx" +#include "ICoCoMEDDoubleField.hxx" +#include "MPIProcessorGroup.hxx" #include <cmath> namespace MEDCoupling { - DEC::DEC():_comm_interface(nullptr) + DEC::DEC():_comm_interface(0) { } @@ -33,5 +41,6 @@ namespace MEDCoupling } DEC::~DEC() - = default; + { + } } diff --git a/src/ParaMEDMEM/DEC.hxx b/src/ParaMEDMEM/DEC.hxx index 2a00bb7f5..672223bc0 100644 --- a/src/ParaMEDMEM/DEC.hxx +++ b/src/ParaMEDMEM/DEC.hxx @@ -20,6 +20,8 @@ #ifndef __DEC_HXX__ #define __DEC_HXX__ +#include "MEDCouplingFieldDouble.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "DECOptions.hxx" namespace MEDCoupling diff --git a/src/ParaMEDMEM/DECOptions.hxx b/src/ParaMEDMEM/DECOptions.hxx index 7c2ff78d4..e83afd8be 100644 --- a/src/ParaMEDMEM/DECOptions.hxx +++ b/src/ParaMEDMEM/DECOptions.hxx @@ -51,13 +51,16 @@ namespace MEDCoupling { protected: std::string _method; - bool _asynchronous{false}; - TimeInterpolationMethod _timeInterpolationMethod{WithoutTimeInterp}; - AllToAllMethod _allToAllMethod{Native}; - bool _forcedRenormalization{false}; + bool _asynchronous; + TimeInterpolationMethod _timeInterpolationMethod; + AllToAllMethod _allToAllMethod; + bool _forcedRenormalization; public: - DECOptions():_method("P0") - + DECOptions():_method("P0"), + _asynchronous(false), + _timeInterpolationMethod(WithoutTimeInterp), + _allToAllMethod(Native), + _forcedRenormalization(false) { } diff --git a/src/ParaMEDMEM/DisjointDEC.cxx b/src/ParaMEDMEM/DisjointDEC.cxx index 1fab3ca21..b213300bb 100644 --- a/src/ParaMEDMEM/DisjointDEC.cxx +++ b/src/ParaMEDMEM/DisjointDEC.cxx @@ -19,28 +19,26 @@ #include "DisjointDEC.hxx" #include "CommInterface.hxx" -#include "DEC.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MEDCouplingPointSet.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "Topology.hxx" +#include "BlockTopology.hxx" #include "ComponentTopology.hxx" #include "ParaFIELD.hxx" #include "ParaMESH.hxx" +#include "ICoCoField.hxx" #include "ICoCoMEDDoubleField.hxx" #include "MPIProcessorGroup.hxx" #include <cmath> +#include <iostream> namespace MEDCoupling { DisjointDEC::DisjointDEC(ProcessorGroup& source_group, ProcessorGroup& target_group): - _local_field(nullptr), + _local_field(0), _source_group(&source_group), _target_group(&target_group), - _comm_interface(nullptr), + _comm_interface(0), _owns_field(false), _owns_groups(false), _union_comm(MPI_COMM_NULL) @@ -51,11 +49,11 @@ namespace MEDCoupling DisjointDEC::DisjointDEC(const DisjointDEC& s): DEC(s), - _local_field(nullptr), - _union_group(nullptr), - _source_group(nullptr), - _target_group(nullptr), - _comm_interface(nullptr), + _local_field(0), + _union_group(0), + _source_group(0), + _target_group(0), + _comm_interface(0), _owns_field(false), _owns_groups(false), _union_comm(MPI_COMM_NULL) @@ -104,13 +102,13 @@ namespace MEDCoupling DisjointDEC::DisjointDEC(const std::set<int>& source_ids, const std::set<int>& target_ids, const MPI_Comm& world_comm): - _local_field(nullptr), - _comm_interface(nullptr), + _local_field(0), + _comm_interface(0), _owns_field(false), _owns_groups(true), _union_comm(MPI_COMM_NULL) { - MEDCoupling::CommInterface const comm; + MEDCoupling::CommInterface comm; // Create the list of procs including source and target std::set<int> union_ids; // source and target ids in world_comm union_ids.insert(source_ids.begin(),source_ids.end()); @@ -128,9 +126,9 @@ namespace MEDCoupling delete[] union_ranks_world; if (_union_comm==MPI_COMM_NULL) { // This process is not in union - _source_group=nullptr; - _target_group=nullptr; - _union_group=nullptr; + _source_group=0; + _target_group=0; + _union_group=0; comm.groupFree(&union_group); comm.groupFree(&world_group); return; @@ -199,8 +197,8 @@ namespace MEDCoupling void DisjointDEC::checkPartitionGroup() const { int size = -1; - auto * tgt = static_cast<MPIProcessorGroup *>(_target_group); - auto * src = static_cast<MPIProcessorGroup *>(_source_group); + MPIProcessorGroup * tgt = static_cast<MPIProcessorGroup *>(_target_group); + MPIProcessorGroup * src = static_cast<MPIProcessorGroup *>(_source_group); MPI_Comm comm_t = tgt->getWorldComm(); MPI_Comm comm_s = src->getWorldComm(); if (comm_t != comm_s) @@ -258,8 +256,8 @@ namespace MEDCoupling local_group=_target_group; else throw INTERP_KERNEL::Exception("Invalid procgroup for field attachment to DEC"); - auto *paramesh=new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())),*local_group,field->getMesh()->getName()); - auto *tmp=new ParaFIELD(field, paramesh, *local_group); + ParaMESH *paramesh=new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())),*local_group,field->getMesh()->getName()); + ParaFIELD *tmp=new ParaFIELD(field, paramesh, *local_group); tmp->setOwnSupport(true); attachLocalField(tmp,true); //_comm_interface=&(local_group->getCommInterface()); @@ -306,7 +304,7 @@ namespace MEDCoupling if (_source_group->containsMyRank()) for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) { - double const total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs); + double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs); double source_norm = total_norm; _comm_interface->broadcast(&source_norm, 1, MPI_DOUBLE, 0,* dynamic_cast<MPIProcessorGroup*>(_union_group)->getComm()); @@ -315,7 +313,7 @@ namespace MEDCoupling { for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) { - double const total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs); + double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs); double source_norm=total_norm; _comm_interface->broadcast(&source_norm, 1, MPI_DOUBLE, 0,* dynamic_cast<MPIProcessorGroup*>(_union_group)->getComm()); @@ -350,7 +348,7 @@ namespace MEDCoupling { if (_local_field) { - TypeOfField const entity = _local_field->getField()->getTypeOfField(); + TypeOfField entity = _local_field->getField()->getTypeOfField(); if ( getMethod() == "P0" ) { if ( entity != ON_CELLS ) diff --git a/src/ParaMEDMEM/DisjointDEC.hxx b/src/ParaMEDMEM/DisjointDEC.hxx index c44dd2868..dc53b31b5 100644 --- a/src/ParaMEDMEM/DisjointDEC.hxx +++ b/src/ParaMEDMEM/DisjointDEC.hxx @@ -21,7 +21,7 @@ #define __DISJOINTDEC_HXX__ #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingNatureOfFieldEnum" +#include "NormalizedUnstructuredMesh.hxx" #include "DEC.hxx" #include <mpi.h> @@ -69,8 +69,8 @@ namespace MEDCoupling class DisjointDEC : public DEC { public: - DisjointDEC():_local_field(nullptr),_union_group(nullptr),_source_group(nullptr),_target_group(nullptr), - _comm_interface(nullptr), + DisjointDEC():_local_field(0),_union_group(0),_source_group(0),_target_group(0), + _comm_interface(0), _owns_field(false),_owns_groups(false), _union_comm(MPI_COMM_NULL) { } @@ -79,7 +79,7 @@ namespace MEDCoupling DisjointDEC &operator=(const DisjointDEC& s); DisjointDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids, const MPI_Comm& world_comm=MPI_COMM_WORLD); - ~DisjointDEC() override; + virtual ~DisjointDEC(); void setNature(NatureOfField nature); void attachLocalField( MEDCouplingFieldDouble *field); @@ -90,8 +90,8 @@ namespace MEDCoupling virtual void prepareTargetDE() = 0; virtual void recvData() = 0; virtual void sendData() = 0; - void sendRecvData(bool way=true) override; - void synchronize() override = 0; + void sendRecvData(bool way=true); + virtual void synchronize() = 0; virtual void computeProcGroup() { } void renormalizeTargetField(bool isWAbs); diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index 408e2d5a7..cc2a90cd6 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -17,27 +17,22 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include <cstddef> #include <mpi.h> #include "CommInterface.hxx" #include "ElementLocator.hxx" -#include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MCType.hxx" -#include "ParaIdType.hxx" -#include "MEDCouplingMemArray.hxx" #include "Topology.hxx" +#include "BlockTopology.hxx" #include "ParaFIELD.hxx" #include "ParaMESH.hxx" #include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" +#include "MEDCouplingFieldDouble.hxx" #include "MCAuto.hxx" +#include "DirectedBoundingBox.hxx" -#include <limits> -#include <string> -#include <vector> -#include <set> #include <map> +#include <set> +#include <limits> using namespace std; @@ -67,7 +62,7 @@ namespace MEDCoupling const MPI_Comm *ElementLocator::getCommunicator() const { - auto* group=static_cast<MPIProcessorGroup*> (_union_group); + MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group); return group->getComm(); } @@ -88,7 +83,7 @@ namespace MEDCoupling MEDCouplingPointSet*& distant_mesh, mcIdType*& distant_ids) { - int const rank = _union_group->translateRank(&_distant_group,idistantrank); + int rank = _union_group->translateRank(&_distant_group,idistantrank); if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end()) return; @@ -105,7 +100,7 @@ namespace MEDCoupling #endif DataArrayIdType *distant_ids_send; - auto *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(elems->begin(),elems->end(),distant_ids_send); + MEDCouplingPointSet *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(elems->begin(),elems->end(),distant_ids_send); _exchangeMesh(send_mesh, distant_mesh, idistantrank, distant_ids_send, distant_ids); distant_ids_send->decrRef(); @@ -116,11 +111,11 @@ namespace MEDCoupling void ElementLocator::exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth) { CommInterface comm_interface=_union_group->getCommInterface(); - auto* group=static_cast<MPIProcessorGroup*> (_union_group); + MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group); const MPI_Comm* comm=(group->getComm()); MPI_Status status; // it must be converted to union numbering before communication - int const idistRankInUnion = group->translateRank(&_distant_group,idistantrank); + int idistRankInUnion = group->translateRank(&_distant_group,idistantrank); char *recv_buffer=new char[4]; std::vector<char> send_buffer(4); std::copy(sourceMeth.begin(),sourceMeth.end(),send_buffer.begin()); @@ -138,8 +133,8 @@ namespace MEDCoupling */ void ElementLocator::_computeBoundingBoxes() { - CommInterface const comm_interface =_union_group->getCommInterface(); - auto* group=static_cast<MPIProcessorGroup*> (_union_group); + CommInterface comm_interface =_union_group->getCommInterface(); + MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group); const MPI_Comm* comm = group->getComm(); _local_cell_mesh_space_dim = -1; if(_local_cell_mesh->getMeshDimension() != -1) @@ -166,9 +161,9 @@ namespace MEDCoupling if ( dbbData.size() < bbSize ) dbbData.resize(bbSize,0); double * minmax= &dbbData[0]; #else - int const bbSize = 2*_local_cell_mesh_space_dim; + int bbSize = 2*_local_cell_mesh_space_dim; _domain_bounding_boxes = new double[bbSize*_union_group->size()]; - auto * minmax=new double [bbSize]; + double * minmax=new double [bbSize]; if(_local_cell_mesh->getMeshDimension() != -1) _local_cell_mesh->getBoundingBox(minmax); else @@ -185,7 +180,7 @@ namespace MEDCoupling for (int i=0; i< _distant_group.size(); i++) { - int const rank=_union_group->translateRank(&_distant_group,i); + int rank=_union_group->translateRank(&_distant_group,i); if (_intersectsBoundingBox(rank)) { @@ -217,7 +212,7 @@ namespace MEDCoupling const double eps = 1e-12; for (int idim=0; idim < _local_cell_mesh_space_dim; idim++) { - bool const intersects = (distant_bb[idim*2]<local_bb[idim*2+1]+eps) + bool intersects = (distant_bb[idim*2]<local_bb[idim*2+1]+eps) && (local_bb[idim*2]<distant_bb[idim*2+1]+eps); if (!intersects) return false; } @@ -248,20 +243,20 @@ namespace MEDCoupling tinyInfoLocal.push_back(distant_ids_send->getNumberOfTuples()); tinyInfoDistant.resize(tinyInfoLocal.size()); std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0); - auto* group=static_cast<MPIProcessorGroup*> (_union_group); + MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group); const MPI_Comm* comm=group->getComm(); MPI_Status status; // iproc_distant is the number of proc in distant group // it must be converted to union numbering before communication - int const iprocdistant_in_union = group->translateRank(&_distant_group, + int iprocdistant_in_union = group->translateRank(&_distant_group, iproc_distant); comm_interface.sendRecv(&tinyInfoLocal[0], (int)tinyInfoLocal.size(), MPI_ID_TYPE, iprocdistant_in_union, 1112, &tinyInfoDistant[0], (int)tinyInfoDistant.size(), MPI_ID_TYPE,iprocdistant_in_union,1112, *comm, &status); - DataArrayIdType *v1Local=nullptr; - DataArrayDouble *v2Local=nullptr; + DataArrayIdType *v1Local=0; + DataArrayDouble *v2Local=0; DataArrayIdType *v1Distant=DataArrayIdType::New(); DataArrayDouble *v2Distant=DataArrayDouble::New(); //serialization of local mesh to send data to distant proc. @@ -336,7 +331,7 @@ namespace MEDCoupling { policy.resize(_distant_proc_ids.size()); int procId=0; - CommInterface const comm; + CommInterface comm; MPI_Status status; for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { @@ -352,7 +347,7 @@ namespace MEDCoupling void ElementLocator::sendSumToLazySideW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds) { int procId=0; - CommInterface const comm; + CommInterface comm; for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { const vector<mcIdType>& eltIds=distantLocEltIds[procId]; @@ -370,7 +365,7 @@ namespace MEDCoupling void ElementLocator::recvSumFromLazySideW(std::vector< std::vector<double> >& globalSumRelToDistantIds) { int procId=0; - CommInterface const comm; + CommInterface comm; MPI_Status status; for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { @@ -385,7 +380,7 @@ namespace MEDCoupling void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds) { int procId=0; - CommInterface const comm; + CommInterface comm; for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { const vector<mcIdType>& eltIds=distantLocEltIds[procId]; @@ -401,7 +396,7 @@ namespace MEDCoupling void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, std::vector< std::vector<mcIdType> >& globalIds) { int procId=0; - CommInterface const comm; + CommInterface comm; MPI_Status status; globalIds.resize(_distant_proc_ids.size()); for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) @@ -419,7 +414,7 @@ namespace MEDCoupling void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<mcIdType> >& globalIds) { int procId=0; - CommInterface const comm; + CommInterface comm; MPI_Status status; globalIds.resize(_distant_proc_ids.size()); for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) @@ -438,7 +433,7 @@ namespace MEDCoupling void ElementLocator::sendPartialSumToLazyProcsW(const std::vector<mcIdType>& distantGlobIds, const std::vector<double>& sum) { int procId=0; - CommInterface const comm; + CommInterface comm; int lgth=(int)distantGlobIds.size(); for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { @@ -454,7 +449,7 @@ namespace MEDCoupling void ElementLocator::sendCandidatesForAddElementsW(const std::vector<mcIdType>& distantGlobIds) { int procId=0; - CommInterface const comm; + CommInterface comm; int lgth=(int)distantGlobIds.size(); for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { @@ -469,7 +464,7 @@ namespace MEDCoupling void ElementLocator::recvAddElementsFromLazyProcsW(std::vector<std::vector<mcIdType> >& elementsToAdd) { int procId=0; - CommInterface const comm; + CommInterface comm; MPI_Status status; int lgth=(int)_distant_proc_ids.size(); elementsToAdd.resize(lgth); @@ -488,7 +483,7 @@ namespace MEDCoupling */ int ElementLocator::sendPolicyToWorkingSideL() { - CommInterface const comm; + CommInterface comm; int toSend; DataArrayIdType *isCumulative=_local_para_field.returnCumulativeGlobalNumbering(); if(isCumulative) @@ -510,7 +505,7 @@ namespace MEDCoupling { _values_added.resize(_local_para_field.getField()->getNumberOfTuples()); int procId=0; - CommInterface const comm; + CommInterface comm; _ids_per_working_proc.resize(_distant_proc_ids.size()); MPI_Status status; for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) @@ -533,7 +528,7 @@ namespace MEDCoupling void ElementLocator::sendToWorkingSideL() { int procId=0; - CommInterface const comm; + CommInterface comm; for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { vector<mcIdType>& ids=_ids_per_working_proc[procId]; @@ -553,7 +548,7 @@ namespace MEDCoupling void ElementLocator::recvLocalIdsFromWorkingSideL() { int procId=0; - CommInterface const comm; + CommInterface comm; _ids_per_working_proc.resize(_distant_proc_ids.size()); MPI_Status status; for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) @@ -572,7 +567,7 @@ namespace MEDCoupling void ElementLocator::sendGlobalIdsToWorkingSideL() { int procId=0; - CommInterface const comm; + CommInterface comm; DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering(); const mcIdType *globalIdsC=globalIds->getConstPointer(); for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) @@ -595,7 +590,7 @@ namespace MEDCoupling { std::size_t procId=0; std::size_t wProcSize=_distant_proc_ids.size(); - CommInterface const comm; + CommInterface comm; _ids_per_working_proc.resize(wProcSize); _values_per_working_proc.resize(wProcSize); MPI_Status status; @@ -640,7 +635,7 @@ namespace MEDCoupling { std::size_t procId=0; std::size_t wProcSize=_distant_proc_ids.size(); - CommInterface const comm; + CommInterface comm; _ids_per_working_proc3.resize(wProcSize); MPI_Status status; std::map<int,double> sums; @@ -681,7 +676,7 @@ namespace MEDCoupling void ElementLocator::sendAddElementsToWorkingSideL() { int procId=0; - CommInterface const comm; + CommInterface comm; for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { const std::vector<mcIdType>& vals=_ids_per_working_proc3[procId]; @@ -698,7 +693,7 @@ namespace MEDCoupling void ElementLocator::sendCandidatesGlobalIdsToWorkingSideL() { int procId=0; - CommInterface const comm; + CommInterface comm; DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering(); const mcIdType *globalIdsC=globalIds->getConstPointer(); MCAuto<DataArrayIdType> candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); diff --git a/src/ParaMEDMEM/ElementLocator.hxx b/src/ParaMEDMEM/ElementLocator.hxx index 0ef39fc62..7d7c69820 100644 --- a/src/ParaMEDMEM/ElementLocator.hxx +++ b/src/ParaMEDMEM/ElementLocator.hxx @@ -20,14 +20,13 @@ #ifndef __ELEMENTLOCATOR_HXX__ #define __ELEMENTLOCATOR_HXX__ -#include <mpi.h> - -#include <string> -#include <vector> - #include "InterpolationOptions.hxx" +#include "MEDCouplingNatureOfField.hxx" #include "MCType.hxx" -#include "MEDCouplingNatureOfFieldEnum" + +#include <mpi.h> +#include <vector> +#include <set> namespace MEDCoupling { @@ -50,10 +49,7 @@ namespace MEDCoupling MEDCouplingPointSet*& target_mesh, mcIdType*& distant_ids); void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth); - const std::vector<int> &getDistantProcIds() const - { - return _distant_proc_ids; - } + const std::vector<int>& getDistantProcIds() const { return _distant_proc_ids; } const MPI_Comm *getCommunicator() const; NatureOfField getLocalNature() const; //! This method is used to informed if there is -1D mesh on distant_group side or on local_group side. @@ -93,8 +89,8 @@ namespace MEDCoupling int _local_cell_mesh_space_dim; bool _is_m1d_corr; MEDCouplingPointSet* _local_face_mesh; - std::vector<MEDCouplingPointSet *> _distant_cell_meshes; - std::vector<MEDCouplingPointSet *> _distant_face_meshes; + std::vector<MEDCouplingPointSet*> _distant_cell_meshes; + std::vector<MEDCouplingPointSet*> _distant_face_meshes; double* _domain_bounding_boxes; const ProcessorGroup& _distant_group; const ProcessorGroup& _local_group; @@ -103,11 +99,10 @@ namespace MEDCoupling const MPI_Comm *_comm; //Attributes only used by lazy side std::vector<double> _values_added; - std::vector<std::vector<mcIdType> > _ids_per_working_proc; - std::vector<std::vector<mcIdType> > _ids_per_working_proc3; - std::vector<std::vector<double> > _values_per_working_proc; - - public: + std::vector< std::vector<mcIdType> > _ids_per_working_proc; + std::vector< std::vector<mcIdType> > _ids_per_working_proc3; + std::vector< std::vector<double> > _values_per_working_proc; + public: static const int CUMULATIVE_POLICY=3; static const int NO_POST_TREATMENT_POLICY=7; }; diff --git a/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx b/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx index 841c76119..6dbed42cb 100644 --- a/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx +++ b/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx @@ -17,20 +17,15 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include <cstddef> -#include <iostream> #include <mpi.h> -#include <utility> #include "CommInterface.hxx" -#include "ExplicitTopology.hxx" -#include "MCType.hxx" -#include "ParaIdType.hxx" -#include "MEDCouplingRefCountObject.hxx" #include "Topology.hxx" +#include "BlockTopology.hxx" #include "ComponentTopology.hxx" #include "ParaFIELD.hxx" #include "MPIProcessorGroup.hxx" #include "ExplicitCoincidentDEC.hxx" +#include "ExplicitMapping.hxx" #include "InterpKernelUtilities.hxx" using namespace std; @@ -94,17 +89,18 @@ namespace MEDCoupling /*! Constructor */ ExplicitCoincidentDEC::ExplicitCoincidentDEC(): - _toposource(nullptr),_topotarget(nullptr), - _targetgroup(nullptr), _sourcegroup(nullptr), - _sendcounts(nullptr), _recvcounts(nullptr), - _senddispls(nullptr), _recvdispls(nullptr), - _recvbuffer(nullptr), _sendbuffer(nullptr), + _toposource(0),_topotarget(0), + _targetgroup(0), _sourcegroup(0), + _sendcounts(0), _recvcounts(0), + _senddispls(0), _recvdispls(0), + _recvbuffer(0), _sendbuffer(0), _distant_elems(), _explicit_mapping() { } ExplicitCoincidentDEC::~ExplicitCoincidentDEC() - = default; + { + } /*! Synchronization process for exchanging topologies */ @@ -141,15 +137,15 @@ namespace MEDCoupling if (!_toposource->getProcGroup()->containsMyRank()) return; - auto* group=new MPIProcessorGroup(_sourcegroup->getCommInterface()); + MPIProcessorGroup* group=new MPIProcessorGroup(_sourcegroup->getCommInterface()); // Warning : the size of the target side is implicitly deduced //from the size of MPI_COMM_WORLD - int const target_size = _toposource->getProcGroup()->getCommInterface().worldSize()- _toposource->getProcGroup()->size() ; + int target_size = _toposource->getProcGroup()->getCommInterface().worldSize()- _toposource->getProcGroup()->size() ; vector<int>* target_arrays=new vector<int>[target_size]; - mcIdType const nb_local = _toposource-> getNbLocalElements(); + mcIdType nb_local = _toposource-> getNbLocalElements(); std::size_t union_size=group->size(); @@ -190,7 +186,7 @@ namespace MEDCoupling for (int ielem=0; ielem<nb_local; ielem++) { - int const ncomp = _toposource->getNbComponents(); + int ncomp = _toposource->getNbComponents(); for (int icomp=0; icomp<ncomp; icomp++) { _sendbuffer[ielem*ncomp+icomp]=value[bufferindex[ielem]*ncomp+icomp]; @@ -207,10 +203,10 @@ namespace MEDCoupling { if (!_topotarget->getProcGroup()->containsMyRank()) return; - auto* group=new MPIProcessorGroup(_topotarget->getProcGroup()->getCommInterface()); + MPIProcessorGroup* group=new MPIProcessorGroup(_topotarget->getProcGroup()->getCommInterface()); vector < vector <mcIdType> > source_arrays(_sourcegroup->size()); - mcIdType const nb_local = _topotarget-> getNbLocalElements(); + mcIdType nb_local = _topotarget-> getNbLocalElements(); for (mcIdType ielem=0; ielem< nb_local ; ielem++) { //pair<int,mcIdType> source_local =_distant_elems[ielem]; @@ -232,7 +228,7 @@ namespace MEDCoupling for (int iproc=0; iproc < _sourcegroup->size(); iproc++) { //converts the rank in target to the rank in union communicator - int const unionrank=group->translateRank(_sourcegroup,iproc); + int unionrank=group->translateRank(_sourcegroup,iproc); _recvcounts[unionrank]=(int)(source_arrays[iproc].size()*_topotarget->getNbComponents()); } for (std::size_t i=1; i<union_size; i++) @@ -253,19 +249,19 @@ namespace MEDCoupling { MPI_Status status; - mcIdType* serializer=nullptr; + mcIdType* serializer=0; mcIdType size; - auto* group=new MPIProcessorGroup(*_comm_interface); + MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface); // The send processors serialize the send topology // and send the buffers to the recv procs - if (toposend !=nullptr && toposend->getProcGroup()->containsMyRank()) + if (toposend !=0 && toposend->getProcGroup()->containsMyRank()) { toposend->serialize(serializer, size); for (int iproc=0; iproc< group->size(); iproc++) { - int const itarget=iproc; + int itarget=iproc; if (!toposend->getProcGroup()->contains(itarget)) { _comm_interface->send(&size,1,MPI_ID_TYPE, itarget,tag+itarget,*(group->getComm())); @@ -276,25 +272,25 @@ namespace MEDCoupling else { vector <int> size2(group->size()); - int const myworldrank=group->myRank(); + int myworldrank=group->myRank(); for (int iproc=0; iproc<group->size();iproc++) { - int const isource = iproc; + int isource = iproc; if (!toporecv->getProcGroup()->contains(isource)) { mcIdType nbelem; _comm_interface->recv(&nbelem, 1, MPI_ID_TYPE, isource, tag+myworldrank, *(group->getComm()), &status); - auto* buffer = new mcIdType[nbelem]; + mcIdType* buffer = new mcIdType[nbelem]; _comm_interface->recv(buffer, (int)nbelem, MPI_ID_TYPE, isource,tag+myworldrank, *(group->getComm()), &status); - auto* topotemp=new ExplicitTopology(); + ExplicitTopology* topotemp=new ExplicitTopology(); topotemp->unserialize(buffer, *_comm_interface); delete[] buffer; for (mcIdType ielem=0; ielem<toporecv->getNbLocalElements(); ielem++) { - mcIdType const global = toporecv->localToGlobal(ielem); - mcIdType const sendlocal=topotemp->globalToLocal(global); + mcIdType global = toporecv->localToGlobal(ielem); + mcIdType sendlocal=topotemp->globalToLocal(global); if (sendlocal!=-1) { size2[iproc]++; @@ -311,13 +307,13 @@ namespace MEDCoupling void ExplicitCoincidentDEC::transferMappingToSource() { - auto* group=new MPIProcessorGroup(*_comm_interface); + MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface); // sending source->target mapping which is stored by target //in _distant_elems from target to source - if (_topotarget!=nullptr && _topotarget->getProcGroup()->containsMyRank()) + if (_topotarget!=0 && _topotarget->getProcGroup()->containsMyRank()) { - int const world_size = _topotarget->getProcGroup()->getCommInterface().worldSize() ; + int world_size = _topotarget->getProcGroup()->getCommInterface().worldSize() ; int* nb_transfer_union=new int[world_size]; int* dummy_recv=new int[world_size]; for (int i=0; i<world_size; i++) @@ -345,7 +341,7 @@ namespace MEDCoupling } int* recvcounts=new int[world_size]; int* recvdispls=new int[world_size]; - int *dummyrecv=nullptr; + int *dummyrecv=0; for (int i=0; i <world_size; i++) { recvcounts[i]=0; @@ -357,7 +353,7 @@ namespace MEDCoupling //receiving in the source subdomains the mapping sent by targets else { - int const world_size = _toposource->getProcGroup()->getCommInterface().worldSize() ; + int world_size = _toposource->getProcGroup()->getCommInterface().worldSize() ; int* nb_transfer_union=new int[world_size]; int* dummy_send=new int[world_size]; for (int i=0; i<world_size; i++) @@ -367,11 +363,11 @@ namespace MEDCoupling int total_size=0; for (int i=0; i< world_size; i++) total_size+=nb_transfer_union[i]; - int const nbtarget = _targetgroup->size(); + int nbtarget = _targetgroup->size(); int* targetranks = new int[ nbtarget]; for (int i=0; i<nbtarget; i++) targetranks[i]=group->translateRank(_targetgroup,i); - auto* mappingbuffer= new mcIdType [total_size*2]; + mcIdType* mappingbuffer= new mcIdType [total_size*2]; int* sendcounts= new int [world_size]; int* senddispls = new int [world_size]; int* recvcounts=new int[world_size]; @@ -385,7 +381,7 @@ namespace MEDCoupling recvdispls[i]=recvdispls[i-1]+recvcounts[i-1]; } - int *dummysend=nullptr; + int *dummysend=0; for (int i=0; i <world_size; i++) { sendcounts[i]=0; @@ -407,14 +403,14 @@ namespace MEDCoupling _recvbuffer, _recvcounts, _recvdispls, MPI_DOUBLE,MPI_COMM_WORLD); cout<<"end AllToAll"<<endl; mcIdType nb_local = _topotarget->getNbLocalElements(); - auto* value=new double[nb_local*_topotarget->getNbComponents()]; + double* value=new double[nb_local*_topotarget->getNbComponents()]; vector<int> counters(_sourcegroup->size()); counters[0]=0; for (int i=0; i<_sourcegroup->size()-1; i++) { - auto* group=new MPIProcessorGroup(*_comm_interface); - int const worldrank=group->translateRank(_sourcegroup,i); + MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface); + int worldrank=group->translateRank(_sourcegroup,i); counters[i+1]=counters[i]+_recvcounts[worldrank]; } diff --git a/src/ParaMEDMEM/ExplicitCoincidentDEC.hxx b/src/ParaMEDMEM/ExplicitCoincidentDEC.hxx index 6b0ee6443..d0cea410a 100644 --- a/src/ParaMEDMEM/ExplicitCoincidentDEC.hxx +++ b/src/ParaMEDMEM/ExplicitCoincidentDEC.hxx @@ -24,6 +24,7 @@ #include "ExplicitMapping.hxx" #include "ExplicitTopology.hxx" +#include <map> namespace MEDCoupling { @@ -33,15 +34,15 @@ namespace MEDCoupling { public: ExplicitCoincidentDEC(); - ~ExplicitCoincidentDEC() override; - void synchronize() override; + virtual ~ExplicitCoincidentDEC(); + void synchronize(); void broadcastTopology(BlockTopology*&, int tag); void broadcastTopology(const ExplicitTopology* toposend, ExplicitTopology* toporecv, int tag); void transferMappingToSource(); - void prepareSourceDE() override; - void prepareTargetDE() override; - void recvData() override; - void sendData() override; + void prepareSourceDE(); + void prepareTargetDE(); + void recvData(); + void sendData(); private: ExplicitTopology* _toposource; ExplicitTopology* _topotarget; diff --git a/src/ParaMEDMEM/ExplicitMapping.cxx b/src/ParaMEDMEM/ExplicitMapping.cxx index ad14323ff..a6cdfa569 100644 --- a/src/ParaMEDMEM/ExplicitMapping.cxx +++ b/src/ParaMEDMEM/ExplicitMapping.cxx @@ -18,25 +18,21 @@ // #include "ExplicitMapping.hxx" -#include <utility> -#include "MCIdType.hxx" -#include <vector> -#include <map> namespace MEDCoupling { ExplicitMapping::ExplicitMapping(): _mapping(), _distant_domains(), - _numbers(nullptr), _domains(nullptr), _comm_buffer(nullptr), - _buffer_index(nullptr), _send_counts(nullptr) + _numbers(0), _domains(0), _comm_buffer(0), + _buffer_index(0), _send_counts(0) { } ExplicitMapping::~ExplicitMapping() { - if (_domains!=nullptr) delete[] _domains; - if (_numbers!=nullptr) delete[] _numbers; - if (_comm_buffer!=nullptr) delete[] _comm_buffer; + if (_domains!=0) delete[] _domains; + if (_numbers!=0) delete[] _numbers; + if (_comm_buffer!=0) delete[] _comm_buffer; } void ExplicitMapping::pushBackElem(std::pair<int,mcIdType> idistant) @@ -53,8 +49,10 @@ namespace MEDCoupling { if (_distant_domains.empty()) { - for (const auto & iter : _mapping) - _distant_domains.insert(iter.first); + for (std::vector <std::pair<int,mcIdType> >::const_iterator iter= _mapping.begin(); + iter!=_mapping.end(); + iter++) + _distant_domains.insert(iter->first); } return (int)_distant_domains.size(); } @@ -66,7 +64,7 @@ namespace MEDCoupling int ExplicitMapping::getDistantDomain(int i) { - if (_domains==nullptr) + if (_domains==0) computeNumbers(); return _domains[i]; @@ -74,7 +72,7 @@ namespace MEDCoupling int ExplicitMapping::getNbDistantElems(int i) { - if (_numbers==nullptr) + if (_numbers==0) computeNumbers(); return _numbers[i]; } @@ -87,12 +85,12 @@ namespace MEDCoupling for (int i=1; i<(int)_distant_domains.size();i++) offsets[i]=offsets[i-1]+_numbers[i-1]; - for (auto & i : _mapping) + for (int i=0; i<(int)_mapping.size(); i++) { - mcIdType const offset= offsets[i.first]; + mcIdType offset= offsets[_mapping[i].first]; _comm_buffer[offset*2]=idproc; - _comm_buffer[offset*2+1]=i.second; - offsets[i.first]++; + _comm_buffer[offset*2+1]=_mapping[i].second; + offsets[_mapping[i].first]++; } return _comm_buffer; } @@ -135,16 +133,16 @@ namespace MEDCoupling void ExplicitMapping::computeNumbers() { std::map <int,int> counts; - if (_numbers==nullptr) + if (_numbers==0) { _numbers=new int[nbDistantDomains()]; _domains=new int[nbDistantDomains()]; - for (auto & i : _mapping) + for (int i=0; i<(int)_mapping.size(); i++) { - if ( counts.find(i.first) == counts.end()) - counts.insert(std::make_pair(i.first,1)); + if ( counts.find(_mapping[i].first) == counts.end()) + counts.insert(std::make_pair(_mapping[i].first,1)); else - (counts[i.first])++; + (counts[_mapping[i].first])++; } int counter=0; for (std::map<int,int>::const_iterator iter=counts.begin(); diff --git a/src/ParaMEDMEM/ExplicitMapping.hxx b/src/ParaMEDMEM/ExplicitMapping.hxx index dd2f757c2..340cdb73c 100644 --- a/src/ParaMEDMEM/ExplicitMapping.hxx +++ b/src/ParaMEDMEM/ExplicitMapping.hxx @@ -22,8 +22,8 @@ #include "MCIdType.hxx" -#include <utility> #include <vector> +#include <map> #include <set> namespace MEDCoupling diff --git a/src/ParaMEDMEM/ExplicitTopology.cxx b/src/ParaMEDMEM/ExplicitTopology.cxx index 434ba0288..5aecc1520 100644 --- a/src/ParaMEDMEM/ExplicitTopology.cxx +++ b/src/ParaMEDMEM/ExplicitTopology.cxx @@ -18,13 +18,15 @@ // #include "CommInterface.hxx" -#include "MCType.hxx" +#include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" #include "ParaMESH.hxx" +#include "Topology.hxx" #include "ExplicitTopology.hxx" #include "BlockTopology.hxx" +#include "ComponentTopology.hxx" -#include <iostream> +#include <vector> #include <algorithm> using namespace std; @@ -32,8 +34,8 @@ namespace MEDCoupling { ExplicitTopology::ExplicitTopology(): - _proc_group(nullptr), _nb_elems(0), _nb_components(0), - _loc2glob(nullptr), _glob2loc() + _proc_group(NULL), _nb_elems(0), _nb_components(0), + _loc2glob(NULL), _glob2loc() {} ExplicitTopology::ExplicitTopology(const ParaMESH& paramesh ): @@ -67,7 +69,7 @@ ExplicitTopology::ExplicitTopology(const ExplicitTopology& topo, int nb_componen ExplicitTopology::~ExplicitTopology() { - if (_loc2glob != nullptr) delete[] _loc2glob; + if (_loc2glob != 0) delete[] _loc2glob; } @@ -92,7 +94,7 @@ void ExplicitTopology::serialize(mcIdType* & serializer, mcIdType& size) const * after communication. Uses the same structure as the one used for serialize() * * */ -void ExplicitTopology::unserialize(const mcIdType* serializer,const CommInterface& /*comm_interface*/) +void ExplicitTopology::unserialize(const mcIdType* serializer,const CommInterface& comm_interface) { const mcIdType* ptr_serializer=serializer; cout << "unserialize..."<<endl; diff --git a/src/ParaMEDMEM/ExplicitTopology.hxx b/src/ParaMEDMEM/ExplicitTopology.hxx index 419fea84b..32401a5ee 100644 --- a/src/ParaMEDMEM/ExplicitTopology.hxx +++ b/src/ParaMEDMEM/ExplicitTopology.hxx @@ -20,17 +20,17 @@ #ifndef __EXPLICITTOPOLOGY_HXX__ #define __EXPLICITTOPOLOGY_HXX__ -#include "MCType.hxx" -#include "CommInterface.hxx" #include "ProcessorGroup.hxx" #include "InterpKernelHashMap.hxx" -#include "Topology.hxx" +#include <vector> #include <utility> +#include <iostream> namespace MEDCoupling { class ParaMESH; + class Topology; class ComponentTopology; /*! diff --git a/src/ParaMEDMEM/InterpKernelDEC.cxx b/src/ParaMEDMEM/InterpKernelDEC.cxx index 5c925f032..f4494f489 100644 --- a/src/ParaMEDMEM/InterpKernelDEC.cxx +++ b/src/ParaMEDMEM/InterpKernelDEC.cxx @@ -17,17 +17,15 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include <cstddef> #include <mpi.h> -#include <string> -#include <utility> -#include "DisjointDEC.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "InterpKernelException.hxx" +#include "CommInterface.hxx" #include "Topology.hxx" +#include "BlockTopology.hxx" #include "ComponentTopology.hxx" #include "ParaFIELD.hxx" +#include "MPIProcessorGroup.hxx" +#include "ParaMESH.hxx" +#include "DEC.hxx" #include "InterpolationMatrix.hxx" #include "InterpKernelDEC.hxx" #include "ElementLocator.hxx" @@ -36,7 +34,7 @@ namespace MEDCoupling { InterpKernelDEC::InterpKernelDEC(): DisjointDEC(), - _interpolation_matrix(nullptr) + _interpolation_matrix(0) { } @@ -53,7 +51,7 @@ namespace MEDCoupling */ InterpKernelDEC::InterpKernelDEC(ProcessorGroup& source_group, ProcessorGroup& target_group): DisjointDEC(source_group, target_group), - _interpolation_matrix(nullptr) + _interpolation_matrix(0) { } @@ -67,7 +65,7 @@ namespace MEDCoupling InterpKernelDEC::InterpKernelDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids, const MPI_Comm& world_comm): DisjointDEC(src_ids,trg_ids,world_comm), - _interpolation_matrix(nullptr) + _interpolation_matrix(0) { } @@ -78,7 +76,7 @@ namespace MEDCoupling */ InterpKernelDEC::InterpKernelDEC(ProcessorGroup& generic_group, const std::string& source_group, const std::string& target_group): DisjointDEC(generic_group.getProcIDsByName(source_group),generic_group.getProcIDsByName(target_group)), - _interpolation_matrix(nullptr) + _interpolation_matrix(0) { } @@ -149,27 +147,27 @@ namespace MEDCoupling ElementLocator locator(*_local_field, *_target_group, *_source_group); //transferring option from InterpKernelDEC to ElementLocator locator.copyOptions(*this); - MEDCouplingPointSet* distant_mesh=nullptr; - mcIdType* distant_ids=nullptr; + MEDCouplingPointSet* distant_mesh=0; + mcIdType* distant_ids=0; std::string distantMeth; for (int i=0; i<_target_group->size(); i++) { // int idistant_proc = (i+_source_group->myRank())%_target_group->size(); - int const idistant_proc=i; + int idistant_proc=i; //gathers pieces of the target meshes that can intersect the local mesh locator.exchangeMesh(idistant_proc,distant_mesh,distant_ids); - if (distant_mesh !=nullptr) + if (distant_mesh !=0) { locator.exchangeMethod(_method,idistant_proc,distantMeth); //adds the contribution of the distant mesh on the local one - int const idistant_proc_in_union=_union_group->translateRank(_target_group,idistant_proc); + int idistant_proc_in_union=_union_group->translateRank(_target_group,idistant_proc); //std::cout <<"add contribution from proc "<<idistant_proc_in_union<<" to proc "<<_union_group->myRank()<<std::endl; _interpolation_matrix->addContribution(*distant_mesh,idistant_proc_in_union,distant_ids,_method,distantMeth); distant_mesh->decrRef(); delete [] distant_ids; - distant_mesh=nullptr; - distant_ids=nullptr; + distant_mesh=0; + distant_ids=0; } } _interpolation_matrix->finishContributionW(locator); @@ -180,23 +178,23 @@ namespace MEDCoupling ElementLocator locator(*_local_field, *_source_group, *_target_group); //transferring option from InterpKernelDEC to ElementLocator locator.copyOptions(*this); - MEDCouplingPointSet* distant_mesh=nullptr; - mcIdType* distant_ids=nullptr; + MEDCouplingPointSet* distant_mesh=0; + mcIdType* distant_ids=0; for (int i=0; i<_source_group->size(); i++) { // int idistant_proc = (i+_target_group->myRank())%_source_group->size(); - int const idistant_proc=i; + int idistant_proc=i; //gathers pieces of the target meshes that can intersect the local mesh locator.exchangeMesh(idistant_proc,distant_mesh,distant_ids); //std::cout << " Data sent from "<<_union_group->myRank()<<" to source proc "<< idistant_proc<<std::endl; - if (distant_mesh!=nullptr) + if (distant_mesh!=0) { std::string distantMeth; locator.exchangeMethod(_method,idistant_proc,distantMeth); distant_mesh->decrRef(); delete [] distant_ids; - distant_mesh=nullptr; - distant_ids=nullptr; + distant_mesh=0; + distant_ids=0; } } _interpolation_matrix->finishContributionL(locator); diff --git a/src/ParaMEDMEM/InterpKernelDEC.hxx b/src/ParaMEDMEM/InterpKernelDEC.hxx index 824307fbb..3a8803a22 100644 --- a/src/ParaMEDMEM/InterpKernelDEC.hxx +++ b/src/ParaMEDMEM/InterpKernelDEC.hxx @@ -21,11 +21,8 @@ #define __INTERPKERNELDEC_HXX__ #include "DisjointDEC.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" #include "MxN_Mapping.hxx" #include "InterpolationOptions.hxx" -#include <string> namespace MEDCoupling { @@ -136,18 +133,18 @@ namespace MEDCoupling InterpKernelDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids, const MPI_Comm& world_comm=MPI_COMM_WORLD); InterpKernelDEC(ProcessorGroup& generic_group, const std::string& source_group, const std::string& target_group); InterpKernelDEC(ProcessorGroup& generic_group, const std::string& interaction_group); - ~InterpKernelDEC() override; + virtual ~InterpKernelDEC(); void release(); - void synchronize() override; + void synchronize(); void synchronizeWithDefaultValue(double val); MCAuto<DataArrayIdType> retrieveNonFetchedIds() const; - void recvData() override; + void recvData(); void recvData(double time); - void sendData() override; + void sendData(); void sendData(double time , double deltatime); - void prepareSourceDE() override { } - void prepareTargetDE() override { } + void prepareSourceDE() { } + void prepareTargetDE() { } private: MCAuto<DataArrayIdType> retrieveNonFetchedIdsSource() const; MCAuto<DataArrayIdType> retrieveNonFetchedIdsTarget() const; diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index 2fbffef53..b8271a945 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -17,37 +17,27 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "DECOptions.hxx" -#include "MCType.hxx" -#include "MEDCouplingNormalizedUnstructuredMesh.txx" -#include "Interpolation2D.hxx" -#include "Interpolation3D.hxx" -#include "Interpolation2D3D.hxx" -#include "Interpolation2D1D.hxx" -#include "Interpolation1D.hxx" -#include "MEDCouplingNatureOfFieldEnum" -#include "MCAuto.hxx" -#include "InterpKernelException.hxx" #include "ParaMESH.hxx" #include "ParaFIELD.hxx" #include "ProcessorGroup.hxx" #include "MxN_Mapping.hxx" #include "InterpolationMatrix.hxx" +#include "TranslationRotationMatrix.hxx" +#include "Interpolation.hxx" +#include "Interpolation1D.txx" #include "Interpolation2DCurve.hxx" +#include "Interpolation2D.txx" #include "Interpolation3DSurf.hxx" #include "Interpolation3D.txx" #include "Interpolation2D3D.txx" #include "Interpolation2D1D.txx" #include "MEDCouplingUMesh.hxx" +#include "MEDCouplingNormalizedUnstructuredMesh.txx" #include "InterpolationOptions.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "ElementLocator.hxx" #include <algorithm> -#include <string> -#include <cstddef> -#include <utility> -#include <sstream> -#include <limits> using namespace std; @@ -77,14 +67,15 @@ namespace MEDCoupling _source_group(source_group), _target_group(target_group) { - mcIdType const nbelems = source_field->getField()->getNumberOfTuples(); + mcIdType nbelems = source_field->getField()->getNumberOfTuples(); _row_offsets.resize(nbelems+1); _coeffs.resize(nbelems); _target_volume.resize(nbelems); } InterpolationMatrix::~InterpolationMatrix() - = default; + { + } /*! @@ -113,8 +104,8 @@ namespace MEDCoupling //creating the interpolator structure vector<map<mcIdType,double> > surfaces; //computation of the intersection volumes between source and target elements - auto *distant_supportC=dynamic_cast<MEDCouplingUMesh *>(&distant_support); - auto *source_supportC=dynamic_cast<MEDCouplingUMesh *>(_source_support); + MEDCouplingUMesh *distant_supportC=dynamic_cast<MEDCouplingUMesh *>(&distant_support); + MEDCouplingUMesh *source_supportC=dynamic_cast<MEDCouplingUMesh *>(_source_support); if ( distant_support.getMeshDimension() == -1 ) { if(source_supportC->getMeshDimension()==2 && source_supportC->getSpaceDimension()==2) @@ -257,9 +248,9 @@ namespace MEDCoupling { throw INTERP_KERNEL::Exception("no interpolator exists for these mesh and space dimensions "); } - bool const needTargetSurf=isSurfaceComputationNeeded(targetMeth); + bool needTargetSurf=isSurfaceComputationNeeded(targetMeth); - MEDCouplingFieldDouble *target_triangle_surf=nullptr; + MEDCouplingFieldDouble *target_triangle_surf=0; if(needTargetSurf) target_triangle_surf = distant_support.getMeasureField(getMeasureAbsStatus()); fillDSFromVM(iproc_distant,distant_elems,surfaces,target_triangle_surf); @@ -354,7 +345,7 @@ namespace MEDCoupling void InterpolationMatrix::finishContributionW(ElementLocator& elementLocator) { - NatureOfField const nature=elementLocator.getLocalNature(); + NatureOfField nature=elementLocator.getLocalNature(); switch(nature) { case IntensiveMaximum: @@ -387,7 +378,7 @@ namespace MEDCoupling void InterpolationMatrix::finishContributionL(ElementLocator& elementLocator) { - NatureOfField const nature=elementLocator.getLocalNature(); + NatureOfField nature=elementLocator.getLocalNature(); switch(nature) { case IntensiveMaximum: @@ -427,7 +418,7 @@ namespace MEDCoupling void InterpolationMatrix::computeConservVolDenoL(ElementLocator& elementLocator) { - int const pol1=elementLocator.sendPolicyToWorkingSideL(); + int pol1=elementLocator.sendPolicyToWorkingSideL(); if(pol1==ElementLocator::NO_POST_TREATMENT_POLICY) { elementLocator.recvFromWorkingSideL(); @@ -451,7 +442,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("Not managed policy detected on lazy side : not implemented !"); } - void InterpolationMatrix::computeIntegralDenoW(ElementLocator& /*elementLocator*/) + void InterpolationMatrix::computeIntegralDenoW(ElementLocator& elementLocator) { MEDCouplingFieldDouble *source_triangle_surf = _source_support->getMeasureField(getMeasureAbsStatus()); _deno_multiply.resize(_coeffs.size()); @@ -466,7 +457,7 @@ namespace MEDCoupling _deno_reverse_multiply=_target_volume; } - void InterpolationMatrix::computeRevIntegralDenoW(ElementLocator& /*elementLocator*/) + void InterpolationMatrix::computeRevIntegralDenoW(ElementLocator& elementLocator) { _deno_multiply=_target_volume; MEDCouplingFieldDouble *source_triangle_surf = _source_support->getMeasureField(getMeasureAbsStatus()); @@ -850,7 +841,7 @@ namespace MEDCoupling */ void InterpolationMatrix::prepare() { - mcIdType const nbelems = _source_field->getField()->getNumberOfTuples(); + mcIdType nbelems = _source_field->getField()->getNumberOfTuples(); for (mcIdType ielem=0; ielem < nbelems; ielem++) { _row_offsets[ielem+1]+=_row_offsets[ielem]; diff --git a/src/ParaMEDMEM/InterpolationMatrix.hxx b/src/ParaMEDMEM/InterpolationMatrix.hxx index b42493d14..4d966ee53 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.hxx +++ b/src/ParaMEDMEM/InterpolationMatrix.hxx @@ -20,18 +20,10 @@ #ifndef __INTERPOLATIONMATRIX_HXX__ #define __INTERPOLATIONMATRIX_HXX__ -#include "MCType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingPointSet.hxx" #include "MPIAccessDEC.hxx" #include "MxN_Mapping.hxx" #include "InterpolationOptions.hxx" #include "DECOptions.hxx" -#include "ParaFIELD.hxx" -#include <string> -#include <vector> -#include <utility> namespace MEDCoupling { diff --git a/src/ParaMEDMEM/LinearTimeInterpolator.cxx b/src/ParaMEDMEM/LinearTimeInterpolator.cxx index 8c23e2a0e..7c897f142 100644 --- a/src/ParaMEDMEM/LinearTimeInterpolator.cxx +++ b/src/ParaMEDMEM/LinearTimeInterpolator.cxx @@ -18,7 +18,6 @@ // #include "LinearTimeInterpolator.hxx" -#include "TimeInterpolator.hxx" using namespace std; @@ -32,10 +31,11 @@ namespace MEDCoupling } LinearTimeInterpolator::~LinearTimeInterpolator() - = default; + { + } void LinearTimeInterpolator::doInterp( double time0, double time1, double time, - int recvcount , int /*nbuff0*/, int /*nbuff1*/, + int recvcount , int nbuff0, int nbuff1, int **recvbuff0, int **recvbuff1, int *result ) { for(int i = 0 ; i < recvcount ; i++ ) @@ -43,7 +43,7 @@ namespace MEDCoupling } void LinearTimeInterpolator::doInterp( double time0, double time1, double time, - int recvcount , int /*nbuff0*/, int /*nbuff1*/, + int recvcount , int nbuff0, int nbuff1, double **recvbuff0, double **recvbuff1, double *result ) { diff --git a/src/ParaMEDMEM/LinearTimeInterpolator.hxx b/src/ParaMEDMEM/LinearTimeInterpolator.hxx index 91378419d..eac403f93 100644 --- a/src/ParaMEDMEM/LinearTimeInterpolator.hxx +++ b/src/ParaMEDMEM/LinearTimeInterpolator.hxx @@ -22,6 +22,8 @@ #include "TimeInterpolator.hxx" +#include <map> +#include <iostream> namespace MEDCoupling { @@ -37,13 +39,13 @@ namespace MEDCoupling public: LinearTimeInterpolator( double InterpPrecision=0, int nStepBefore=1, int nStepAfter=1 ) ; - ~LinearTimeInterpolator() override; + virtual ~LinearTimeInterpolator(); void doInterp( double time0, double time1, double time, int recvcount, int nbuff0, int nbuff1, - int **recvbuff0, int **recvbuff1, int *result ) override; + int **recvbuff0, int **recvbuff1, int *result ); void doInterp( double time0, double time1, double time, int recvcount, int nbuff0, int nbuff1, - double **recvbuff0, double **recvbuff1, double *result ) override; + double **recvbuff0, double **recvbuff1, double *result ); }; } diff --git a/src/ParaMEDMEM/MPIAccess/MPIAccess.cxx b/src/ParaMEDMEM/MPIAccess/MPIAccess.cxx index f65270b87..549cd0cbf 100644 --- a/src/ParaMEDMEM/MPIAccess/MPIAccess.cxx +++ b/src/ParaMEDMEM/MPIAccess/MPIAccess.cxx @@ -19,12 +19,9 @@ #include "MPIAccess/MPIAccess.hxx" -#include "MPIProcessorGroup.hxx" +#include "InterpolationUtils.hxx" -#include <cstddef> -#include <cstdlib> #include <iostream> -#include <limits> using namespace std; @@ -198,7 +195,7 @@ namespace MEDCoupling int MPIAccess::newRequest( MPI_Datatype datatype, int tag , int destsourcerank , bool fromsourcerank , bool asynchronous ) { - auto *mpiaccessstruct = new RequestStruct; + RequestStruct *mpiaccessstruct = new RequestStruct; mpiaccessstruct->MPITag = tag ; mpiaccessstruct->MPIDatatype = datatype ; mpiaccessstruct->MPITarget = destsourcerank ; @@ -300,7 +297,7 @@ namespace MEDCoupling // Returns in ArrayOfSendRequests with the dimension "size" all the // SendRequestIds - int MPIAccess::sendRequestIds(int /*size*/, int *ArrayOfSendRequests) + int MPIAccess::sendRequestIds(int size, int *ArrayOfSendRequests) { int destrank ; int i = 0 ; @@ -325,7 +322,7 @@ namespace MEDCoupling // Returns in ArrayOfRecvRequests with the dimension "size" all the // RecvRequestIds - int MPIAccess::recvRequestIds(int /*size*/, int *ArrayOfRecvRequests) + int MPIAccess::recvRequestIds(int size, int *ArrayOfRecvRequests) { int sourcerank ; int i = 0 ; @@ -378,7 +375,7 @@ namespace MEDCoupling int MPItag = newSendTag( datatype, target , aMethodIdent , false , RequestId ) ; if ( aMethodIdent == _message_time ) { - auto *aTimeMsg = (TimeMessage *) buffer ; + TimeMessage *aTimeMsg = (TimeMessage *) buffer ; aTimeMsg->tag = MPItag ; } deleteRequest( RequestId ) ; @@ -400,7 +397,7 @@ namespace MEDCoupling { int sts = MPI_SUCCESS ; RequestId = -1 ; - if ( OutCount != nullptr ) + if ( OutCount != NULL ) *OutCount = -1 ; if ( count ) { @@ -417,7 +414,7 @@ namespace MEDCoupling setMPICompleted( RequestId , true ) ; deleteStatus( RequestId ) ; } - if ( OutCount != nullptr ) + if ( OutCount != NULL ) *OutCount = outcount ; if ( _trace ) cout << "MPIAccess::Recv" << _my_rank << " RecvRequestId " @@ -440,7 +437,7 @@ namespace MEDCoupling int MPItag = newSendTag( datatype, target , aMethodIdent , true , RequestId ) ; if ( aMethodIdent == _message_time ) { - auto *aTimeMsg = (TimeMessage *) buffer ; + TimeMessage *aTimeMsg = (TimeMessage *) buffer ; aTimeMsg->tag = MPItag ; } MPI_Request *aSendRequest = MPIRequest( RequestId ) ; @@ -518,7 +515,7 @@ namespace MEDCoupling << RecvRequestId << " outcount " << outcount << endl ; } } - if ( OutCount != nullptr ) + if ( OutCount != NULL ) { *OutCount = outcount ; if ( _trace ) @@ -691,7 +688,7 @@ namespace MEDCoupling return status ; } - int MPIAccess::waitAny(int /*count*/, int * /*array_of_RequestIds*/, int &RequestId) + int MPIAccess::waitAny(int count, int *array_of_RequestIds, int &RequestId) { int status = MPI_ERR_OTHER ; RequestId = -1 ; @@ -699,7 +696,7 @@ namespace MEDCoupling return status ; } - int MPIAccess::testAny(int /*count*/, int * /*array_of_RequestIds*/, int &RequestId, int &flag) + int MPIAccess::testAny(int count, int *array_of_RequestIds, int &RequestId, int &flag) { int status = MPI_ERR_OTHER ; RequestId = -1 ; @@ -762,16 +759,16 @@ namespace MEDCoupling return retstatus ; } - int MPIAccess::waitSome(int /*count*/, int * /*array_of_RequestIds*/, int /*outcount*/, - int * /*outarray_of_RequestIds*/) + int MPIAccess::waitSome(int count, int *array_of_RequestIds, int outcount, + int *outarray_of_RequestIds) { int status = MPI_ERR_OTHER ; cout << "MPIAccess::WaitSome not yet implemented" << endl ; return status ; } - int MPIAccess::testSome(int /*count*/, int * /*array_of_RequestIds*/, int /*outcounts*/, - int * /*outarray_of_RequestIds*/) + int MPIAccess::testSome(int count, int *array_of_RequestIds, int outcounts, + int *outarray_of_RequestIds) { int status = MPI_ERR_OTHER ; cout << "MPIAccess::TestSome not yet implemented" << endl ; diff --git a/src/ParaMEDMEM/MPIAccess/MPIAccess.hxx b/src/ParaMEDMEM/MPIAccess/MPIAccess.hxx index 7c355fffb..f8cdc4c5b 100644 --- a/src/ParaMEDMEM/MPIAccess/MPIAccess.hxx +++ b/src/ParaMEDMEM/MPIAccess/MPIAccess.hxx @@ -21,13 +21,13 @@ #define __MPIACCESS_HXX__ #include "CommInterface.hxx" +#include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" -#include <cstddef> -#include <iostream> +#include <map> #include <list> #include <vector> -#include <map> +#include <iostream> namespace MEDCoupling { @@ -83,13 +83,13 @@ namespace MEDCoupling int ISend(void* buffer, int count, MPI_Datatype datatype, int target, int &RequestId) ; int recv(void* buffer, int count, MPI_Datatype datatype, int source, - int &RequestId, int *OutCount=nullptr) ; + int &RequestId, int *OutCount=NULL) ; int IRecv(void* buffer, int count, MPI_Datatype datatype, int source, int &RequestId) ; int sendRecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int &SendRequestId, void* recvbuf, int recvcount, MPI_Datatype recvtype, int source, - int &RecvRequestId, int *OutCount=nullptr) ; + int &RecvRequestId, int *OutCount=NULL) ; int ISendRecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int &SendRequestId, void* recvbuf, int recvcount, MPI_Datatype recvtype, int source, int &RecvRequestId) ; @@ -397,7 +397,7 @@ namespace MEDCoupling struct RequestStruct *aRequestStruct = _map_of_request_struct[ RequestId ]; if ( aRequestStruct ) return aRequestStruct->MPIStatus; - return nullptr ; + return NULL ; } // Set the MPICompleted field of the structure Request corresponding to RequestId diff --git a/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.cxx b/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.cxx index 55f04c602..c13cbc8d1 100644 --- a/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.cxx +++ b/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.cxx @@ -18,14 +18,8 @@ // #include "MPIAccess/MPIAccessDEC.hxx" -#include "ProcessorGroup.hxx" -#include "MPIProcessorGroup.hxx" -#include "MPIAccess.hxx" -#include "DECOptions.hxx" -#include "LinearTimeInterpolator.hxx" #include <cstring> -#include <iostream> using namespace std; @@ -53,7 +47,7 @@ namespace MEDCoupling { procs.insert(i) ; } - auto *mpilg = static_cast<MPIProcessorGroup *>(const_cast<ProcessorGroup *>(&source_group)); + MPIProcessorGroup *mpilg = static_cast<MPIProcessorGroup *>(const_cast<ProcessorGroup *>(&source_group)); _MPI_union_group = new MEDCoupling::MPIProcessorGroup( union_group->getCommInterface(),procs,mpilg->getWorldComm()); delete union_group ; _my_rank = _MPI_union_group->myRank() ; @@ -75,7 +69,7 @@ namespace MEDCoupling _data_messages_type->resize( _group_size ) ; _data_messages = new vector< vector< void * > > ; _data_messages->resize( _group_size ) ; - _time_interpolator = nullptr ; + _time_interpolator = NULL ; _map_of_send_buffers = new map< int , SendBuffStruct * > ; } @@ -110,7 +104,7 @@ namespace MEDCoupling switch ( aTimeInterp ) { case WithoutTimeInterp : - _time_interpolator = nullptr ; + _time_interpolator = NULL ; _n_step_before = 0 ; _n_step_after = 0 ; break ; @@ -353,7 +347,7 @@ namespace MEDCoupling checkSent() ; //DoSend + DoRecv : SendRecv - SendBuffStruct * aSendDataStruct = nullptr ; + SendBuffStruct * aSendDataStruct = NULL ; if ( _asynchronous && sendbuf ) { aSendDataStruct = new SendBuffStruct ; @@ -415,7 +409,7 @@ namespace MEDCoupling } //DoSend + DoRecv : SendRecv - SendBuffStruct * aSendDataStruct = nullptr ; + SendBuffStruct * aSendDataStruct = NULL ; if ( _asynchronous && sendbuf ) { aSendDataStruct = new SendBuffStruct ; @@ -524,7 +518,7 @@ namespace MEDCoupling int SendTimeRequestId ; int SendDataRequestId ; - if ( _time_interpolator == nullptr ) + if ( _time_interpolator == NULL ) { return MPI_ERR_OTHER ; } @@ -536,11 +530,11 @@ namespace MEDCoupling } //DoSend : Time + SendBuff - SendBuffStruct * aSendTimeStruct = nullptr ; - SendBuffStruct * aSendDataStruct = nullptr ; + SendBuffStruct * aSendTimeStruct = NULL ; + SendBuffStruct * aSendDataStruct = NULL ; if ( sendbuf && sendcount ) { - auto * aSendTimeMessage = new TimeMessage ; + TimeMessage * aSendTimeMessage = new TimeMessage ; if ( _asynchronous ) { aSendTimeStruct = new SendBuffStruct ; @@ -643,7 +637,7 @@ namespace MEDCoupling int SendTimeRequestId ; int SendDataRequestId ; - if ( _time_interpolator == nullptr ) + if ( _time_interpolator == NULL ) { return MPI_ERR_OTHER ; } @@ -671,11 +665,11 @@ namespace MEDCoupling + And if we are in synchronous mode we delete the SendMessages. */ //DoSend : Time + SendBuff - SendBuffStruct * aSendTimeStruct = nullptr ; - SendBuffStruct * aSendDataStruct = nullptr ; + SendBuffStruct * aSendTimeStruct = NULL ; + SendBuffStruct * aSendDataStruct = NULL ; if ( sendbuf ) { - auto * aSendTimeMessage = new TimeMessage ; + TimeMessage * aSendTimeMessage = new TimeMessage ; if ( _asynchronous ) { aSendTimeStruct = new SendBuffStruct ; @@ -915,10 +909,10 @@ namespace MEDCoupling { int sts = MPI_SUCCESS ; int flag = WithWait ; - int const size = _MPI_access->sendRequestIdsSize() ; + int size = _MPI_access->sendRequestIdsSize() ; int * ArrayOfSendRequests = new int[ size ] ; - int const nSendRequest = _MPI_access->sendRequestIds( size , ArrayOfSendRequests ) ; - bool const SendTrace = false ; + int nSendRequest = _MPI_access->sendRequestIds( size , ArrayOfSendRequests ) ; + bool SendTrace = false ; int i ; for ( i = 0 ; i < nSendRequest ; i++ ) { diff --git a/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.hxx b/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.hxx index 63dcb706b..8f724a057 100644 --- a/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.hxx +++ b/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.hxx @@ -20,14 +20,12 @@ #ifndef __MPIACCESSDEC_HXX__ #define __MPIACCESSDEC_HXX__ -#include "DECOptions.hxx" +#include "DEC.hxx" +#include "LinearTimeInterpolator.hxx" -#include <cstdlib> +#include <map> #include <iostream> #include "MPIAccess.hxx" -#include "ProcessorGroup.hxx" -#include "MPIProcessorGroup.hxx" -#include "TimeInterpolator.hxx" namespace MEDCoupling { diff --git a/src/ParaMEDMEM/MPIProcessorGroup.cxx b/src/ParaMEDMEM/MPIProcessorGroup.cxx index 42b169ac0..1e40fd65d 100644 --- a/src/ParaMEDMEM/MPIProcessorGroup.cxx +++ b/src/ParaMEDMEM/MPIProcessorGroup.cxx @@ -20,10 +20,11 @@ #include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" #include "CommInterface.hxx" +#include "InterpolationUtils.hxx" -#include <cstdlib> #include <iostream> -#include <string> +#include <set> +#include <algorithm> #include "mpi.h" using namespace std; @@ -164,7 +165,7 @@ namespace MEDCoupling _comm_interface.groupFree(&group_world); throw INTERP_KERNEL::Exception("invalid argument in MPIProcessorGroup constructor (comm,pfirst,plast)"); } - int const nprocs=pend-pstart+1; + int nprocs=pend-pstart+1; int* ranks=new int[nprocs]; for (int i=pstart; i<=pend;i++) { @@ -221,7 +222,7 @@ namespace MEDCoupling */ int MPIProcessorGroup::translateRank(const ProcessorGroup* group, int rank) const { - const auto* targetgroup=dynamic_cast<const MPIProcessorGroup*>(group); + const MPIProcessorGroup* targetgroup=dynamic_cast<const MPIProcessorGroup*>(group); int local_rank; MPI_Group_translate_ranks(targetgroup->_group, 1, &rank, _group, &local_rank); return local_rank; @@ -234,7 +235,7 @@ namespace MEDCoupling ProcessorGroup* MPIProcessorGroup::createComplementProcGroup() const { set <int> procs; - int const world_size=_comm_interface.worldSize(); + int world_size=_comm_interface.worldSize(); for (int i=0; i<world_size; i++) procs.insert(i); for (set<int>::const_iterator iter=_proc_ids.begin(); iter!= _proc_ids.end(); iter++) diff --git a/src/ParaMEDMEM/MPIProcessorGroup.hxx b/src/ParaMEDMEM/MPIProcessorGroup.hxx index 007c7281f..1dd035995 100644 --- a/src/ParaMEDMEM/MPIProcessorGroup.hxx +++ b/src/ParaMEDMEM/MPIProcessorGroup.hxx @@ -22,8 +22,8 @@ #include "ProcessorGroup.hxx" +#include <set> #include <mpi.h> -#include <string> namespace MEDCoupling { @@ -38,18 +38,18 @@ namespace MEDCoupling MPIProcessorGroup (const ProcessorGroup& proc_group, std::set<int> proc_ids); MPIProcessorGroup(const CommInterface& interface,int pstart, int pend, const MPI_Comm& world_comm=MPI_COMM_WORLD); MPIProcessorGroup(const MPIProcessorGroup& other); - ~MPIProcessorGroup() override; + virtual ~MPIProcessorGroup(); void release(); - MPIProcessorGroup *deepCopy() const override; - ProcessorGroup* fuse (const ProcessorGroup&) const override; - void intersect (ProcessorGroup&) override { } - int myRank() const override; - bool containsMyRank() const override { int rank; MPI_Group_rank(_group, &rank); return (rank!=MPI_UNDEFINED); } - int translateRank(const ProcessorGroup* group, int rank) const override; + virtual MPIProcessorGroup *deepCopy() const; + virtual ProcessorGroup* fuse (const ProcessorGroup&) const; + void intersect (ProcessorGroup&) { } + int myRank() const; + bool containsMyRank() const { int rank; MPI_Group_rank(_group, &rank); return (rank!=MPI_UNDEFINED); } + int translateRank(const ProcessorGroup* group, int rank) const; const MPI_Comm* getComm() const { return &_comm; } - ProcessorGroup* createComplementProcGroup() const override; - ProcessorGroup* createProcGroup() const override; + ProcessorGroup* createComplementProcGroup() const; + ProcessorGroup* createProcGroup() const; MPI_Comm getWorldComm() { return _world_comm; } private: void updateMPISpecificAttributes(); diff --git a/src/ParaMEDMEM/MxN_Mapping.cxx b/src/ParaMEDMEM/MxN_Mapping.cxx index 76b807d2d..f076bbb65 100644 --- a/src/ParaMEDMEM/MxN_Mapping.cxx +++ b/src/ParaMEDMEM/MxN_Mapping.cxx @@ -18,17 +18,9 @@ // #include "CommInterface.hxx" -#include "DECOptions.hxx" -#include "MCType.hxx" -#include "ParaIdType.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingMemArray.hxx" #include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" #include "MPIAccessDEC.hxx" -#include <cstddef> -#include <ostream> #include "MxN_Mapping.hxx" using namespace std; @@ -75,7 +67,7 @@ namespace MEDCoupling void MxN_Mapping::prepareSendRecv() { - CommInterface const comm_interface=_union_group->getCommInterface(); + CommInterface comm_interface=_union_group->getCommInterface(); // sending count pattern int* nbsend=new int[_union_group->size()]; int* nbrecv=new int[_union_group->size()]; @@ -84,7 +76,7 @@ namespace MEDCoupling nbsend[i]=_send_proc_offsets[i+1]-_send_proc_offsets[i]; } - auto* group = static_cast<MPIProcessorGroup*>(_union_group); + MPIProcessorGroup* group = static_cast<MPIProcessorGroup*>(_union_group); const MPI_Comm* comm=group->getComm(); comm_interface.allToAll(nbsend, 1, MPI_INT, nbrecv, 1, MPI_INT, @@ -101,8 +93,8 @@ namespace MEDCoupling delete[] nbrecv; _recv_ids.resize(_recv_proc_offsets[_union_group->size()]); - mcIdType* isendbuf=nullptr; - mcIdType* irecvbuf=nullptr; + mcIdType* isendbuf=0; + mcIdType* irecvbuf=0; if (_sending_ids.size()>0) isendbuf = new mcIdType[_sending_ids.size()]; if (_recv_ids.size()>0) @@ -168,12 +160,12 @@ namespace MEDCoupling */ void MxN_Mapping::sendRecv(double* sendfield, MEDCouplingFieldDouble& field) const { - CommInterface const comm_interface=_union_group->getCommInterface(); - const auto* group = static_cast<const MPIProcessorGroup*>(_union_group); + CommInterface comm_interface=_union_group->getCommInterface(); + const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group); int nbcomp=(int)field.getArray()->getNumberOfComponents(); - double* sendbuf=nullptr; - double* recvbuf=nullptr; + double* sendbuf=0; + double* recvbuf=0; if (_sending_ids.size() >0) sendbuf = new double[_sending_ids.size()*nbcomp]; if (_recv_ids.size()>0) @@ -231,9 +223,9 @@ namespace MEDCoupling recvptr++; } } - if (sendbuf!=nullptr && getAllToAllMethod()== Native) + if (sendbuf!=0 && getAllToAllMethod()== Native) delete[] sendbuf; - if (recvbuf !=nullptr) + if (recvbuf !=0) delete[] recvbuf; delete[] sendcounts; delete[] recvcounts; @@ -251,12 +243,12 @@ namespace MEDCoupling */ void MxN_Mapping::reverseSendRecv(double* recvfield, MEDCouplingFieldDouble& field) const { - CommInterface const comm_interface=_union_group->getCommInterface(); - const auto* group = static_cast<const MPIProcessorGroup*>(_union_group); + CommInterface comm_interface=_union_group->getCommInterface(); + const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group); int nbcomp=(int)field.getArray()->getNumberOfComponents(); - double* sendbuf=nullptr; - double* recvbuf=nullptr; + double* sendbuf=0; + double* recvbuf=0; if (_recv_ids.size() >0) sendbuf = new double[_recv_ids.size()*nbcomp]; if (_sending_ids.size()>0) @@ -311,9 +303,9 @@ namespace MEDCoupling recvptr++; } } - if (sendbuf!=nullptr && getAllToAllMethod() == Native) + if (sendbuf!=0 && getAllToAllMethod() == Native) delete[] sendbuf; - if (recvbuf!=nullptr) + if (recvbuf!=0) delete[] recvbuf; delete[] sendcounts; delete[] recvcounts; diff --git a/src/ParaMEDMEM/MxN_Mapping.hxx b/src/ParaMEDMEM/MxN_Mapping.hxx index 1f12d0c22..9f488c24a 100644 --- a/src/ParaMEDMEM/MxN_Mapping.hxx +++ b/src/ParaMEDMEM/MxN_Mapping.hxx @@ -20,13 +20,11 @@ #ifndef __MXN_MAPPING_HXX__ #define __MXN_MAPPING_HXX__ -#include "MCType.hxx" -#include "MCAuto.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MPIAccessDEC.hxx" #include "DECOptions.hxx" -#include <ostream> +#include <vector> namespace MEDCoupling { diff --git a/src/ParaMEDMEM/NonCoincidentDEC.cxx b/src/ParaMEDMEM/NonCoincidentDEC.cxx index d74986974..70df1fb64 100644 --- a/src/ParaMEDMEM/NonCoincidentDEC.cxx +++ b/src/ParaMEDMEM/NonCoincidentDEC.cxx @@ -17,12 +17,13 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include <cstddef> #include <mpi.h> -#include <string> +#include "CommInterface.hxx" #include "Topology.hxx" +#include "BlockTopology.hxx" #include "ComponentTopology.hxx" #include "ParaFIELD.hxx" +#include "MPIProcessorGroup.hxx" #include "DEC.hxx" #include "NonCoincidentDEC.hxx" @@ -241,7 +242,8 @@ namespace MEDCoupling } NonCoincidentDEC::NonCoincidentDEC() - = default; + { + } /*! Constructor of a non coincident \ref para-dec "DEC" with * a source group on which lies a field lying on a mesh and a @@ -257,7 +259,8 @@ namespace MEDCoupling {} NonCoincidentDEC::~NonCoincidentDEC() - = default; + { + } /*! Synchronization process. Calling this method * synchronizes the topologies so that the target side @@ -344,7 +347,7 @@ namespace MEDCoupling { int nbelems = _local_field->getField()->getSupport()->getMesh()->getNumberOfElements(MED_EN::MED_CELL, MED_EN::MED_ALL_ELEMENTS); int nbcomp = _local_field->getField()->getNumberOfComponents(); - auto* values = new double [nbelems*nbcomp]; + double* values = new double [nbelems*nbcomp]; fvm_locator_exchange_point_var(_locator, 0, values, @@ -367,7 +370,7 @@ namespace MEDCoupling { const double* values=_local_field->getField()->getValue(); int nbcomp = _local_field->getField()->getNumberOfComponents(); - auto* distant_values = new double [_nb_distant_points*nbcomp]; + double* distant_values = new double [_nb_distant_points*nbcomp]; //cheap interpolation : the value of the cell is transferred to the point for (int i=0; i<_nb_distant_points; i++) diff --git a/src/ParaMEDMEM/NonCoincidentDEC.hxx b/src/ParaMEDMEM/NonCoincidentDEC.hxx index 95ba91ebf..160ac6c75 100644 --- a/src/ParaMEDMEM/NonCoincidentDEC.hxx +++ b/src/ParaMEDMEM/NonCoincidentDEC.hxx @@ -21,7 +21,6 @@ #define __NONCOINCIDENTDEC_HXX__ #include "DEC.hxx" -#include "ProcessorGroup.hxx" struct _fvm_locator_t; @@ -35,9 +34,9 @@ namespace MEDCoupling NonCoincidentDEC(); NonCoincidentDEC(ProcessorGroup& , ProcessorGroup&); - ~NonCoincidentDEC() override; + virtual ~NonCoincidentDEC(); - void synchronize() override; + void synchronize(); void recvData(); diff --git a/src/ParaMEDMEM/OverlapDEC.cxx b/src/ParaMEDMEM/OverlapDEC.cxx index feb10d340..2bb5cc152 100644 --- a/src/ParaMEDMEM/OverlapDEC.cxx +++ b/src/ParaMEDMEM/OverlapDEC.cxx @@ -20,28 +20,24 @@ #include "OverlapDEC.hxx" #include "CommInterface.hxx" -#include "MCType.hxx" -#include "MEDCouplingMesh.hxx" #include "ParaMESH.hxx" #include "ParaFIELD.hxx" #include "MPIProcessorGroup.hxx" #include "OverlapElementLocator.hxx" #include "OverlapInterpolationMatrix.hxx" #include "ICoCoMEDDoubleField.hxx" -#include <string> -#include <ostream> namespace MEDCoupling { OverlapDEC::OverlapDEC(const std::set<int>& procIds, const MPI_Comm& world_comm): _load_balancing_algo(1), - _own_group(true),_interpolation_matrix(nullptr), _locator(nullptr), + _own_group(true),_interpolation_matrix(0), _locator(0), _default_field_value(0.0), - _source_field(nullptr),_own_source_field(false), - _target_field(nullptr),_own_target_field(false), + _source_field(0),_own_source_field(false), + _target_field(0),_own_target_field(false), _comm(MPI_COMM_NULL) { - MEDCoupling::CommInterface const comm; + MEDCoupling::CommInterface comm; int *ranks_world=new int[procIds.size()]; // ranks of sources and targets in world_comm std::copy(procIds.begin(),procIds.end(),ranks_world); MPI_Group group,world_group; @@ -53,7 +49,7 @@ namespace MEDCoupling comm.groupFree(&world_group); if(_comm==MPI_COMM_NULL) { - _group=nullptr; + _group=0; return ; } std::set<int> idsUnion; @@ -93,7 +89,7 @@ namespace MEDCoupling _locator = nullptr; if (_comm != MPI_COMM_NULL) { - MEDCoupling::CommInterface const comm; + MEDCoupling::CommInterface comm; comm.commFree(&_comm); } _comm = MPI_COMM_NULL; @@ -135,8 +131,8 @@ namespace MEDCoupling _locator->copyOptions(*this); _locator->exchangeMeshes(*_interpolation_matrix); std::vector< std::pair<int,int> > jobs=_locator->getToDoList(); - std::string const srcMeth=_locator->getSourceMethod(); - std::string const trgMeth=_locator->getTargetMethod(); + std::string srcMeth=_locator->getSourceMethod(); + std::string trgMeth=_locator->getTargetMethod(); for(std::vector< std::pair<int,int> >::const_iterator it=jobs.begin();it!=jobs.end();it++) { const MEDCouplingPointSet *src=_locator->getSourceMesh((*it).first); @@ -174,9 +170,9 @@ namespace MEDCoupling if(!isInGroup()) return ; - auto *paramesh = new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())), + ParaMESH *paramesh = new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())), *_group,field->getMesh()->getName()); - auto *tmpField=new ParaFIELD(field, paramesh, *_group); + ParaFIELD *tmpField=new ParaFIELD(field, paramesh, *_group); tmpField->setOwnSupport(true); attachSourceLocalField(tmpField,true); } @@ -186,9 +182,9 @@ namespace MEDCoupling if(!isInGroup()) return ; - auto *paramesh = new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())), + ParaMESH *paramesh = new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())), *_group,field->getMesh()->getName()); - auto *tmpField=new ParaFIELD(field, paramesh, *_group); + ParaFIELD *tmpField=new ParaFIELD(field, paramesh, *_group); tmpField->setOwnSupport(true); attachTargetLocalField(tmpField,true); } diff --git a/src/ParaMEDMEM/OverlapDEC.hxx b/src/ParaMEDMEM/OverlapDEC.hxx index c31619034..923e5e119 100644 --- a/src/ParaMEDMEM/OverlapDEC.hxx +++ b/src/ParaMEDMEM/OverlapDEC.hxx @@ -23,10 +23,9 @@ #include "DEC.hxx" #include "InterpolationOptions.hxx" -#include "MEDCouplingFieldDouble.hxx" #include <mpi.h> -#include <ostream> +#include <string> namespace ICoCo { class MEDDoubleField; @@ -238,13 +237,13 @@ namespace MEDCoupling { public: OverlapDEC(const std::set<int>& procIds,const MPI_Comm& world_comm=MPI_COMM_WORLD); - ~OverlapDEC() override; + virtual ~OverlapDEC(); void release(); - void sendRecvData(bool way=true) override; + void sendRecvData(bool way=true); void sendData(); void recvData(); - void synchronize() override; + void synchronize(); void attachSourceLocalField(ParaFIELD *field, bool ownPt=false); void attachTargetLocalField(ParaFIELD *field, bool ownPt=false); void attachSourceLocalField(MEDCouplingFieldDouble *field); diff --git a/src/ParaMEDMEM/OverlapElementLocator.cxx b/src/ParaMEDMEM/OverlapElementLocator.cxx index f0ef74434..4d85fddd2 100644 --- a/src/ParaMEDMEM/OverlapElementLocator.cxx +++ b/src/ParaMEDMEM/OverlapElementLocator.cxx @@ -21,22 +21,19 @@ #include "OverlapElementLocator.hxx" #include "CommInterface.hxx" -#include "MCType.hxx" -#include "ParaIdType.hxx" -#include "MEDCouplingMesh.hxx" #include "Topology.hxx" +#include "BlockTopology.hxx" #include "ParaFIELD.hxx" #include "ParaMESH.hxx" #include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" #include "OverlapInterpolationMatrix.hxx" -#include "MEDCouplingFieldDiscretization.hxx" #include "MEDCouplingFieldDouble.hxx" +#include "MEDCouplingFieldDiscretization.hxx" +#include "DirectedBoundingBox.hxx" #include "InterpKernelAutoPtr.hxx" #include <limits> -#include <ostream> -#include <string> using namespace std; @@ -48,9 +45,9 @@ namespace MEDCoupling const ProcessorGroup& group, double epsAbs, int workSharingAlgo) : _local_source_field(sourceField), _local_target_field(targetField), - _local_source_mesh(nullptr), - _local_target_mesh(nullptr), - _domain_bounding_boxes(nullptr), + _local_source_mesh(0), + _local_target_mesh(0), + _domain_bounding_boxes(0), _epsAbs(epsAbs), _group(group) { @@ -83,14 +80,14 @@ namespace MEDCoupling const MPI_Comm *OverlapElementLocator::getCommunicator() const { - const auto* group=static_cast<const MPIProcessorGroup*>(&_group); + const MPIProcessorGroup* group=static_cast<const MPIProcessorGroup*>(&_group); return group->getComm(); } void OverlapElementLocator::computeBoundingBoxesAndInteractionList() { - CommInterface const comm_interface=_group.getCommInterface(); - const auto* group=static_cast<const MPIProcessorGroup*> (&_group); + CommInterface comm_interface=_group.getCommInterface(); + const MPIProcessorGroup* group=static_cast<const MPIProcessorGroup*> (&_group); _local_space_dim=0; if(_local_source_mesh) _local_space_dim=_local_source_mesh->getSpaceDimension(); @@ -98,7 +95,7 @@ namespace MEDCoupling _local_space_dim=_local_target_mesh->getSpaceDimension(); // const MPI_Comm* comm = group->getComm(); - int const bbSize=2*2*_local_space_dim;//2 (for source/target) 2 (min/max) + int bbSize=2*2*_local_space_dim;//2 (for source/target) 2 (min/max) _domain_bounding_boxes=new double[bbSize*_group.size()]; INTERP_KERNEL::AutoPtr<double> minmax=new double[bbSize]; //Format minmax : Xmin_src,Xmax_src,Ymin_src,Ymax_src,Zmin_src,Zmax_src,Xmin_trg,Xmax_trg,Ymin_trg,Ymax_trg,Zmin_trg,Zmax_trg @@ -154,7 +151,7 @@ namespace MEDCoupling //If _group.myRank()==myPair.first, current proc should fetch target mesh of myPair.second (if different from _group.myRank()). //If _group.myRank()==myPair.second, current proc should fetch source mesh of myPair.second. - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); _to_do_list=_all_todo_lists[myProcId]; #ifdef DEC_DEBUG @@ -296,7 +293,7 @@ namespace MEDCoupling // // Final formatting - extract remaining keys in each map: // - int const myProcId = _group.myRank(); + int myProcId = _group.myRank(); _all_todo_lists.resize(grp_size); procID = 0; for(const auto& itVector: full_set) @@ -329,7 +326,7 @@ namespace MEDCoupling { // Feeding now '_procs_to_send*'. A same id can appears twice. The second parameter in pair means what // to send true=source, false=target - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); _procs_to_send_mesh.clear(); _procs_to_send_field.clear(); for(int i=0;i<_group.size();i++) @@ -365,7 +362,7 @@ namespace MEDCoupling */ void OverlapElementLocator::exchangeMeshes(OverlapInterpolationMatrix& matrix) { - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); //starting to receive every procs whose id is lower than myProcId. std::vector<Proc_SrcOrTgt> firstRcv, secondRcv; for (const ProcCouple& pc: _to_do_list) @@ -410,7 +407,7 @@ namespace MEDCoupling const MEDCouplingPointSet *OverlapElementLocator::getSourceMesh(int procId) const { - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); if(myProcId==procId) return _local_source_mesh; Proc_SrcOrTgt p(procId,true); @@ -420,9 +417,9 @@ namespace MEDCoupling const DataArrayIdType *OverlapElementLocator::getSourceIds(int procId) const { - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); if(myProcId==procId) - return nullptr; + return 0; Proc_SrcOrTgt p(procId,true); std::map<Proc_SrcOrTgt, AutoDAInt >::const_iterator it=_remote_elems.find(p); return (*it).second; @@ -430,7 +427,7 @@ namespace MEDCoupling const MEDCouplingPointSet *OverlapElementLocator::getTargetMesh(int procId) const { - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); if(myProcId==procId) return _local_target_mesh; Proc_SrcOrTgt p(procId,false); @@ -440,9 +437,9 @@ namespace MEDCoupling const DataArrayIdType *OverlapElementLocator::getTargetIds(int procId) const { - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); if(myProcId==procId) - return nullptr; + return 0; Proc_SrcOrTgt p(procId,false); std::map<Proc_SrcOrTgt, AutoDAInt >::const_iterator it=_remote_elems.find(p); return (*it).second; @@ -461,7 +458,7 @@ namespace MEDCoupling for (int idim=0; idim < _local_space_dim; idim++) { - bool const intersects = (target_bb[idim*2]<source_bb[idim*2+1]+_epsAbs) + bool intersects = (target_bb[idim*2]<source_bb[idim*2+1]+_epsAbs) && (source_bb[idim*2]<target_bb[idim*2+1]+_epsAbs); if (!intersects) return false; @@ -486,9 +483,9 @@ namespace MEDCoupling #endif //int myProcId=_group.myRank(); - const double *distant_bb=nullptr; - MEDCouplingPointSet *local_mesh=nullptr; - const ParaFIELD *field=nullptr; + const double *distant_bb=0; + MEDCouplingPointSet *local_mesh=0; + const ParaFIELD *field=0; if(sourceOrTarget)//source for local mesh but target for distant mesh { distant_bb=_domain_bounding_boxes+procId*2*2*_local_space_dim+2*_local_space_dim; @@ -503,7 +500,7 @@ namespace MEDCoupling } AutoDAInt elems=local_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment()); DataArrayIdType *old2new_map; - auto *send_mesh=static_cast<MEDCouplingPointSet *>(field->getField()->buildSubMeshData(elems->begin(),elems->end(),old2new_map)); + MEDCouplingPointSet *send_mesh=static_cast<MEDCouplingPointSet *>(field->getField()->buildSubMeshData(elems->begin(),elems->end(),old2new_map)); if(sourceOrTarget) matrix.keepTracksOfSourceIds(procId,old2new_map); else @@ -526,8 +523,8 @@ namespace MEDCoupling scout << "(" << rank << ") RCV part of " << st << " FROM: " << procId; std::cout << scout.str() << "\n"; #endif - DataArrayIdType *old2new_map=nullptr; - MEDCouplingPointSet *m=nullptr; + DataArrayIdType *old2new_map=0; + MEDCouplingPointSet *m=0; receiveMesh(procId,m,old2new_map); Proc_SrcOrTgt p(procId,sourceOrTarget); _remote_meshes[p]=m; @@ -536,7 +533,7 @@ namespace MEDCoupling void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const { - CommInterface const comInterface=_group.getCommInterface(); + CommInterface comInterface=_group.getCommInterface(); // First stage : exchanging sizes vector<double> tinyInfoLocalD;//tinyInfoLocalD not used for the moment @@ -551,8 +548,8 @@ namespace MEDCoupling comInterface.send(&lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm); comInterface.send(&tinyInfoLocal[0],(int)tinyInfoLocal.size(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+1,*comm); // - DataArrayIdType *v1Local=nullptr; - DataArrayDouble *v2Local=nullptr; + DataArrayIdType *v1Local=0; + DataArrayDouble *v2Local=0; mesh->serialize(v1Local,v2Local); comInterface.send(v1Local->getPointer(),(int)v1Local->getNbOfElems(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+2,*comm); comInterface.send(v2Local->getPointer(),(int)v2Local->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm); @@ -568,7 +565,7 @@ namespace MEDCoupling mcIdType lgth[2]; MPI_Status status; const MPI_Comm *comm=getCommunicator(); - CommInterface const comInterface=_group.getCommInterface(); + CommInterface comInterface=_group.getCommInterface(); comInterface.recv(lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm,&status); std::vector<mcIdType> tinyInfoDistant(lgth[0]); ids=DataArrayIdType::New(); diff --git a/src/ParaMEDMEM/OverlapElementLocator.hxx b/src/ParaMEDMEM/OverlapElementLocator.hxx index c10c7909f..5d44c2ff9 100644 --- a/src/ParaMEDMEM/OverlapElementLocator.hxx +++ b/src/ParaMEDMEM/OverlapElementLocator.hxx @@ -22,14 +22,15 @@ #define __OVERLAPELEMENTLOCATOR_HXX__ #include "InterpolationOptions.hxx" -#include "MCType.hxx" +#include "MEDCouplingNatureOfField.hxx" #include "MEDCouplingPointSet.hxx" +#include "MEDCouplingMemArray.hxx" #include "MCAuto.hxx" #include <mpi.h> -#include <utility> -#include <string> -#include <ostream> +#include <vector> +#include <map> +#include <set> //#define DEC_DEBUG @@ -39,7 +40,7 @@ namespace MEDCoupling class ProcessorGroup; class OverlapInterpolationMatrix; - using ProcCouple = std::pair<int, int>; // a couple of proc IDs, typically used to define a exchange betw 2 procs + typedef std::pair<int,int> ProcCouple; // a couple of proc IDs, typically used to define a exchange betw 2 procs class OverlapElementLocator : public INTERP_KERNEL::InterpolationOptions { @@ -70,9 +71,9 @@ namespace MEDCoupling void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const; void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const; private: - using AutoMCPointSet = MCAuto<MEDCouplingPointSet>; - using AutoDAInt = MCAuto<DataArrayInt64>; - using Proc_SrcOrTgt = std::pair<int, bool>; ///< a key indicating a proc ID and whether the data is for source mesh/field or target mesh/field + typedef MCAuto< MEDCouplingPointSet > AutoMCPointSet; + typedef MCAuto< DataArrayIdType > AutoDAInt; + typedef std::pair<int,bool> Proc_SrcOrTgt; ///< a key indicating a proc ID and whether the data is for source mesh/field or target mesh/field static const int START_TAG_MESH_XCH; diff --git a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx index 21bc60160..00b64df0c 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx @@ -19,30 +19,27 @@ // Author : Anthony Geay (CEA/DEN) #include "OverlapInterpolationMatrix.hxx" -#include "DECOptions.hxx" -#include "OverlapElementLocator.hxx" -#include "MCType.hxx" -#include "MEDCouplingNormalizedUnstructuredMesh.txx" -#include "Interpolation2D.hxx" -#include "Interpolation3D.hxx" -#include "Interpolation2D3D.hxx" -#include "Interpolation2D1D.hxx" -#include "Interpolation1D.hxx" -#include "MEDCouplingNatureOfFieldEnum" #include "ParaMESH.hxx" #include "ParaFIELD.hxx" #include "ProcessorGroup.hxx" +#include "TranslationRotationMatrix.hxx" +#include "Interpolation.hxx" +#include "Interpolation1D.txx" #include "Interpolation2DCurve.hxx" +#include "Interpolation2D.txx" #include "Interpolation3DSurf.hxx" #include "Interpolation3D.txx" #include "Interpolation2D3D.txx" #include "Interpolation2D1D.txx" #include "MEDCouplingUMesh.hxx" +#include "MEDCouplingFieldDouble.hxx" +#include "MEDCouplingNormalizedUnstructuredMesh.txx" #include "InterpolationOptions.hxx" +#include "NormalizedUnstructuredMesh.hxx" #include "ElementLocator.hxx" -#include "MEDCouplingFieldDouble.hxx" +#include "InterpKernelAutoPtr.hxx" -#include <string> +#include <algorithm> using namespace std; @@ -75,7 +72,8 @@ namespace MEDCoupling } OverlapInterpolationMatrix::~OverlapInterpolationMatrix() - = default; + { + } // TODO? Merge with MEDCouplingRemapper::prepareInterpKernelOnlyUU() ? /**! @@ -95,8 +93,8 @@ namespace MEDCoupling vector<SparseDoubleVec > sparse_matrix_part; mcIdType colSize=0; //computation of the intersection volumes between source and target elements - const auto *trgC=dynamic_cast<const MEDCouplingUMesh *>(trg); - const auto *srcC=dynamic_cast<const MEDCouplingUMesh *>(src); + const MEDCouplingUMesh *trgC=dynamic_cast<const MEDCouplingUMesh *>(trg); + const MEDCouplingUMesh *srcC=dynamic_cast<const MEDCouplingUMesh *>(src); if ( src->getMeshDimension() == -1 ) { if(trgC->getMeshDimension()==2 && trgC->getSpaceDimension()==2) diff --git a/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx b/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx index db8f1f28b..690e1120d 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx @@ -21,12 +21,10 @@ #ifndef __OVERLAPINTERPOLATIONMATRIX_HXX__ #define __OVERLAPINTERPOLATIONMATRIX_HXX__ -#include "MCType.hxx" -#include "OverlapElementLocator.hxx" +#include "MPIAccessDEC.hxx" #include "OverlapMapping.hxx" #include "InterpolationOptions.hxx" #include "DECOptions.hxx" -#include <string> namespace MEDCoupling { diff --git a/src/ParaMEDMEM/OverlapMapping.cxx b/src/ParaMEDMEM/OverlapMapping.cxx index 4b512d063..051ad3043 100644 --- a/src/ParaMEDMEM/OverlapMapping.cxx +++ b/src/ParaMEDMEM/OverlapMapping.cxx @@ -19,19 +19,14 @@ // Author : Anthony Geay (CEA/DEN) #include "OverlapMapping.hxx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MCIdType.hxx" #include "MPIProcessorGroup.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MCAuto.hxx" #include "InterpKernelAutoPtr.hxx" -#include "OverlapElementLocator.hxx" -#include "ParaIdType.hxx" -#include <cstddef> +#include <numeric> #include <algorithm> using namespace MEDCoupling; @@ -69,7 +64,7 @@ void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayIdType *ids) * * One of the 2 is necessarily null (the two can be null together) */ -void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType * /*trgIds*/, int trgProcId) +void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType *trgIds, int trgProcId) { _matrixes_st.push_back(matrixST); _source_proc_id_st.push_back(srcProcId); @@ -102,15 +97,15 @@ void OverlapMapping::prepare(const std::vector< int >& procsToSendField, mcIdTyp printMatrixesST(); #endif - CommInterface const commInterface=_group.getCommInterface(); - const auto *group=static_cast<const MPIProcessorGroup*>(&_group); + CommInterface commInterface=_group.getCommInterface(); + const MPIProcessorGroup *group=static_cast<const MPIProcessorGroup*>(&_group); const MPI_Comm *comm=group->getComm(); std::size_t grpSize=_group.size(); INTERP_KERNEL::AutoPtr<mcIdType> nbsend=new mcIdType[grpSize]; INTERP_KERNEL::AutoPtr<int> nbsend2=new int[grpSize]; INTERP_KERNEL::AutoPtr<int> nbsend3=new int[grpSize]; std::fill<mcIdType *>(nbsend,nbsend+grpSize,0); - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); for(std::size_t i=0;i<_matrixes_st.size();i++) if(_source_proc_id_st[i]==myProcId) nbsend[_target_proc_id_st[i]]=(int)_matrixes_st[i].size(); @@ -121,7 +116,7 @@ void OverlapMapping::prepare(const std::vector< int >& procsToSendField, mcIdTyp INTERP_KERNEL::AutoPtr<int> nbrecv1=new int[grpSize]; INTERP_KERNEL::AutoPtr<int> nbrecv2=new int[grpSize]; // - mcIdType *tmp=nullptr; + mcIdType *tmp=0; serializeMatrixStep0ST(nbrecv, tmp,nbsend2,nbsend3, nbrecv1,nbrecv2); @@ -134,7 +129,7 @@ void OverlapMapping::prepare(const std::vector< int >& procsToSendField, mcIdTyp std::fill<int *>(nbsend2,nbsend2+grpSize,0); INTERP_KERNEL::AutoPtr<int> nbrecv3=new int[grpSize]; INTERP_KERNEL::AutoPtr<int> nbrecv4=new int[grpSize]; - double *tmp2=nullptr; + double *tmp2=0; mcIdType lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2, tmp,tmp2, nbsend2,nbsend3,nbrecv3,nbrecv4); @@ -245,7 +240,7 @@ void OverlapMapping::computeDenoRevIntegral(const DataArrayDouble & targetAreas) */ void OverlapMapping::computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg) { - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); // _the_deno_st.clear(); std::size_t sz1=_the_matrix_st.size(); @@ -310,10 +305,10 @@ void OverlapMapping::computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg) void OverlapMapping::serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets, int *countForRecv, int *offsetsForRecv) const { - std::size_t const grpSize=_group.size(); + std::size_t grpSize=_group.size(); std::fill<int *>(count,count+grpSize,0); std::size_t szz=0; - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); for(std::size_t i=0;i<_matrixes_st.size();i++) { if(_source_proc_id_st[i]==myProcId && _matrixes_st[i].size())// && _target_proc_id_st[i]!=myProcId @@ -355,12 +350,12 @@ void OverlapMapping::serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdTy * This method performs step#1 and step#2/3. It returns the size of expected array to get allToAllV. * It is where the locally computed matrices are serialized to be sent to adequate final proc. */ -mcIdType OverlapMapping::serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int * /*countStep0*/, const int *offsStep0, +mcIdType OverlapMapping::serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int *countStep0, const int *offsStep0, mcIdType *&bigArrI, double *&bigArrD, int *count, int *offsets, int *countForRecv, int *offsForRecv) const { - std::size_t const grpSize=_group.size(); - int const myProcId=_group.myRank(); + std::size_t grpSize=_group.size(); + int myProcId=_group.myRank(); offsForRecv[0]=0; mcIdType szz=0; for(std::size_t i=0;i<grpSize;i++) @@ -423,15 +418,15 @@ mcIdType OverlapMapping::serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, co * - The second is the pseudo id of source proc (correspondence with true id is in attribute _the_matrix_st_source_proc_id and _the_matrix_st_source_ids) * - the third is the srcId in the pseudo source proc */ -void OverlapMapping::unserializationST(mcIdType /*nbOfTrgElems*/, +void OverlapMapping::unserializationST(mcIdType nbOfTrgElems, const mcIdType *nbOfElemsSrcPerProc,//first all2all - const mcIdType *bigArrRecv, const int * /*bigArrRecvCounts*/, const int *bigArrRecvOffs,//2nd all2all - const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int * /*bigArrRecv2Count*/, const int *bigArrRecv2Offs)//3rd and 4th all2alls + const mcIdType *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,//2nd all2all + const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs)//3rd and 4th all2alls { _the_matrix_st.clear(); _the_matrix_st_source_proc_id.clear(); // - std::size_t const grpSize=_group.size(); + std::size_t grpSize=_group.size(); for(unsigned int i=0;i<grpSize;i++) if(nbOfElemsSrcPerProc[i]!=0) _the_matrix_st_source_proc_id.push_back(i); @@ -445,8 +440,8 @@ void OverlapMapping::unserializationST(mcIdType /*nbOfTrgElems*/, _the_matrix_st[j].resize(nbOfElemsSrcPerProc[i]); for(mcIdType k=0;k<nbOfElemsSrcPerProc[i];k++) { - mcIdType const offs=bigArrRecv[bigArrRecvOffs[i]+k]; - mcIdType const lgthOfMap=bigArrRecv[bigArrRecvOffs[i]+k+1]-offs; + mcIdType offs=bigArrRecv[bigArrRecvOffs[i]+k]; + mcIdType lgthOfMap=bigArrRecv[bigArrRecvOffs[i]+k+1]-offs; for(mcIdType l=0;l<lgthOfMap;l++) _the_matrix_st[j][k][bigArrRecv2[bigArrRecv2Offs[i]+offs+l]]=bigArrDRecv2[bigArrRecv2Offs[i]+offs+l]; } @@ -462,7 +457,7 @@ void OverlapMapping::unserializationST(mcIdType /*nbOfTrgElems*/, */ void OverlapMapping::finishToFillFinalMatrixST() { - int const myProcId=_group.myRank(); + int myProcId=_group.myRank(); std::size_t sz=_matrixes_st.size(); int nbOfEntryToAdd=0; for(std::size_t i=0;i<sz;i++) @@ -471,7 +466,7 @@ void OverlapMapping::finishToFillFinalMatrixST() if(nbOfEntryToAdd==0) return ; std::size_t oldNbOfEntry=_the_matrix_st.size(); - std::size_t const newNbOfEntry=oldNbOfEntry+nbOfEntryToAdd; + std::size_t newNbOfEntry=oldNbOfEntry+nbOfEntryToAdd; _the_matrix_st.resize(newNbOfEntry); std::size_t j=oldNbOfEntry; for(std::size_t i=0;i<sz;i++) @@ -494,11 +489,11 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl using namespace std; std::size_t nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test - CommInterface const commInterface=_group.getCommInterface(); - const auto *group=static_cast<const MPIProcessorGroup*>(&_group); + CommInterface commInterface=_group.getCommInterface(); + const MPIProcessorGroup *group=static_cast<const MPIProcessorGroup*>(&_group); const MPI_Comm *comm=group->getComm(); int grpSize=_group.size(); - int const myProcID=_group.myRank(); + int myProcID=_group.myRank(); // INTERP_KERNEL::AutoPtr<int> nbsend=new int[grpSize]; INTERP_KERNEL::AutoPtr<int> nbsend2=new int[grpSize]; @@ -624,7 +619,7 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfCompo]; // By default field value set to default value - so mark which cells are hit - mcIdType const ntup = fieldOutput->getNumberOfTuples(); + mcIdType ntup = fieldOutput->getNumberOfTuples(); INTERP_KERNEL::AutoPtr<bool> hit_cells = new bool[ntup]; std::fill((bool *)hit_cells, (bool *)hit_cells+ntup, false); @@ -783,8 +778,8 @@ void OverlapMapping::fillSourceIdsZipReceivedForMultiply() /* When it is called, only the bits received from other processors (i.e. the remotely executed jobs) are in the big matrix _the_matrix_st. */ - CommInterface const commInterface=_group.getCommInterface(); - int const myProcId=_group.myRank(); + CommInterface commInterface=_group.getCommInterface(); + int myProcId=_group.myRank(); std::size_t nbOfMatrixRecveived=_the_matrix_st_source_proc_id.size(); for(std::size_t i=0;i<nbOfMatrixRecveived;i++) { diff --git a/src/ParaMEDMEM/OverlapMapping.hxx b/src/ParaMEDMEM/OverlapMapping.hxx index 688408320..b3b0e6d97 100644 --- a/src/ParaMEDMEM/OverlapMapping.hxx +++ b/src/ParaMEDMEM/OverlapMapping.hxx @@ -21,13 +21,11 @@ #ifndef __OVERLAPMAPPING_HXX__ #define __OVERLAPMAPPING_HXX__ -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" +#include "MCAuto.hxx" #include "OverlapElementLocator.hxx" #include <vector> #include <map> - //#define DEC_DEBUG namespace MEDCoupling diff --git a/src/ParaMEDMEM/ParaDataArray.cxx b/src/ParaMEDMEM/ParaDataArray.cxx index 7bd2249c0..54b82215f 100644 --- a/src/ParaMEDMEM/ParaDataArray.cxx +++ b/src/ParaMEDMEM/ParaDataArray.cxx @@ -19,8 +19,6 @@ // Author : Anthony Geay (EDF R&D) #include "ParaDataArray.txx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.hxx" using namespace MEDCoupling; diff --git a/src/ParaMEDMEM/ParaDataArray.hxx b/src/ParaMEDMEM/ParaDataArray.hxx index 107612848..ac8516443 100644 --- a/src/ParaMEDMEM/ParaDataArray.hxx +++ b/src/ParaMEDMEM/ParaDataArray.hxx @@ -20,14 +20,7 @@ #pragma once -#include "MCAuto.hxx" -#include "MCType.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingTraits.hxx" -#include <cstddef> -#include <vector> -#include <string> namespace MEDCoupling { diff --git a/src/ParaMEDMEM/ParaDataArray.txx b/src/ParaMEDMEM/ParaDataArray.txx index 232c7c8ac..d8cdbfc0c 100644 --- a/src/ParaMEDMEM/ParaDataArray.txx +++ b/src/ParaMEDMEM/ParaDataArray.txx @@ -20,17 +20,11 @@ #pragma once -#include "MEDCouplingTraits.hxx" -#include "MCType.hxx" -#include "MEDCouplingMemArray.txx" -#include "MCAuto.hxx" #include "ParaDataArray.hxx" #include "CommInterface.hxx" +#include "MEDCouplingMemArray.txx" -#include <cstddef> -#include <limits> #include <sstream> -#include <string> namespace MEDCoupling { diff --git a/src/ParaMEDMEM/ParaFIELD.cxx b/src/ParaMEDMEM/ParaFIELD.cxx index c4b396180..f90fe3444 100644 --- a/src/ParaMEDMEM/ParaFIELD.cxx +++ b/src/ParaMEDMEM/ParaFIELD.cxx @@ -17,10 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingMemArray.hxx" -#include "DisjointDEC.hxx" -#include "MCType.hxx" #include "Topology.hxx" #include "BlockTopology.hxx" #include "ComponentTopology.hxx" @@ -32,7 +28,9 @@ #include "ParaFIELD.hxx" #include "ParaMESH.hxx" #include "InterpKernelUtilities.hxx" +#include "InterpolationMatrix.hxx" +#include <numeric> namespace MEDCoupling { @@ -70,13 +68,13 @@ namespace MEDCoupling */ ParaFIELD::ParaFIELD(TypeOfField type, TypeOfTimeDiscretization td, ParaMESH* para_support, const ComponentTopology& component_topology) - :_field(nullptr), - _component_topology(component_topology),_topology(nullptr),_own_support(false), + :_field(0), + _component_topology(component_topology),_topology(0),_own_support(false), _support(para_support) { if (para_support->isStructured() || (para_support->getTopology()->getProcGroup()->size()==1 && component_topology.nbBlocks()!=1)) { - const auto* source_topo = dynamic_cast<const BlockTopology*>(para_support->getTopology()); + const BlockTopology* source_topo = dynamic_cast<const BlockTopology*>(para_support->getTopology()); _topology=new BlockTopology(*source_topo,component_topology); } else @@ -85,12 +83,12 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception(LOCALIZED("ParaFIELD constructor : Unstructured Support not taken into account with component topology yet")); else { - const auto* source_topo=dynamic_cast<const BlockTopology*> (para_support->getTopology()); - int const nb_local_comp=component_topology.nbLocalComponents(); + const BlockTopology* source_topo=dynamic_cast<const BlockTopology*> (para_support->getTopology()); + int nb_local_comp=component_topology.nbLocalComponents(); _topology=new BlockTopology(*source_topo,nb_local_comp); } } - int const nb_components = component_topology.nbLocalComponents(); + int nb_components = component_topology.nbLocalComponents(); if (nb_components!=0) { _field=MEDCouplingFieldDouble::New(type,td); @@ -112,14 +110,14 @@ namespace MEDCoupling This constructor supposes that support underlying \a subdomain_field has no ParaMESH attached and it therefore recreates one. It therefore takes ownership over _support. The component topology associated with the field is a basic one (all components on the same processor). */ - ParaFIELD::ParaFIELD(MEDCouplingFieldDouble* subdomain_field, ParaMESH *sup, const ProcessorGroup& /*proc_group*/): + ParaFIELD::ParaFIELD(MEDCouplingFieldDouble* subdomain_field, ParaMESH *sup, const ProcessorGroup& proc_group): _field(subdomain_field), - _component_topology(ComponentTopology((int)_field->getNumberOfComponents())),_topology(nullptr),_own_support(false), + _component_topology(ComponentTopology((int)_field->getNumberOfComponents())),_topology(0),_own_support(false), _support(sup) { if(_field) _field->incrRef(); - const auto* source_topo=dynamic_cast<const BlockTopology*> (_support->getTopology()); + const BlockTopology* source_topo=dynamic_cast<const BlockTopology*> (_support->getTopology()); _topology=new BlockTopology(*source_topo,_component_topology.nbLocalComponents()); } @@ -148,10 +146,10 @@ namespace MEDCoupling _topology = nullptr; } - void ParaFIELD::synchronizeTarget(ParaFIELD* /*source_field*/) + void ParaFIELD::synchronizeTarget(ParaFIELD* source_field) { DisjointDEC* data_channel; - if (dynamic_cast<BlockTopology*>(_topology)!=nullptr) + if (dynamic_cast<BlockTopology*>(_topology)!=0) { data_channel=new StructuredCoincidentDEC; } @@ -167,10 +165,10 @@ namespace MEDCoupling delete data_channel; } - void ParaFIELD::synchronizeSource(ParaFIELD* /*target_field*/) + void ParaFIELD::synchronizeSource(ParaFIELD* target_field) { DisjointDEC* data_channel; - if (dynamic_cast<BlockTopology*>(_topology)!=nullptr) + if (dynamic_cast<BlockTopology*>(_topology)!=0) { data_channel=new StructuredCoincidentDEC; } @@ -195,24 +193,24 @@ namespace MEDCoupling DataArrayIdType* ParaFIELD::returnCumulativeGlobalNumbering() const { if(!_field) - return nullptr; - TypeOfField const type=_field->getTypeOfField(); + return 0; + TypeOfField type=_field->getTypeOfField(); switch(type) { case ON_CELLS: - return nullptr; + return 0; case ON_NODES: return _support->getGlobalNumberingNodeDA(); default: - return nullptr; + return 0; } } DataArrayIdType* ParaFIELD::returnGlobalNumbering() const { if(!_field) - return nullptr; - TypeOfField const type=_field->getTypeOfField(); + return 0; + TypeOfField type=_field->getTypeOfField(); switch(type) { case ON_CELLS: @@ -220,7 +218,7 @@ namespace MEDCoupling case ON_NODES: return _support->getGlobalNumberingNodeDA(); default: - return nullptr; + return 0; } } @@ -234,7 +232,7 @@ namespace MEDCoupling over the all domain. */ double ParaFIELD::getVolumeIntegral(int icomp, bool isWAbs) const { - CommInterface const comm_interface = _topology->getProcGroup()->getCommInterface(); + CommInterface comm_interface = _topology->getProcGroup()->getCommInterface(); double integral=_field->integral(icomp,isWAbs); double total=0.; const MPI_Comm* comm = (dynamic_cast<const MPIProcessorGroup*>(_topology->getProcGroup()))->getComm(); diff --git a/src/ParaMEDMEM/ParaGRID.cxx b/src/ParaMEDMEM/ParaGRID.cxx index d1b5a7c86..7ea1d0385 100644 --- a/src/ParaMEDMEM/ParaGRID.cxx +++ b/src/ParaMEDMEM/ParaGRID.cxx @@ -20,9 +20,11 @@ #include "ParaGRID.hxx" #include "Topology.hxx" #include "BlockTopology.hxx" +#include "MEDCouplingMemArray.hxx" #include "MEDCouplingCMesh.hxx" #include "InterpKernelUtilities.hxx" +#include <iostream> using namespace std; @@ -33,13 +35,13 @@ namespace MEDCoupling _global_axis() { _block_topology = dynamic_cast<BlockTopology*>(topology); - if(_block_topology==nullptr) + if(_block_topology==0) throw INTERP_KERNEL::Exception(LOCALIZED("ParaGRID::ParaGRID topology must be block topology")); if (!_block_topology->getProcGroup()->containsMyRank()) return; - int const dimension=_block_topology->getDimension() ; + int dimension=_block_topology->getDimension() ; if (dimension != global_grid->getSpaceDimension()) throw INTERP_KERNEL::Exception(LOCALIZED("ParaGrid::ParaGrid incompatible topology")); _grid=global_grid; diff --git a/src/ParaMEDMEM/ParaGRID.hxx b/src/ParaMEDMEM/ParaGRID.hxx index 372a51446..3bc60afda 100644 --- a/src/ParaMEDMEM/ParaGRID.hxx +++ b/src/ParaMEDMEM/ParaGRID.hxx @@ -20,6 +20,7 @@ #ifndef __PARAGRID_HXX__ #define __PARAGRID_HXX__ +#include "InterpolationUtils.hxx" #include <vector> diff --git a/src/ParaMEDMEM/ParaMESH.cxx b/src/ParaMEDMEM/ParaMESH.cxx index f89e3f705..92965d4c2 100644 --- a/src/ParaMEDMEM/ParaMESH.cxx +++ b/src/ParaMEDMEM/ParaMESH.cxx @@ -19,13 +19,14 @@ // #include "ParaMESH.hxx" -#include "MEDCouplingPointSet.hxx" -#include "MCType.hxx" #include "ProcessorGroup.hxx" +#include "MPIProcessorGroup.hxx" #include "Topology.hxx" #include "BlockTopology.hxx" +#include "MEDCouplingMemArray.hxx" -#include <string> +#include <fstream> +#include <vector> //inclusion for the namespaces using namespace std; @@ -46,14 +47,14 @@ namespace MEDCoupling _cell_global.takeRef(CorrespElt_local2global); } - ParaMESH::ParaMESH( MEDCouplingPointSet *mesh, const ProcessorGroup& proc_group, const std::string& /*name*/): + ParaMESH::ParaMESH( MEDCouplingPointSet *mesh, const ProcessorGroup& proc_group, const std::string& name): _my_domain_id(proc_group.myRank()), _block_topology(new BlockTopology(proc_group, mesh->getNumberOfCells())) { _cell_mesh.takeRef(mesh); - mcIdType const nb_elem=mesh->getNumberOfCells(); + mcIdType nb_elem=mesh->getNumberOfCells(); _explicit_topology=new BlockTopology(proc_group,nb_elem); - mcIdType const nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); _cell_global = DataArrayIdType::New(); _cell_global->alloc(nbOfCells,1); mcIdType *cellglobal=_cell_global->getPointer(); diff --git a/src/ParaMEDMEM/ParaMESH.hxx b/src/ParaMEDMEM/ParaMESH.hxx index 2c5b99560..ab9cb5f3b 100644 --- a/src/ParaMEDMEM/ParaMESH.hxx +++ b/src/ParaMEDMEM/ParaMESH.hxx @@ -19,12 +19,12 @@ #pragma once -#include "MCType.hxx" -#include "MCAuto.hxx" #include "MEDCouplingPointSet.hxx" #include "ProcessorGroup.hxx" +#include "MEDCouplingMemArray.hxx" #include <string> +#include <vector> namespace MEDCoupling { diff --git a/src/ParaMEDMEM/ParaSkyLineArray.cxx b/src/ParaMEDMEM/ParaSkyLineArray.cxx index 93da4bd78..d8d6da424 100644 --- a/src/ParaMEDMEM/ParaSkyLineArray.cxx +++ b/src/ParaMEDMEM/ParaSkyLineArray.cxx @@ -20,17 +20,20 @@ // Author : Anthony Geay (EDF R&D) #include "ParaSkyLineArray.hxx" -#include "MEDCouplingSkyLineArray.hxx" -#include "MCType.hxx" -#include "MCAuto.hxx" +#include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" +#include "Topology.hxx" +#include "BlockTopology.hxx" #include "CommInterface.hxx" #include "MEDCouplingMemArray.hxx" #include "mpi.h" -#include <cstddef> +#include <fstream> #include <sstream> +#include <numeric> +#include <memory> +#include <vector> using namespace MEDCoupling; @@ -75,7 +78,7 @@ std::vector<const BigMemoryObject *> ParaSkyLineArray::getDirectChildrenWithNull MCAuto<ParaSkyLineArray> ParaSkyLineArray::equiRedistribute(mcIdType nbOfEntities) const { MPI_Comm comm(MPI_COMM_WORLD); - CommInterface const ci; + CommInterface ci; int size; ci.commSize(comm,&size); std::vector< MCAuto<MEDCouplingSkyLineArray> > skToBeSent(size); diff --git a/src/ParaMEDMEM/ParaSkyLineArray.hxx b/src/ParaMEDMEM/ParaSkyLineArray.hxx index 7c08e5a50..0f6abf7bf 100644 --- a/src/ParaMEDMEM/ParaSkyLineArray.hxx +++ b/src/ParaMEDMEM/ParaSkyLineArray.hxx @@ -20,12 +20,10 @@ #pragma once -#include "MEDCouplingRefCountObject.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" #include "MEDCouplingSkyLineArray.hxx" +#include "ProcessorGroup.hxx" +#include "MEDCouplingMemArray.hxx" -#include <cstddef> #include <string> #include <vector> @@ -43,7 +41,7 @@ namespace MEDCoupling MCAuto<ParaSkyLineArray> equiRedistribute(mcIdType nbOfEntities) const; MEDCouplingSkyLineArray *getSkyLineArray() const; DataArrayIdType *getGlobalIdsArray() const; - ~ParaSkyLineArray() override = default; + virtual ~ParaSkyLineArray() { } private: ParaSkyLineArray(MEDCouplingSkyLineArray *ska, DataArrayIdType *globalIds); protected: diff --git a/src/ParaMEDMEM/ParaUMesh.cxx b/src/ParaMEDMEM/ParaUMesh.cxx index bfb7d5acc..b2502f9f3 100644 --- a/src/ParaMEDMEM/ParaUMesh.cxx +++ b/src/ParaMEDMEM/ParaUMesh.cxx @@ -20,19 +20,20 @@ // Author : Anthony Geay (EDF R&D) #include "ParaUMesh.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MCAuto.hxx" -#include "MCType.hxx" -#include "ParaIdType.hxx" -#include "MEDCouplingRefCountObject.hxx" +#include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" +#include "Topology.hxx" +#include "BlockTopology.hxx" #include "CommInterface.hxx" -#include "MEDCouplingMemArray.txx" +#include "MEDCouplingMemArray.hxx" #include "mpi.h" -#include <cstddef> +#include <fstream> +#include <sstream> #include <numeric> +#include <memory> +#include <vector> using namespace MEDCoupling; @@ -81,7 +82,7 @@ MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodes(const DataArrayIdType MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodesTrue(const DataArrayIdType *globalNodeIds) const { MPI_Comm comm(MPI_COMM_WORLD); - CommInterface const ci; + CommInterface ci; int size; ci.commSize(comm,&size); std::unique_ptr<mcIdType[]> nbOfElems(new mcIdType[size]),nbOfElems2(new mcIdType[size]),nbOfElems3(new mcIdType[size]); @@ -89,7 +90,7 @@ MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodesTrue(const DataArrayIdT ci.allGather(&nbOfNodeIdsLoc,1,MPI_ID_TYPE,nbOfElems.get(),1,MPI_ID_TYPE,comm); std::vector< MCAuto<DataArrayIdType> > tabs(size); //store for each proc the local nodeids intercepted by current proc - int const nbOfCollectiveCalls = 1;// this parameter controls the memory peak + int nbOfCollectiveCalls = 1;// this parameter controls the memory peak // loop to avoid to all procs to have all the nodes per proc for(int subDiv = 0 ; subDiv < nbOfCollectiveCalls ; ++subDiv) { @@ -120,7 +121,7 @@ MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodesTrue(const DataArrayIdT { MCAuto<DataArrayIdType> localNodeIds(tabs[curRk]); localNodeIds->sort(); - MCAuto<DataArrayIdType> const localNodeIdsUnique(localNodeIds->buildUnique()); + MCAuto<DataArrayIdType> localNodeIdsUnique(localNodeIds->buildUnique()); MCAuto<DataArrayIdType> localCellCaptured(_mesh->getCellIdsLyingOnNodes(localNodeIdsUnique->begin(),localNodeIdsUnique->end(),true)); MCAuto<DataArrayIdType> localCellCapturedGlob(_cell_global->selectByTupleIdSafe(localCellCaptured->begin(),localCellCaptured->end())); tabs[curRk] = localCellCapturedGlob; @@ -150,14 +151,14 @@ MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodesTrue(const DataArrayIdT MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodesFalse(const DataArrayIdType *globalNodeIds) const { MPI_Comm comm(MPI_COMM_WORLD); - CommInterface const ci; + CommInterface ci; int size; ci.commSize(comm,&size); std::unique_ptr<mcIdType[]> nbOfElems(new mcIdType[size]),nbOfElems2(new mcIdType[size]),nbOfElems3(new mcIdType[size]); mcIdType nbOfNodeIdsLoc(globalNodeIds->getNumberOfTuples()); ci.allGather(&nbOfNodeIdsLoc,1,MPI_ID_TYPE,nbOfElems.get(),1,MPI_ID_TYPE,comm); // loop to avoid to all procs to have all the nodes per proc - int const nbOfCollectiveCalls = 1;// this parameter controls the memory peak + int nbOfCollectiveCalls = 1;// this parameter controls the memory peak std::vector< MCAuto<DataArrayIdType> > tabs(size); for(int subDiv = 0 ; subDiv < nbOfCollectiveCalls ; ++subDiv) { @@ -176,7 +177,7 @@ MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodesFalse(const DataArrayId globalNodeIdsOfCurProc->useArray(allGlobalNodeIds.get()+offset,false,DeallocType::CPP_DEALLOC,nbOfElemsSp[curRk],1); offset += nbOfElemsSp[curRk]; MCAuto<DataArrayIdType> globalNodeIdsCaptured(_node_global->buildIntersection(globalNodeIdsOfCurProc)); - MCAuto<DataArrayIdType> const localNodeIdsToLocate(_node_global->findIdForEach(globalNodeIdsCaptured->begin(),globalNodeIdsCaptured->end())); + MCAuto<DataArrayIdType> localNodeIdsToLocate(_node_global->findIdForEach(globalNodeIdsCaptured->begin(),globalNodeIdsCaptured->end())); MCAuto<DataArrayIdType> localCellCaptured(_mesh->getCellIdsLyingOnNodes(localNodeIdsToLocate->begin(),localNodeIdsToLocate->end(),false)); MCAuto<DataArrayIdType> localCellCapturedGlob(_cell_global->selectByTupleIdSafe(localCellCaptured->begin(),localCellCaptured->end())); if(tabs[curRk].isNull()) @@ -232,7 +233,7 @@ DataArrayDouble *ParaUMesh::redistributeNodeField(const DataArrayIdType *globalC ParaUMesh *ParaUMesh::redistributeCells(const DataArrayIdType *globalCellIds) const { MPI_Comm comm(MPI_COMM_WORLD); - CommInterface const ci; + CommInterface ci; std::unique_ptr<mcIdType[]> allGlobalCellIds,allGlobalCellIdsIndex; int size(ci.allGatherArrays(comm,globalCellIds,allGlobalCellIds,allGlobalCellIdsIndex)); // Prepare ParaUMesh parts to be sent : compute for each proc the contribution of current rank. @@ -245,11 +246,11 @@ ParaUMesh *ParaUMesh::redistributeCells(const DataArrayIdType *globalCellIds) co globalCellIdsOfCurProc->useArray(allGlobalCellIds.get()+offset,false,DeallocType::CPP_DEALLOC,allGlobalCellIdsIndex[curRk+1]-offset,1); // the key call is here : compute for rank curRk the cells to be sent MCAuto<DataArrayIdType> globalCellIdsCaptured(_cell_global->buildIntersection(globalCellIdsOfCurProc));// OK for the global cellIds - MCAuto<DataArrayIdType> const localCellIdsCaptured(_cell_global->findIdForEach(globalCellIdsCaptured->begin(),globalCellIdsCaptured->end())); + MCAuto<DataArrayIdType> localCellIdsCaptured(_cell_global->findIdForEach(globalCellIdsCaptured->begin(),globalCellIdsCaptured->end())); MCAuto<MEDCouplingUMesh> meshPart(_mesh->buildPartOfMySelf(localCellIdsCaptured->begin(),localCellIdsCaptured->end(),true)); MCAuto<DataArrayIdType> o2n(meshPart->zipCoordsTraducer());// OK for the mesh MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(meshPart->getNumberOfNodes())); - MCAuto<DataArrayIdType> const globalNodeIdsPart(_node_global->selectByTupleIdSafe(n2o->begin(),n2o->end())); // OK for the global nodeIds + MCAuto<DataArrayIdType> globalNodeIdsPart(_node_global->selectByTupleIdSafe(n2o->begin(),n2o->end())); // OK for the global nodeIds meshPartsToBeSent[curRk] = meshPart; globalCellIdsToBeSent[curRk] = globalCellIdsCaptured; globalNodeIdsToBeSent[curRk] = globalNodeIdsPart; @@ -283,7 +284,7 @@ ParaUMesh *ParaUMesh::redistributeCells(const DataArrayIdType *globalCellIds) co MCAuto<DataArrayIdType> aggregatedNodeIdsSorted(aggregatedNodeIds->copySorted()); MCAuto<DataArrayIdType> nodeIdsIntoAggregatedIds(DataArrayIdType::FindPermutationFromFirstToSecondDuplicate(aggregatedNodeIdsSorted,aggregatedNodeIds)); MCAuto<DataArrayIdType> idxOfSameNodeIds(aggregatedNodeIdsSorted->indexOfSameConsecutiveValueGroups()); - MCAuto<DataArrayIdType> const n2o_nodes(nodeIdsIntoAggregatedIds->selectByTupleIdSafe(idxOfSameNodeIds->begin(),idxOfSameNodeIds->end()-1));//new == new ordering so that global node ids are sorted . old == coarse ordering implied by the aggregation + MCAuto<DataArrayIdType> n2o_nodes(nodeIdsIntoAggregatedIds->selectByTupleIdSafe(idxOfSameNodeIds->begin(),idxOfSameNodeIds->end()-1));//new == new ordering so that global node ids are sorted . old == coarse ordering implied by the aggregation MCAuto<DataArrayIdType> finalGlobalNodeIds(aggregatedNodeIdsSorted->selectByTupleIdSafe(idxOfSameNodeIds->begin(),idxOfSameNodeIds->end()-1)); MCAuto<DataArrayDouble> finalCoords(coords->selectByTupleIdSafe(n2o_nodes->begin(),n2o_nodes->end())); finalCoords->copyStringInfoFrom(*_mesh->getCoords()); diff --git a/src/ParaMEDMEM/ParaUMesh.hxx b/src/ParaMEDMEM/ParaUMesh.hxx index b915b3e08..9e6d83e50 100644 --- a/src/ParaMEDMEM/ParaUMesh.hxx +++ b/src/ParaMEDMEM/ParaUMesh.hxx @@ -20,16 +20,12 @@ #pragma once -#include "MEDCouplingRefCountObject.hxx" -#include "MCAuto.hxx" -#include "MEDCouplingTraits.hxx" -#include "CommInterface.hxx" -#include "MCType.hxx" #include "MEDCouplingUMesh.hxx" +#include "ProcessorGroup.hxx" #include "MEDCouplingMemArray.hxx" -#include <cstddef> #include <string> +#include <vector> namespace MEDCoupling { @@ -52,7 +48,7 @@ namespace MEDCoupling DataArrayIdType *getGlobalCellIds() { return _cell_global; } DataArrayIdType *getGlobalNodeIds() { return _node_global; } protected: - ~ParaUMesh() override = default; + virtual ~ParaUMesh() { } ParaUMesh(MEDCouplingUMesh *mesh, DataArrayIdType *globalCellIds, DataArrayIdType *globalNodeIds); std::string getClassName() const override { return "ParaUMesh"; } std::size_t getHeapMemorySizeWithoutChildren() const override; @@ -69,7 +65,7 @@ namespace MEDCoupling { using DataArrayT = typename Traits<T>::ArrayType; MPI_Comm comm(MPI_COMM_WORLD); - CommInterface const ci; + CommInterface ci; if( _cell_global->getNumberOfTuples() != fieldValueToRed->getNumberOfTuples() ) throw INTERP_KERNEL::Exception("PAraUMesh::redistributeCellFieldT : invalid input length of array !"); std::unique_ptr<mcIdType[]> allGlobalCellIds,allGlobalCellIdsIndex; @@ -110,7 +106,7 @@ namespace MEDCoupling { using DataArrayT = typename Traits<T>::ArrayType; MPI_Comm comm(MPI_COMM_WORLD); - CommInterface const ci; + CommInterface ci; if( _node_global->getNumberOfTuples() != fieldValueToRed->getNumberOfTuples() ) throw INTERP_KERNEL::Exception("PAraUMesh::redistributeNodeFieldT : invalid input length of array !"); std::unique_ptr<mcIdType[]> allGlobalCellIds,allGlobalCellIdsIndex; @@ -125,7 +121,7 @@ namespace MEDCoupling globalCellIdsOfCurProc->useArray(allGlobalCellIds.get()+offset,false,DeallocType::CPP_DEALLOC,allGlobalCellIdsIndex[curRk+1]-offset,1); // the key call is here : compute for rank curRk the cells to be sent MCAuto<DataArrayIdType> globalCellIdsCaptured(_cell_global->buildIntersection(globalCellIdsOfCurProc));// OK for the global cellIds - MCAuto<DataArrayIdType> const localCellIdsCaptured(_cell_global->findIdForEach(globalCellIdsCaptured->begin(),globalCellIdsCaptured->end())); + MCAuto<DataArrayIdType> localCellIdsCaptured(_cell_global->findIdForEach(globalCellIdsCaptured->begin(),globalCellIdsCaptured->end())); MCAuto<MEDCouplingUMesh> meshPart(_mesh->buildPartOfMySelf(localCellIdsCaptured->begin(),localCellIdsCaptured->end(),true)); MCAuto<DataArrayIdType> o2n(meshPart->zipCoordsTraducer());// OK for the mesh MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(meshPart->getNumberOfNodes())); diff --git a/src/ParaMEDMEM/ProcessorGroup.cxx b/src/ParaMEDMEM/ProcessorGroup.cxx index 26406189b..a1834d14f 100644 --- a/src/ParaMEDMEM/ProcessorGroup.cxx +++ b/src/ParaMEDMEM/ProcessorGroup.cxx @@ -18,7 +18,7 @@ // #include "ProcessorGroup.hxx" -#include "CommInterface.hxx" +#include "InterpolationUtils.hxx" namespace MEDCoupling { diff --git a/src/ParaMEDMEM/ProcessorGroup.hxx b/src/ParaMEDMEM/ProcessorGroup.hxx index 63320b389..7e5e71048 100644 --- a/src/ParaMEDMEM/ProcessorGroup.hxx +++ b/src/ParaMEDMEM/ProcessorGroup.hxx @@ -22,7 +22,7 @@ #include "CommInterface.hxx" -#include <string> +#include <set> namespace MEDCoupling { @@ -45,7 +45,7 @@ namespace MEDCoupling ProcessorGroup (const CommInterface& interface, int start, int end); ProcessorGroup(const CommInterface& interface,std::map<std::string,std::set<int>> proc_ids_by_name,const std::string& simCodeTag): _comm_interface(interface),_proc_ids_by_name(proc_ids_by_name),_proc_ids(proc_ids_by_name.at(simCodeTag)) { } - virtual ~ProcessorGroup() = default; + virtual ~ProcessorGroup() { } virtual ProcessorGroup *deepCopy() const = 0; virtual ProcessorGroup* fuse (const ProcessorGroup&) const = 0; virtual void intersect (ProcessorGroup&) = 0; diff --git a/src/ParaMEDMEM/StructuredCoincidentDEC.cxx b/src/ParaMEDMEM/StructuredCoincidentDEC.cxx index 05f5273c2..89c0ce4c3 100644 --- a/src/ParaMEDMEM/StructuredCoincidentDEC.cxx +++ b/src/ParaMEDMEM/StructuredCoincidentDEC.cxx @@ -17,11 +17,8 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include <cstddef> #include <mpi.h> -#include "DisjointDEC.hxx" -#include "MCType.hxx" -#include "ParaIdType.hxx" +#include "CommInterface.hxx" #include "Topology.hxx" #include "BlockTopology.hxx" #include "ComponentTopology.hxx" @@ -31,7 +28,6 @@ #include "InterpKernelUtilities.hxx" #include <iostream> -#include <utility> using namespace std; @@ -126,15 +122,15 @@ namespace MEDCoupling if (!_topo_source->getProcGroup()->containsMyRank()) return; - auto* group=new MPIProcessorGroup(_topo_source->getProcGroup()->getCommInterface()); + MPIProcessorGroup* group=new MPIProcessorGroup(_topo_source->getProcGroup()->getCommInterface()); - int const myranksource = _topo_source->getProcGroup()->myRank(); + int myranksource = _topo_source->getProcGroup()->myRank(); vector <mcIdType>* target_arrays=new vector<mcIdType>[_topo_target->getProcGroup()->size()]; //cout<<" topotarget size"<< _topo_target->getProcGroup()->size()<<endl; - mcIdType const nb_local = _topo_source-> getNbLocalElements(); + mcIdType nb_local = _topo_source-> getNbLocalElements(); for (mcIdType ielem=0; ielem< nb_local ; ielem++) { // cout <<"source local :"<<myranksource<<","<<ielem<<endl; @@ -163,7 +159,7 @@ namespace MEDCoupling for (int iproc=0; iproc < _topo_target->getProcGroup()->size(); iproc++) { //converts the rank in target to the rank in union communicator - int const unionrank=group->translateRank(_topo_target->getProcGroup(),iproc); + int unionrank=group->translateRank(_topo_target->getProcGroup(),iproc); _send_counts[unionrank]=(int)target_arrays[iproc].size(); } @@ -204,12 +200,12 @@ namespace MEDCoupling { if (!_topo_target->getProcGroup()->containsMyRank()) return; - auto* group=new MPIProcessorGroup(_topo_source->getProcGroup()->getCommInterface()); + MPIProcessorGroup* group=new MPIProcessorGroup(_topo_source->getProcGroup()->getCommInterface()); - int const myranktarget = _topo_target->getProcGroup()->myRank(); + int myranktarget = _topo_target->getProcGroup()->myRank(); vector < vector <mcIdType> > source_arrays(_topo_source->getProcGroup()->size()); - mcIdType const nb_local = _topo_target-> getNbLocalElements(); + mcIdType nb_local = _topo_target-> getNbLocalElements(); for (mcIdType ielem=0; ielem< nb_local ; ielem++) { // cout <<"TS target local :"<<myranktarget<<","<<ielem<<endl; @@ -234,7 +230,7 @@ namespace MEDCoupling for (int iproc=0; iproc < _topo_source->getProcGroup()->size(); iproc++) { //converts the rank in target to the rank in union communicator - int const unionrank=group->translateRank(_topo_source->getProcGroup(),iproc); + int unionrank=group->translateRank(_topo_source->getProcGroup(),iproc); _recv_counts[unionrank]=(int)source_arrays[iproc].size(); } for (std::size_t i=1; i<union_size; i++) @@ -256,15 +252,15 @@ namespace MEDCoupling { MPI_Status status; - mcIdType* serializer=nullptr; + mcIdType* serializer=0; mcIdType size; - auto* group=new MPIProcessorGroup(*_comm_interface); + MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface); // The master proc creates a send buffer containing a serialized topology int rank_master; - if (topo!=nullptr && topo->getProcGroup()->myRank()==0) + if (topo!=0 && topo->getProcGroup()->myRank()==0) { MESSAGE ("Master rank"); topo->serialize(serializer, size); @@ -286,23 +282,23 @@ namespace MEDCoupling // The topology is broadcasted to all processors in the group _comm_interface->broadcast(&size, 1,MPI_ID_TYPE,rank_master,*(group->getComm())); - auto* buffer=new mcIdType[size]; - if (topo!=nullptr && topo->getProcGroup()->myRank()==0) + mcIdType* buffer=new mcIdType[size]; + if (topo!=0 && topo->getProcGroup()->myRank()==0) copy(serializer, serializer+size, buffer); _comm_interface->broadcast(buffer,(int)size,MPI_ID_TYPE,rank_master,*(group->getComm())); // Processors which did not possess the source topology unserialize it - auto* topotemp=new BlockTopology(); + BlockTopology* topotemp=new BlockTopology(); topotemp->unserialize(buffer, *_comm_interface); - if (topo==nullptr) + if (topo==0) topo=topotemp; else delete topotemp; // Memory cleaning delete[] buffer; - if (serializer!=nullptr) + if (serializer!=0) delete[] serializer; MESSAGE (" rank "<<group->myRank()<< " unserialize is over"); delete group; @@ -328,17 +324,17 @@ namespace MEDCoupling _recv_buffer, _recv_counts, _recv_displs, MPI_DOUBLE,comm); cout<<"end AllToAll"<<endl; - mcIdType const nb_local = _topo_target->getNbLocalElements(); + mcIdType nb_local = _topo_target->getNbLocalElements(); //double* value=new double[nb_local]; - auto* value=const_cast<double*>(_local_field->getField()->getArray()->getPointer()); + double* value=const_cast<double*>(_local_field->getField()->getArray()->getPointer()); - int const myranktarget=_topo_target->getProcGroup()->myRank(); + int myranktarget=_topo_target->getProcGroup()->myRank(); vector<int> counters(_topo_source->getProcGroup()->size()); counters[0]=0; for (int i=0; i<_topo_source->getProcGroup()->size()-1; i++) { - auto* group=new MPIProcessorGroup(*_comm_interface); - int const worldrank=group->translateRank(_topo_source->getProcGroup(),i); + MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface); + int worldrank=group->translateRank(_topo_source->getProcGroup(),i); counters[i+1]=counters[i]+_recv_counts[worldrank]; delete group; } diff --git a/src/ParaMEDMEM/StructuredCoincidentDEC.hxx b/src/ParaMEDMEM/StructuredCoincidentDEC.hxx index 1db7f9b06..7c821c4e0 100644 --- a/src/ParaMEDMEM/StructuredCoincidentDEC.hxx +++ b/src/ParaMEDMEM/StructuredCoincidentDEC.hxx @@ -86,14 +86,14 @@ namespace MEDCoupling public: StructuredCoincidentDEC(); StructuredCoincidentDEC( ProcessorGroup& source, ProcessorGroup& target); - ~StructuredCoincidentDEC() override; + virtual ~StructuredCoincidentDEC(); void release(); - void synchronize() override; - void recvData() override; - void sendData() override; - void prepareSourceDE() override; - void prepareTargetDE() override; + void synchronize(); + void recvData(); + void sendData(); + void prepareSourceDE(); + void prepareTargetDE(); private : void synchronizeTopology(); diff --git a/src/ParaMEDMEM/TimeInterpolator.cxx b/src/ParaMEDMEM/TimeInterpolator.cxx index 8e8af1635..2a94cdd79 100644 --- a/src/ParaMEDMEM/TimeInterpolator.cxx +++ b/src/ParaMEDMEM/TimeInterpolator.cxx @@ -29,5 +29,6 @@ namespace MEDCoupling } TimeInterpolator::~TimeInterpolator() - = default; + { + } } diff --git a/src/ParaMEDMEM/TimeInterpolator.hxx b/src/ParaMEDMEM/TimeInterpolator.hxx index 258f45230..8673d1cf1 100644 --- a/src/ParaMEDMEM/TimeInterpolator.hxx +++ b/src/ParaMEDMEM/TimeInterpolator.hxx @@ -20,7 +20,10 @@ #ifndef __TIMEINTERPOLATOR_HXX__ #define __TIMEINTERPOLATOR_HXX__ +#include "ProcessorGroup.hxx" +#include <map> +#include <iostream> namespace MEDCoupling { diff --git a/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx b/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx index 079da0bc1..423591332 100644 --- a/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx @@ -19,17 +19,14 @@ #include "RENUMBER_BOOSTRenumbering.hxx" -#include "MCIdType.hxx" -#include "MCType.hxx" #include "MEDCouplingMemArray.hxx" #include "MCAuto.hxx" +#include <boost/config.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/cuthill_mckee_ordering.hpp> -#include <boost/graph/graph_selectors.hpp> -#include <boost/graph/detail/adjacency_list.hpp> #include <boost/graph/properties.hpp> -#include <boost/pending/property.hpp> +#include <boost/graph/bandwidth.hpp> void BOOSTRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) { @@ -45,7 +42,7 @@ void BOOSTRenumbering::renumber(const mcIdType *graph, const mcIdType *index_gra for (mcIdType j=index_graph[i];j<index_graph[i+1];++j) add_edge(i,graph[j],G); boost::property_map<Graph, boost::vertex_index_t>::type - const index_map = boost::get(boost::vertex_index, G); + index_map = boost::get(boost::vertex_index, G); boost::cuthill_mckee_ordering(G, out0->getPointer(), boost::get(boost::vertex_color, G), boost::make_degree_map(G)); mcIdType *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer()); diff --git a/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx b/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx index 74f785dbd..648420742 100644 --- a/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx +++ b/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx @@ -20,15 +20,13 @@ #ifndef __BOOSTRENUMBERING_HXX__ #define __BOOSTRENUMBERING_HXX__ -#include "MCIdType.hxx" -#include "MCType.hxx" #include "RENUMBERDefines.hxx" #include "RENUMBER_Renumbering.hxx" class RENUMBER_EXPORT BOOSTRenumbering:public Renumbering { public: - void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) override; + void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm); }; #endif /*BOOSTRENUMBERING_HXX_*/ diff --git a/src/RENUMBER/RENUMBER_METISRenumbering.cxx b/src/RENUMBER/RENUMBER_METISRenumbering.cxx index 0e90cba77..b4d626815 100644 --- a/src/RENUMBER/RENUMBER_METISRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_METISRenumbering.cxx @@ -17,10 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MCIdType.hxx" -#include "MCType.hxx" -#include <vector> -#include <algorithm> #ifdef MED_ENABLE_PARMETIS // include parmetis.h even if it is not needed here // to avoid inclusion of c++ definitions within extern "C" @@ -61,7 +57,7 @@ void METISRenumbering::renumber(const mcIdType *graph, const mcIdType *index_gra std::vector<idx_t> indexVec( index_graph, index_graph + indexSize ); std::vector<idx_t> graphVec( graph, graph + graphSize ); std::vector<idx_t> out0Vec( nbCell ), out1Vec( nbCell ); - auto nb = static_cast<idx_t>( nbCell ); + idx_t nb = static_cast<idx_t>( nbCell ); METIS_NodeND(&nb,indexVec.data(),graphVec.data(),&num_flag,&options,out0Vec.data(),out1Vec.data()); std::copy( out0Vec.begin(),out0Vec.end(),out0->getPointer() ); std::copy( out1Vec.begin(),out1Vec.end(),out1->getPointer() ); diff --git a/src/RENUMBER/RENUMBER_METISRenumbering.hxx b/src/RENUMBER/RENUMBER_METISRenumbering.hxx index b61c42a96..8d0ad6d4f 100644 --- a/src/RENUMBER/RENUMBER_METISRenumbering.hxx +++ b/src/RENUMBER/RENUMBER_METISRenumbering.hxx @@ -20,15 +20,13 @@ #ifndef __METISRENUMBERING_HXX__ #define __METISRENUMBERING_HXX__ -#include "MCIdType.hxx" -#include "MCType.hxx" #include "RENUMBERDefines.hxx" #include "RENUMBER_Renumbering.hxx" class RENUMBER_EXPORT METISRenumbering:public Renumbering { public: - void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nb_cell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) override; + virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nb_cell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm); }; #endif /*METISRENUMBERING_HXX_*/ diff --git a/src/RENUMBER/RENUMBER_Renumbering.hxx b/src/RENUMBER/RENUMBER_Renumbering.hxx index d6ebbd61a..7742218a6 100644 --- a/src/RENUMBER/RENUMBER_Renumbering.hxx +++ b/src/RENUMBER/RENUMBER_Renumbering.hxx @@ -20,10 +20,10 @@ #ifndef RENUMBERING_HXX_ #define RENUMBERING_HXX_ -#include "MCIdType.hxx" #include "RENUMBERDefines.hxx" #include "MCType.hxx" +#include <vector> namespace MEDCoupling { @@ -34,7 +34,7 @@ class RENUMBER_EXPORT Renumbering { public: virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) = 0; - virtual ~Renumbering() = default; + virtual ~Renumbering() { } }; #endif /*RENUMBERING_HXX_*/ diff --git a/src/RENUMBER/RenumberingFactory.cxx b/src/RENUMBER/RenumberingFactory.cxx index 6ad2eea46..e53c634a8 100644 --- a/src/RENUMBER/RenumberingFactory.cxx +++ b/src/RENUMBER/RenumberingFactory.cxx @@ -19,9 +19,6 @@ #include "RenumberingFactory.hxx" #include "RENUMBER_Renumbering.hxx" -#include <string> -#include <cctype> -#include <vector> #ifdef MED_ENABLE_METIS #include "RENUMBER_METISRenumbering.hxx" #endif @@ -57,7 +54,7 @@ namespace MED_RENUMBER else { std::cerr << "The method has to be METIS or BOOST" << std::endl; - return nullptr; + return 0; } #endif #ifndef ENABLE_BOOST diff --git a/src/RENUMBER/RenumberingFactory.hxx b/src/RENUMBER/RenumberingFactory.hxx index b1f5b9e4d..540a14e78 100644 --- a/src/RENUMBER/RenumberingFactory.hxx +++ b/src/RENUMBER/RenumberingFactory.hxx @@ -24,7 +24,6 @@ #include "RENUMBER_Renumbering.hxx" #include <string> -#include <vector> namespace MED_RENUMBER { diff --git a/src/RENUMBER/renumbering.cxx b/src/RENUMBER/renumbering.cxx index ac312d4a1..a417f7cc1 100644 --- a/src/RENUMBER/renumbering.cxx +++ b/src/RENUMBER/renumbering.cxx @@ -17,25 +17,18 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MCAuto.hxx" -#include "MCType.hxx" -#include "MCIdType.hxx" -#include "MEDCouplingMemArray.hxx" #include "MEDFileData.hxx" -#include "MEDFileFieldMultiTS.hxx" -#include "MEDFileField1TS.hxx" #include "MEDFileMesh.hxx" #include "MEDFileField.hxx" #include "MEDCouplingUMesh.hxx" -#include "RENUMBER_Renumbering.hxx" #include "RenumberingFactory.hxx" -#include <sstream> #include <time.h> #include <string> #include <cstdlib> +#include <fstream> #include <iostream> using namespace std; @@ -52,10 +45,10 @@ int main(int argc, char** argv) << " filename_in meshname method[BOOST/METIS] filename_out" << endl << endl; return -1; } - string const filename_in = argv[1]; - string const meshname = argv[2]; - string const type_renum = argv[3]; - string const filename_out = argv[4]; + string filename_in = argv[1]; + string meshname = argv[2]; + string type_renum = argv[3]; + string filename_out = argv[4]; if(type_renum!="METIS" && type_renum!="BOOST") { @@ -66,7 +59,7 @@ int main(int argc, char** argv) cout << "Reading : " << flush; MCAuto<MEDFileData> fd(MEDFileData::New(filename_in)); MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname); - auto *mc=dynamic_cast<MEDFileUMesh *>(m); + MEDFileUMesh *mc=dynamic_cast<MEDFileUMesh *>(m); if(!mc) { std::ostringstream oss; oss << "In file \"" << filename_in << "\" the mesh name \"" << meshname<< "\" exists but is not unstructured !"; @@ -78,18 +71,18 @@ int main(int argc, char** argv) MCAuto<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0); //std::vector<mcIdType> code=workMesh->getDistributionOfTypes(); cout << "Building the graph : " << flush; - DataArrayIdType *neighb=nullptr,*neighbI=nullptr; + DataArrayIdType *neighb=0,*neighbI=0; workMesh->computeNeighborsOfCells(neighb,neighbI); MCAuto<DataArrayIdType> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe; const mcIdType *graph=neighbSafe->begin(); const mcIdType *graph_index=neighbISafe->begin(); // Compute permutation iperm->new2old perm->old2new - DataArrayIdType *iperm(nullptr),*perm(nullptr); + DataArrayIdType *iperm(0),*perm(0); Renumbering *renumb=RenumberingFactory(type_renum); renumb->renumber(graph,graph_index,workMesh->getNumberOfCells(),iperm,perm); ipermSafe=iperm; permSafe=perm; delete renumb; - ipermSafe=nullptr;//erase new2old, we are using only old 2 new + ipermSafe=0;//erase new2old, we are using only old 2 new t_compute_graph=(double)clock(); cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl; cout.flush(); @@ -113,13 +106,13 @@ int main(int argc, char** argv) { for(int i=0;i<fs->getNumberOfFields();i++) { - auto *fmts=dynamic_cast<MEDFileFieldMultiTS *>(fs->getFieldAtPos(i)); + MEDFileFieldMultiTS *fmts=dynamic_cast<MEDFileFieldMultiTS *>(fs->getFieldAtPos(i)); if(!fmts) continue; if(fmts->getMeshName()==meshname) { for(int j=0;j<fmts->getNumberOfTS();j++) { - auto *f1ts=dynamic_cast<MEDFileField1TS*>(fmts->getTimeStepAtPos(j)); + MEDFileField1TS *f1ts=dynamic_cast<MEDFileField1TS*>(fmts->getTimeStepAtPos(j)); if(!f1ts) continue; DataArrayDouble *arr=f1ts->getUndergroundDataArray(); arr->renumberInPlace(perm->begin()); -- 2.39.2